Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[issue-1193] Improve default enable config Show zero balance #1257

Open
wants to merge 1 commit into
base: upgrade-ui
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading