Only re-reg push noty token when account changes (#2654)
parent
5ee802bb1f
commit
96f39657d7
|
@ -52,6 +52,8 @@ function ShellInner() {
|
|||
const canGoBack = useNavigationState(state => !isStateAtTabRoot(state))
|
||||
const {hasSession, currentAccount} = useSession()
|
||||
const closeAnyActiveElement = useCloseAnyActiveElement()
|
||||
// start undefined
|
||||
const currentAccountDid = React.useRef<string | undefined>(undefined)
|
||||
|
||||
React.useEffect(() => {
|
||||
let listener = {remove() {}}
|
||||
|
@ -66,13 +68,10 @@ function ShellInner() {
|
|||
}, [closeAnyActiveElement])
|
||||
|
||||
React.useEffect(() => {
|
||||
if (currentAccount) {
|
||||
// only runs when did changes
|
||||
if (currentAccount && currentAccountDid.current !== currentAccount.did) {
|
||||
currentAccountDid.current = currentAccount.did
|
||||
notifications.requestPermissionsAndRegisterToken(currentAccount)
|
||||
}
|
||||
}, [currentAccount])
|
||||
|
||||
React.useEffect(() => {
|
||||
if (currentAccount) {
|
||||
const unsub = notifications.registerTokenChangeHandler(currentAccount)
|
||||
return unsub
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue