fix: iOS push notification prompt

iOS requires user gesture for Notification.requestPermission().
- Added NotificationPrompt banner that shows on permission='default'
- autoSubscribePush only fires when already 'granted' (re-subscribe on restore)
- Banner uses tap handler for permission request (works on iOS)
- Gruvbox themed, dismissible, bottom-center toast
This commit is contained in:
2026-07-02 15:04:31 -04:00
parent 0bd049f52a
commit e80334e336
3 changed files with 67 additions and 1 deletions
+3 -1
View File
@@ -72,10 +72,12 @@ interface AuthState {
}
// ponytail: auto-subscribe to push notifications on auth
// Only fires when permission is already 'granted' (re-subscribe on session restore).
// iOS requires a user gesture for the initial permission prompt — that's handled by NotificationPrompt.
function autoSubscribePush() {
import("../stores/push.ts").then(({ usePushStore }) => {
const ps = usePushStore.getState();
if (ps.isSupported && Notification.permission !== 'denied' && !ps.isSubscribed) {
if (ps.isSupported && Notification.permission === 'granted' && !ps.isSubscribed) {
ps.subscribe();
}
});