Skip to content

Commit

Permalink
[issue-1193] Improve default enable config Show zero balance
Browse files Browse the repository at this point in the history
  • Loading branch information
dominhquang committed Dec 26, 2023
1 parent 579e338 commit 405d00f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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<any> = {
top: 0,
Expand Down Expand Up @@ -158,6 +160,7 @@ export const App = () => {
const { checkIsShowBuyToken } = useShowBuyToken();
const { getDAppsData } = useGetDAppList();
const [needUpdateChrome, setNeedUpdateChrome] = useState<boolean>(false);
const isEnableShowZeroBalanceFirstTime = mmkvStore.getBoolean('isEnableShowZeroBalanceFirstTime');

// Enable lock screen on the start app
useEffect(() => {
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 2 additions & 0 deletions src/hooks/useAppLock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 };
Expand Down

0 comments on commit 405d00f

Please sign in to comment.