diff --git a/apps/mobile/src/components/RecoveryKeyDialog/index.js b/apps/mobile/src/components/RecoveryKeyDialog/index.js index 24911cb3c..2eec87479 100644 --- a/apps/mobile/src/components/RecoveryKeyDialog/index.js +++ b/apps/mobile/src/components/RecoveryKeyDialog/index.js @@ -1,25 +1,26 @@ -import React, { createRef } from 'react'; -import { Clipboard, View } from 'react-native'; +import React, {createRef} from 'react'; +import {Clipboard, View} from 'react-native'; import QRCode from 'react-native-qrcode-svg'; import Icon from 'react-native-vector-icons/MaterialCommunityIcons'; import RNFetchBlob from 'rn-fetch-blob'; -import { LOGO_BASE64 } from '../../assets/images/assets'; +import {LOGO_BASE64} from '../../assets/images/assets'; import { eSendEvent, eSubscribeEvent, eUnSubscribeEvent, - ToastEvent + ToastEvent, } from '../../services/EventManager'; -import { dWidth } from '../../utils'; -import { db } from '../../utils/DB'; -import { eOpenRecoveryKeyDialog, eOpenResultDialog } from '../../utils/Events'; -import { SIZE } from '../../utils/SizeUtils'; +import {dWidth} from '../../utils'; +import {db} from '../../utils/DB'; +import {eOpenRecoveryKeyDialog, eOpenResultDialog} from '../../utils/Events'; +import {SIZE} from '../../utils/SizeUtils'; import Storage from '../../utils/storage'; -import { sleep } from '../../utils/TimeUtils'; +import {sleep} from '../../utils/TimeUtils'; import ActionSheetWrapper from '../ActionSheetComponent/ActionSheetWrapper'; -import { Button } from '../Button'; +import {Button} from '../Button'; +import DialogHeader from '../Dialog/dialog-header'; import Seperator from '../Seperator'; -import { Toast } from '../Toast'; +import {Toast} from '../Toast'; import Heading from '../Typography/Heading'; import Paragraph from '../Typography/Paragraph'; class RecoveryKeyDialog extends React.Component { @@ -33,6 +34,7 @@ class RecoveryKeyDialog extends React.Component { this.svg = createRef(); this.user; this.signup = false; + this.tapCount = 0; } open = (signup) => { @@ -50,6 +52,12 @@ class RecoveryKeyDialog extends React.Component { }; close = () => { + if (this.tapCount === 0) { + ToastEvent.show('Tap one more time to confirm.', 'error', 'local'); + this.tapCount++; + return; + } + this.tapCount = 0; this.actionSheetRef.current?.setModalVisible(false); sleep(200).then(() => { this.setState({ @@ -83,6 +91,7 @@ class RecoveryKeyDialog extends React.Component { this.svg.current?.toDataURL(async (data) => { let path = await Storage.checkAndCreateDir('/'); + let fileName = 'nn_' + this.user.email + '_recovery_key_qrcode.png'; RNFetchBlob.fs.writeFile(path + fileName, data, 'base64').then((res) => { RNFetchBlob.fs @@ -145,23 +154,18 @@ class RecoveryKeyDialog extends React.Component { fwdRef={this.actionSheetRef}> - - Recovery Key - + {this.state.key} + +