From f1f0626841454e3b04a351672e6e607c319c0829 Mon Sep 17 00:00:00 2001 From: dominhquang Date: Mon, 18 Dec 2023 10:46:29 +0700 Subject: [PATCH] [issue-1193] Improve default enable config Show zero balance --- src/App.tsx | 8 ++++++++ src/hooks/useAppLock.ts | 2 ++ 2 files changed, 10 insertions(+) diff --git a/src/App.tsx b/src/App.tsx index 9ab3c9fb3..c7449d675 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -35,6 +35,8 @@ import { Warning } from 'phosphor-react-native'; import { Images } from 'assets/index'; import Text from 'components/Text'; import i18n from 'utils/i18n/i18n'; +import { mmkvStore } from 'utils/storage'; +import { updateShowZeroBalanceState } from 'stores/utils'; const layerScreenStyle: StyleProp = { top: 0, @@ -158,6 +160,7 @@ export const App = () => { const { checkIsShowBuyToken } = useShowBuyToken(); const { getDAppsData } = useGetDAppList(); const [needUpdateChrome, setNeedUpdateChrome] = useState(false); + const isEnableShowZeroBalanceFirstTime = mmkvStore.getBoolean('isEnableShowZeroBalanceFirstTime'); // Enable lock screen on the start app useEffect(() => { @@ -200,6 +203,11 @@ export const App = () => { DeviceEventEmitter.addListener(NEED_UPDATE_CHROME, (data: boolean) => { setNeedUpdateChrome(data); }); + + if (!isEnableShowZeroBalanceFirstTime) { + updateShowZeroBalanceState(true); + mmkvStore.set('isEnableShowZeroBalanceFirstTime', true); + } // if (buildNumber === 1) { // Set default value on the first time install // const buildNumberInt = parseInt(getBuildNumber(), 10); diff --git a/src/hooks/useAppLock.ts b/src/hooks/useAppLock.ts index 9afeb88f5..75d58a771 100644 --- a/src/hooks/useAppLock.ts +++ b/src/hooks/useAppLock.ts @@ -5,6 +5,7 @@ import { updateLockState } from 'stores/AppState'; import { resetBrowserSetting } from 'stores/Browser'; import { updateAutoLockTime, updateUseBiometric } from 'stores/MobileSettings'; import { LockTimeout } from 'stores/types'; +import { updateShowZeroBalanceState } from 'stores/utils'; export interface UseAppLockOptions { isLocked: boolean; @@ -37,6 +38,7 @@ export default function useAppLock(): UseAppLockOptions { dispatch(resetBrowserSetting()); dispatch(updateUseBiometric(false)); dispatch(updateAutoLockTime(LockTimeout._15MINUTE)); + updateShowZeroBalanceState(true); }, [dispatch]); return { isLocked, unlock, lock, resetPinCode, unlockApp };