11import { DEFAULT_IDENTITY_NAME } from '@/src/common/constants' ;
2+ import useFollows from '@/src/features/follow/hooks/useFollows' ;
23import {
34 PolycentricClient ,
45 createPolycentricClient ,
@@ -16,15 +17,14 @@ import {
1617 useState ,
1718 type ReactNode ,
1819} from 'react' ;
19- import { ActivityIndicator , Platform , Text , View } from 'react-native' ;
20- import useFollows from '@/src/features/follow/hooks/useFollows ' ;
21- import { pubkeyStr } from './helpers ' ;
20+ import { Platform , Text , View } from 'react-native' ;
21+ import { Atoms , useTheme } from '../../theme ' ;
22+ import { registerForPushNotifications } from '../notifications/registerPushToken ' ;
2223import {
2324 createPolycentricStore ,
2425 useStore ,
2526 type PolycentricStoreApi ,
2627} from './store' ;
27- import { Atoms , useTheme } from '../../theme' ;
2828
2929export interface PolycentricContextValue {
3030 client : PolycentricClient ;
@@ -126,6 +126,22 @@ export function PolycentricProvider({
126126 }
127127 } , [ isLoading , onInitialized ] ) ;
128128
129+ useEffect ( ( ) => {
130+ if ( ! client || ! currentIdentity ) return ;
131+ void ( async ( ) => {
132+ try {
133+ const token = await registerForPushNotifications ( ) ;
134+ if ( ! token ) return ;
135+ await client . registerPushNotifications ( DEFAULT_SEED_SERVERS , {
136+ service : 'expo' ,
137+ token,
138+ } ) ;
139+ } catch ( err ) {
140+ console . warn ( 'Push registration failed:' , err ) ;
141+ }
142+ } ) ( ) ;
143+ } , [ client , currentIdentity ?. identityKey ] ) ;
144+
129145 useEffect ( ( ) => {
130146 let cancelled = false ;
131147
0 commit comments