From 9a77c9828647a1332d2f7823cfd8b3c71967735b Mon Sep 17 00:00:00 2001 From: First-Terraner Date: Wed, 13 Sep 2023 19:29:32 +0200 Subject: [PATCH] disable clipboard check in foreground on ios --- src/components/App.tsx | 4 ++-- src/context/FocusClaim.tsx | 8 ++++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/components/App.tsx b/src/components/App.tsx index 01b19dff..ddc3c795 100644 --- a/src/components/App.tsx +++ b/src/components/App.tsx @@ -175,11 +175,11 @@ function _App() { appState.current.match(/inactive|background/) && nextAppState === 'active' ) { - l('App has come to the foreground!') + l('[PIN] App has come to the foreground!') // check for pin attempts and app locked state await handlePinForeground() } else { - l('App has gone to the background!') + l('[PIN] App has gone to the background!') // store timestamp to activate auth after > 5mins in background await store.set(STORE_KEYS.bgCounter, `${Math.ceil(Date.now() / 1000)}`) } diff --git a/src/context/FocusClaim.tsx b/src/context/FocusClaim.tsx index 6dbc853a..ae4a9e5e 100644 --- a/src/context/FocusClaim.tsx +++ b/src/context/FocusClaim.tsx @@ -1,4 +1,5 @@ import { getEncodedToken } from '@cashu/cashu-ts' +import { isIOS } from '@consts' import { getMintsUrls } from '@db' import { l } from '@log' import type { ITokenInfo } from '@model' @@ -105,24 +106,27 @@ const useFocusClaim = () => { } useEffect(() => { + // disable foreground claim on iOS + if (isIOS) { return } // eslint-disable-next-line @typescript-eslint/no-misused-promises const subscription = AppState.addEventListener('change', async nextAppState => { if ( appState.current.match(/inactive|background/) && nextAppState === 'active' ) { - l('App has come to the foreground!') + l('[Claim token] App has come to the foreground!') setClaimed(false) // check for clipboard valid cashu token when the app comes to the foregorund await handleForeground() } else { - l('App has gone to the background!') + l('[Claim token] App has gone to the background!') } appState.current = nextAppState }) return () => subscription.remove() // eslint-disable-next-line react-hooks/exhaustive-deps }, []) + return { claimed, setClaimed,