File tree Expand file tree Collapse file tree 3 files changed +20
-6
lines changed Expand file tree Collapse file tree 3 files changed +20
-6
lines changed Original file line number Diff line number Diff line change @@ -7,18 +7,32 @@ import { toast } from 'sonner-native';
7
7
import { useSetAtom } from 'jotai' ;
8
8
import { selectedWorkspaceFamily } from './useGetCurrentWorkspace' ;
9
9
import useSiteContext from './useSiteContext' ;
10
+ import { getMessaging } from '@react-native-firebase/messaging' ;
11
+
12
+ const messaging = getMessaging ( )
10
13
11
14
12
15
export const useLogout = ( ) => {
13
16
const siteInformation = useSiteContext ( )
14
- const { tokenParams } = useContext ( FrappeContext ) as FrappeConfig
17
+ const { tokenParams, call } = useContext ( FrappeContext ) as FrappeConfig
15
18
16
19
const setSelectedWorkspace = useSetAtom ( selectedWorkspaceFamily ( siteInformation ?. sitename || '' ) )
17
20
18
21
const logout = ( ) => {
19
22
// Remove the current site from AsyncStorage
20
23
// Revoke the token
21
24
// Redirect to the landing page
25
+ try {
26
+ messaging . getToken ( ) . then ( ( token ) => {
27
+ if ( token ) {
28
+ call . post ( 'raven.api.notification.unsubscribe' , {
29
+ fcm_token : token
30
+ } )
31
+ }
32
+ } )
33
+ } catch ( error ) {
34
+ console . error ( error )
35
+ }
22
36
setSelectedWorkspace ( '' )
23
37
clearDefaultSite ( )
24
38
. then ( ( ) => {
Original file line number Diff line number Diff line change 15
15
"@expo/dom-webview" : " ^0.0.2" ,
16
16
"@expo/react-native-action-sheet" : " ^4.1.0" ,
17
17
"@gorhom/bottom-sheet" : " 5.0.6" ,
18
- "@legendapp/list" : " ^1.0.11 " ,
18
+ "@legendapp/list" : " ^1.0.13 " ,
19
19
"@raven/lib" : " *" ,
20
20
"@react-native-async-storage/async-storage" : " 1.23.1" ,
21
21
"@react-native-firebase/app" : " ^21.11.0" ,
Original file line number Diff line number Diff line change 2609
2609
resolved "https://registry.yarnpkg.com/@jsamr/react-native-li/-/react-native-li-2.3.1.tgz#12a5b5f6e3971cec77b96bee58104eed0ae9314a"
2610
2610
integrity sha512-Qbo4NEj48SQ4k8FZJHFE2fgZDKTWaUGmVxcIQh3msg5JezLdTMMHuRRDYctfdHI6L0FZGObmEv3haWbIvmol8w==
2611
2611
2612
- "@legendapp/list@^1.0.11 ":
2613
- version "1.0.11 "
2614
- resolved "https://registry.yarnpkg.com/@legendapp/list/-/list-1.0.11 .tgz#71641aad790f0c02c26542e4ac2d9930bd62301e "
2615
- integrity sha512-A1DK2Buqvev2c1nV77/M0Xnft5aIX+7AmUbLY/meHiK5SI98hX7qq3U1VSDHUbrk7fPOD1Skdt2F3THwRy9Ijw ==
2612
+ "@legendapp/list@^1.0.13 ":
2613
+ version "1.0.13 "
2614
+ resolved "https://registry.yarnpkg.com/@legendapp/list/-/list-1.0.13 .tgz#bfca62d4243b448b43120c1d25807534dae846a7 "
2615
+ integrity sha512-qTFbWEvdNM0wA7voVL+l+NLC8NfFmyqh/QvFratMiA5XImW2BPqN79Qq1x56SIVWnxxakHPjaW8J2wE0p+qMDQ ==
2616
2616
dependencies:
2617
2617
use-sync-external-store "^1.5.0"
2618
2618
You can’t perform that action at this time.
0 commit comments