forked from cerc-io/laconic-wallet
Add copy button for mnemonic after creating new wallet (#13)
Part of [laconicd testnet validator enrollment](https://www.notion.so/laconicd-testnet-validator-enrollment-6fc1d3cafcc64fef8c5ed3affa27c675) Co-authored-by: Shreerang Kale <shreerangkale@gmail.com> Co-authored-by: IshaVenikar <ishavenikar7@gmail.com> Reviewed-on: cerc-io/laconic-wallet#13
This commit is contained in:
parent
4827fa8c7c
commit
e975f4c9f7
@ -21,6 +21,7 @@
|
|||||||
"@hookform/resolvers": "^3.3.4",
|
"@hookform/resolvers": "^3.3.4",
|
||||||
"@json-rpc-tools/utils": "^1.7.6",
|
"@json-rpc-tools/utils": "^1.7.6",
|
||||||
"@react-native-async-storage/async-storage": "^1.22.3",
|
"@react-native-async-storage/async-storage": "^1.22.3",
|
||||||
|
"@react-native-clipboard/clipboard": "^1.14.1",
|
||||||
"@react-native-community/netinfo": "^11.3.1",
|
"@react-native-community/netinfo": "^11.3.1",
|
||||||
"@react-navigation/elements": "^1.3.30",
|
"@react-navigation/elements": "^1.3.30",
|
||||||
"@react-navigation/native": "^6.1.10",
|
"@react-navigation/native": "^6.1.10",
|
||||||
|
31
scripts/build-apk.sh
Executable file
31
scripts/build-apk.sh
Executable file
@ -0,0 +1,31 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Default value for IS_RELEASE
|
||||||
|
IS_RELEASE=${IS_RELEASE:-false}
|
||||||
|
|
||||||
|
# Install dependencies
|
||||||
|
echo "Installing dependencies..."
|
||||||
|
yarn
|
||||||
|
|
||||||
|
# Create the necessary directory for assets
|
||||||
|
mkdir -p android/app/src/main/assets/
|
||||||
|
|
||||||
|
# Bundle the React Native application
|
||||||
|
yarn react-native bundle \
|
||||||
|
--platform android \
|
||||||
|
--dev false \
|
||||||
|
--entry-file index.js \
|
||||||
|
--bundle-output android/app/src/main/assets/index.android.bundle \
|
||||||
|
--assets-dest android/app/src/main/res
|
||||||
|
|
||||||
|
# Navigate to the android directory
|
||||||
|
cd android
|
||||||
|
|
||||||
|
# Run the Gradle build based on the IS_RELEASE flag
|
||||||
|
if [ "$IS_RELEASE" = "true" ]; then
|
||||||
|
echo "Building release version..."
|
||||||
|
./gradlew assembleRelease
|
||||||
|
else
|
||||||
|
echo "Building debug version..."
|
||||||
|
./gradlew assembleDebug
|
||||||
|
fi
|
@ -1,6 +1,8 @@
|
|||||||
import React from 'react';
|
import React, { useState } from 'react';
|
||||||
import { View } from 'react-native';
|
import { View } from 'react-native';
|
||||||
import { Button, Dialog, Portal, Text } from 'react-native-paper';
|
import { Button, Dialog, Portal, Snackbar, Text } from 'react-native-paper';
|
||||||
|
|
||||||
|
import Clipboard from '@react-native-clipboard/clipboard';
|
||||||
|
|
||||||
import styles from '../styles/stylesheet';
|
import styles from '../styles/stylesheet';
|
||||||
import GridView from './Grid';
|
import GridView from './Grid';
|
||||||
@ -11,17 +13,25 @@ const DialogComponent = ({
|
|||||||
hideDialog,
|
hideDialog,
|
||||||
contentText,
|
contentText,
|
||||||
}: CustomDialogProps) => {
|
}: CustomDialogProps) => {
|
||||||
|
const [toastVisible, setToastVisible] = useState(false);
|
||||||
|
|
||||||
const words = contentText.split(' ');
|
const words = contentText.split(' ');
|
||||||
|
|
||||||
|
const handleCopy = () => {
|
||||||
|
Clipboard.setString(contentText);
|
||||||
|
setToastVisible(true);
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
<>
|
||||||
<Portal>
|
<Portal>
|
||||||
<Dialog visible={visible} onDismiss={hideDialog}>
|
<Dialog visible={visible} onDismiss={hideDialog}>
|
||||||
<Dialog.Content>
|
<Dialog.Content>
|
||||||
<Text variant="titleLarge">Mnemonic</Text>
|
<Text variant="titleLarge">Mnemonic</Text>
|
||||||
<View style={styles.dialogTitle}>
|
<View style={styles.dialogTitle}>
|
||||||
<Text variant="titleMedium">
|
<Text variant="titleMedium">
|
||||||
Your mnemonic provides full access to your wallet and funds. Make
|
Your mnemonic provides full access to your wallet and funds.
|
||||||
sure to note it down.{' '}
|
Make sure to note it down.{' '}
|
||||||
</Text>
|
</Text>
|
||||||
<Text variant="titleMedium" style={styles.dialogWarning}>
|
<Text variant="titleMedium" style={styles.dialogWarning}>
|
||||||
Do not share your mnemonic with anyone
|
Do not share your mnemonic with anyone
|
||||||
@ -30,10 +40,18 @@ const DialogComponent = ({
|
|||||||
</View>
|
</View>
|
||||||
</Dialog.Content>
|
</Dialog.Content>
|
||||||
<Dialog.Actions>
|
<Dialog.Actions>
|
||||||
|
<Button onPress={handleCopy}>Copy</Button>
|
||||||
<Button onPress={hideDialog}>Done</Button>
|
<Button onPress={hideDialog}>Done</Button>
|
||||||
</Dialog.Actions>
|
</Dialog.Actions>
|
||||||
</Dialog>
|
</Dialog>
|
||||||
</Portal>
|
</Portal>
|
||||||
|
<Snackbar
|
||||||
|
visible={toastVisible}
|
||||||
|
onDismiss={() => setToastVisible(false)}
|
||||||
|
duration={1000}>
|
||||||
|
Mnemonic copied to clipboard
|
||||||
|
</Snackbar>
|
||||||
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -2071,6 +2071,11 @@
|
|||||||
dependencies:
|
dependencies:
|
||||||
merge-options "^3.0.4"
|
merge-options "^3.0.4"
|
||||||
|
|
||||||
|
"@react-native-clipboard/clipboard@^1.14.1":
|
||||||
|
version "1.14.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/@react-native-clipboard/clipboard/-/clipboard-1.14.1.tgz#835f82fc86881a0808a8405f2576617bb5383554"
|
||||||
|
integrity sha512-SM3el0A28SwoeJljVNhF217o0nI4E7RfalLmuRQcT1/7tGcxUjgFa3jyrEndYUct8/uxxK5EUNGUu1YEDqzxqw==
|
||||||
|
|
||||||
"@react-native-community/cli-clean@12.3.2":
|
"@react-native-community/cli-clean@12.3.2":
|
||||||
version "12.3.2"
|
version "12.3.2"
|
||||||
resolved "https://registry.yarnpkg.com/@react-native-community/cli-clean/-/cli-clean-12.3.2.tgz#d4f1730c3d22d816b4d513d330d5f3896a3f5921"
|
resolved "https://registry.yarnpkg.com/@react-native-community/cli-clean/-/cli-clean-12.3.2.tgz#d4f1730c3d22d816b4d513d330d5f3896a3f5921"
|
||||||
|
Loading…
Reference in New Issue
Block a user