diff options
author | Ansh <anshnanda10@gmail.com> | 2023-08-30 18:04:33 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-30 18:04:33 -0700 |
commit | 4ac82536c944048b6ee71130873d7fc6b115cb6f (patch) | |
tree | 754aba2349b9907f0fa880aa3c7175ad0ab158e2 /src/lib/notifications/notifications.ts | |
parent | 4bec7c1d856a9e75b5594995b26b5e01847df848 (diff) | |
download | voidsky-4ac82536c944048b6ee71130873d7fc6b115cb6f.tar.zst |
Fix 1304 refresh notifications when a notif is clicked or received (#1339)
* refresh notifications when a notif is clicked * make notification syncing smarter * allow enabled appview proxy on mobile * put back syncqueue code
Diffstat (limited to 'src/lib/notifications/notifications.ts')
-rw-r--r-- | src/lib/notifications/notifications.ts | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/lib/notifications/notifications.ts b/src/lib/notifications/notifications.ts index 88ebed044..dfc9a42b1 100644 --- a/src/lib/notifications/notifications.ts +++ b/src/lib/notifications/notifications.ts @@ -61,10 +61,13 @@ export function init(store: RootStoreModel) { }) }) - // handle notifications that are tapped on, regardless of whether the app is in the foreground or background + // handle notifications that are received, both in the foreground or background Notifications.addNotificationReceivedListener(event => { store.log.debug('Notifications: received', event) if (event.request.trigger.type === 'push') { + // refresh notifications in the background + store.me.notifications.syncQueue() + // handle payload-based deeplinks let payload if (isIOS) { payload = event.request.trigger.payload @@ -78,6 +81,7 @@ export function init(store: RootStoreModel) { } }) + // handle notifications that are tapped on const sub = Notifications.addNotificationResponseReceivedListener( response => { store.log.debug( @@ -91,7 +95,8 @@ export function init(store: RootStoreModel) { 'User pressed a notification, opening notifications tab', ) track('Notificatons:OpenApp') - resetToTab('NotificationsTab') + store.me.notifications.refresh() // refresh notifications + resetToTab('NotificationsTab') // open notifications tab } }, ) |