diff options
author | Paul Frazee <pfrazee@gmail.com> | 2023-01-24 19:32:24 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-24 19:32:24 -0600 |
commit | 869f6c4e0e464b7f5be9ef5676210ae8844bd834 (patch) | |
tree | a9a823723099129bb25c4b57435925b481d54266 /src/App.native.tsx | |
parent | 21f5f4de157a73b3c4406461b2a36555b1bff228 (diff) | |
download | voidsky-869f6c4e0e464b7f5be9ef5676210ae8844bd834.tar.zst |
Initial pass at push notifications + some fixes to the session management (#91)
* Fix: test the session during resume to ensure it's valid * Don't delete sessions for now * Add notifee and request notif permissions on first login * Set unread notifications badge on app icon * Trigger a notifee card on new notifications * Experimental: use react-native-background-fetch to check for notifications * Add missing mocks * Fix to resumeSession()
Diffstat (limited to 'src/App.native.tsx')
-rw-r--r-- | src/App.native.tsx | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/App.native.tsx b/src/App.native.tsx index 30747dbfc..f00e3cad1 100644 --- a/src/App.native.tsx +++ b/src/App.native.tsx @@ -16,6 +16,7 @@ import * as view from './view/index' import {RootStoreModel, setupState, RootStoreProvider} from './state' import {MobileShell} from './view/shell/mobile' import {s} from './view/lib/styles' +import notifee, {EventType} from '@notifee/react-native' const App = observer(() => { const [rootStore, setRootStore] = useState<RootStoreModel | undefined>( @@ -43,6 +44,13 @@ const App = observer(() => { Linking.addEventListener('url', ({url}) => { store.nav.handleLink(url) }) + notifee.onForegroundEvent(async ({type}: {type: EventType}) => { + store.log.debug('Notifee foreground event', {type}) + if (type === EventType.PRESS) { + store.log.debug('User pressed a notifee, opening notifications') + store.nav.switchTo(1, true) + } + }) }) }, []) |