File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed
Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -2,12 +2,13 @@ import {PushNotifications} from '@capacitor/push-notifications'
22import { useEffect } from "react"
33import { api } from "web/lib/api"
44import { useUser } from "web/hooks/use-user"
5+ import { isAndroidWebView } from "web/lib/util/webview" ;
56
67export default function AndroidPush ( ) {
78 const user = useUser ( ) // authenticated user
8- const isWeb = typeof window !== 'undefined' && 'serviceWorker' in navigator
9+ const isAndroid = isAndroidWebView ( )
910 useEffect ( ( ) => {
10- if ( ! user ?. id || isWeb ) return
11+ if ( ! user ?. id || ! isAndroid ) return
1112 console . log ( 'AndroidPush' , user )
1213
1314 PushNotifications . requestPermissions ( ) . then ( result => {
@@ -28,7 +29,7 @@ export default function AndroidPush() {
2829 PushNotifications . addListener ( 'pushNotificationReceived' , notif => {
2930 console . log ( 'Push received' , notif )
3031 } )
31- } , [ user ?. id , isWeb ] )
32+ } , [ user ?. id , isAndroid ] )
3233
3334 return null
3435}
You can’t perform that action at this time.
0 commit comments