Add app state change listener to manage focus state with React Query

This commit is contained in:
Mo Tarbin
2026-03-08 23:21:20 -04:00
parent 4fa0f5ffeb
commit 4e352e1430

View File

@@ -5,6 +5,7 @@ import { Device } from '@capacitor/device'
import { LocalNotifications } from '@capacitor/local-notifications'
import { Preferences } from '@capacitor/preferences'
import { PushNotifications } from '@capacitor/push-notifications'
import { focusManager } from '@tanstack/react-query'
import { RegisterDeviceToken } from './utils/Fetcher'
// OAuth callback handler for deep links
@@ -225,6 +226,10 @@ const registerCapacitorListeners = () => {
}
})
mobileApp.addListener('appStateChange', ({ isActive }) => {
focusManager.setFocused(isActive)
})
mobileApp.addListener('backButton', ({ canGoBack }) => {
if (canGoBack) {
window.history.back()