[Session] Drill getAgent
into notifications handlers (#3705)
* Drill into notifications handlers (cherry picked from commit 7ac9e500866732e1f2e205bbe96e70db331e5ffb) * Thread getAgent instead --------- Co-authored-by: Dan Abramov <dan.abramov@gmail.com>
This commit is contained in:
parent
e5fdbfe294
commit
d8c8e1e854
2 changed files with 10 additions and 4 deletions
|
@ -1,12 +1,13 @@
|
|||
import {useEffect} from 'react'
|
||||
import * as Notifications from 'expo-notifications'
|
||||
import {BskyAgent} from '@atproto/api'
|
||||
import {QueryClient} from '@tanstack/react-query'
|
||||
|
||||
import {logger} from '#/logger'
|
||||
import {RQKEY as RQKEY_NOTIFS} from '#/state/queries/notifications/feed'
|
||||
import {invalidateCachedUnreadPage} from '#/state/queries/notifications/unread'
|
||||
import {truncateAndInvalidate} from '#/state/queries/util'
|
||||
import {getAgent, SessionAccount} from '#/state/session'
|
||||
import {SessionAccount} from '#/state/session'
|
||||
import {track} from 'lib/analytics/analytics'
|
||||
import {devicePlatform, isIOS} from 'platform/detection'
|
||||
import {resetToTab} from '../../Navigation'
|
||||
|
@ -18,6 +19,7 @@ const SERVICE_DID = (serviceUrl?: string) =>
|
|||
: 'did:web:api.bsky.app'
|
||||
|
||||
export async function requestPermissionsAndRegisterToken(
|
||||
getAgent: () => BskyAgent,
|
||||
account: SessionAccount,
|
||||
) {
|
||||
// request notifications permission once the user has logged in
|
||||
|
@ -49,6 +51,7 @@ export async function requestPermissionsAndRegisterToken(
|
|||
}
|
||||
|
||||
export function registerTokenChangeHandler(
|
||||
getAgent: () => BskyAgent,
|
||||
account: SessionAccount,
|
||||
): () => void {
|
||||
// listens for new changes to the push token
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue