Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3447890
D14090.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D14090.diff
View Options
diff --git a/native/account/restore-prompt-screen.react.js b/native/account/restore-prompt-screen.react.js
--- a/native/account/restore-prompt-screen.react.js
+++ b/native/account/restore-prompt-screen.react.js
@@ -3,6 +3,8 @@
import * as React from 'react';
import { Text, View } from 'react-native';
+import { getMessageForException } from 'lib/utils/errors.js';
+
import PromptButton from './prompt-button.react.js';
import RegistrationButtonContainer from './registration/registration-button-container.react.js';
import RegistrationContainer from './registration/registration-container.react.js';
@@ -10,8 +12,12 @@
import type { SignInNavigationProp } from './sign-in-navigator.react';
import { useSIWEPanelState } from './siwe-hooks.js';
import SIWEPanel from './siwe-panel.react.js';
+import { useClientBackup } from '../backup/use-client-backup.js';
import type { NavigationRoute } from '../navigation/route-names';
-import { RestorePasswordAccountScreenRouteName } from '../navigation/route-names.js';
+import {
+ RestoreSIWEBackupRouteName,
+ RestorePasswordAccountScreenRouteName,
+} from '../navigation/route-names.js';
import { useColors, useStyles } from '../themes/colors.js';
import RestoreIcon from '../vectors/restore-icon.react.js';
@@ -31,6 +37,36 @@
props.navigation.navigate(RestorePasswordAccountScreenRouteName);
}, [props.navigation]);
+ const { retrieveLatestBackupInfo } = useClientBackup();
+ const onSIWESuccess = React.useCallback(async () => {
+ try {
+ const backupInfo = await retrieveLatestBackupInfo();
+ const { siweBackupData, backupID } = backupInfo;
+
+ if (!siweBackupData) {
+ throw new Error('Missing SIWE message for Wallet user backup');
+ }
+
+ const {
+ siweBackupMsgNonce,
+ siweBackupMsgIssuedAt,
+ siweBackupMsgStatement,
+ } = siweBackupData;
+
+ props.navigation.navigate<'RestoreSIWEBackup'>({
+ name: RestoreSIWEBackupRouteName,
+ params: {
+ backupID,
+ siweNonce: siweBackupMsgNonce,
+ siweStatement: siweBackupMsgStatement,
+ siweIssuedAt: siweBackupMsgIssuedAt,
+ },
+ });
+ } catch (e) {
+ console.log(`Backup restore error: ${String(getMessageForException(e))}`);
+ }
+ }, [props.navigation, retrieveLatestBackupInfo]);
+
const {
panelState,
openPanel,
@@ -45,7 +81,7 @@
onClosing={onPanelClosing}
onClosed={onPanelClosed}
closing={panelState === 'closing'}
- onSuccessfulWalletSignature={() => {}}
+ onSuccessfulWalletSignature={onSIWESuccess}
siweSignatureRequestData={siweSignatureRequestData}
setLoading={siwePanelSetLoading}
/>
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Dec 12, 6:37 PM (21 h, 7 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2646255
Default Alt Text
D14090.diff (2 KB)
Attached To
Mode
D14090: [native] Navigate to a SIWE backup screen
Attached
Detach File
Event Timeline
Log In to Comment