-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Duplicate account name warning when update version
- Loading branch information
1 parent
e0f577a
commit 786ba8c
Showing
7 changed files
with
137 additions
and
19 deletions.
There are no files selected for viewing
66 changes: 66 additions & 0 deletions
66
src/components/Modal/RemindDuplicateAccountNameModal/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
import React, { useCallback } from 'react'; | ||
import { Button, PageIcon, SwModal, Typography } from 'components/design-system-ui'; | ||
import { Linking, View } from 'react-native'; | ||
import { useSubWalletTheme } from 'hooks/useSubWalletTheme'; | ||
import { Warning } from 'phosphor-react-native'; | ||
import { FontMedium } from 'styles/sharedStyles'; | ||
import { BACKUP_SEED_PHRASE_CODE_URL } from 'constants/index'; | ||
import i18n from 'utils/i18n/i18n'; | ||
import { UPGRADE_DUPLICATE_ACCOUNT_NAME } from '@subwallet/extension-base/constants'; | ||
import { noop } from 'utils/function'; | ||
import { setValueLocalStorageWS } from 'messaging/database'; | ||
interface Props { | ||
modalVisible: boolean; | ||
setVisible: (value: boolean) => void; | ||
} | ||
|
||
export const RemindDuplicateAccountNameModal = ({ modalVisible, setVisible }: Props) => { | ||
const theme = useSubWalletTheme().swThemes; | ||
|
||
const onCancel = useCallback(() => { | ||
setVisible(false); | ||
setValueLocalStorageWS({ key: UPGRADE_DUPLICATE_ACCOUNT_NAME, value: 'false' }).catch(noop); | ||
}, [setVisible]); | ||
|
||
return ( | ||
<SwModal | ||
isUseModalV2 | ||
modalVisible={modalVisible} | ||
setVisible={setVisible} | ||
disabledOnPressBackDrop={true} | ||
isAllowSwipeDown={false} | ||
titleTextAlign={'center'} | ||
hideWhenCloseApp={false} | ||
modalTitle={'Duplicate account name'}> | ||
<View style={{ position: 'relative' }}> | ||
<View style={{ alignItems: 'center' }}> | ||
<PageIcon icon={Warning} color={theme['colorWarning-5']} /> | ||
|
||
<Typography.Text | ||
style={{ | ||
fontSize: theme.fontSizeHeading6, | ||
lineHeight: theme.fontSizeHeading6 * theme.lineHeightHeading6, | ||
color: theme.colorTextLight4, | ||
textAlign: 'center', | ||
...FontMedium, | ||
marginTop: theme.paddingMD, | ||
}}> | ||
<Typography.Text> | ||
{ | ||
'You have accounts with the same name. We have added characters to these account names to differentiate them. You can change account names later using ' | ||
} | ||
</Typography.Text> | ||
<Typography.Text | ||
onPress={() => Linking.openURL(BACKUP_SEED_PHRASE_CODE_URL)} | ||
style={{ color: theme.colorLink, textDecorationLine: 'underline' }}> | ||
{'this guide'} | ||
</Typography.Text> | ||
</Typography.Text> | ||
</View> | ||
<Button style={{ marginTop: theme.margin }} onPress={onCancel}> | ||
{i18n.buttonTitles.iUnderstand} | ||
</Button> | ||
</View> | ||
</SwModal> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { sendMessage } from '..'; | ||
import { StorageDataInterface } from '@subwallet/extension-base/types'; | ||
|
||
export async function exportIndexedDB(): Promise<string> { | ||
return sendMessage('pri(database.export)', null); | ||
} | ||
|
||
export async function importIndexedDB(request: string): Promise<boolean> { | ||
return sendMessage('pri(database.import)', request); | ||
} | ||
|
||
export async function getIndexedDBJson(): Promise<object> { | ||
return sendMessage('pri(database.exportJson)', null); | ||
} | ||
|
||
export async function migrateLocalStorage(request: string): Promise<boolean> { | ||
return sendMessage('pri(database.migrateLocalStorage)', request); | ||
} | ||
|
||
export async function setValueLocalStorageWS(request: StorageDataInterface): Promise<boolean> { | ||
return sendMessage('pri(database.setLocalStorage)', request); | ||
} | ||
|
||
export async function getValueLocalStorageWS(request: string): Promise<string | null> { | ||
return sendMessage('pri(database.getLocalStorage)', request); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters