From 9db39b4f2ab6c0672e82bcb578508075a6726f31 Mon Sep 17 00:00:00 2001 From: marcosrdz Date: Fri, 8 Jan 2021 13:10:14 -0500 Subject: [PATCH] FIX: Add wallet->set custom label->create multisig: label is not set to created wallet --- loc/en.json | 1 + screen/settings/encryptStorage.js | 10 +--------- screen/wallets/add.js | 2 +- screen/wallets/addMultisig.js | 6 +++--- screen/wallets/addMultisigStep2.js | 4 ++-- 5 files changed, 8 insertions(+), 15 deletions(-) diff --git a/loc/en.json b/loc/en.json index f4fa38941..1109cb274 100644 --- a/loc/en.json +++ b/loc/en.json @@ -449,6 +449,7 @@ }, "multisig": { "multisig_vault": "Vault", + "default_label": "Multisig Vault", "multisig_vault_explain": "Best security for large amounts", "provide_signature": "Provide signature", "vault_key": "Vault key {number}", diff --git a/screen/settings/encryptStorage.js b/screen/settings/encryptStorage.js index 206d02957..ae0c1f8c8 100644 --- a/screen/settings/encryptStorage.js +++ b/screen/settings/encryptStorage.js @@ -6,15 +6,7 @@ import ReactNativeHapticFeedback from 'react-native-haptic-feedback'; import { colors } from 'react-native-elements'; import navigationStyle from '../../components/navigationStyle'; -import { - BlueLoading, - SafeBlueArea, - BlueSpacing20, - BlueCard, - BlueListItem, - BlueHeaderDefaultSub, - BlueText, -} from '../../BlueComponents'; +import { BlueLoading, SafeBlueArea, BlueSpacing20, BlueCard, BlueListItem, BlueHeaderDefaultSub, BlueText } from '../../BlueComponents'; import Biometric from '../../class/biometrics'; import loc from '../../loc'; import { BlueStorageContext } from '../../blue_modules/storage-context'; diff --git a/screen/wallets/add.js b/screen/wallets/add.js index 94372bfc1..2fccc5478 100644 --- a/screen/wallets/add.js +++ b/screen/wallets/add.js @@ -152,7 +152,7 @@ const WalletsAdd = () => { } } else if (selectedWalletType === ButtonSelected.VAULT) { setIsLoading(false); - navigate('WalletsAddMultisig'); + navigate('WalletsAddMultisig', { walletLabel: label.trim().length > 1 ? label : loc.multisig.default_label }); } }; diff --git a/screen/wallets/addMultisig.js b/screen/wallets/addMultisig.js index d69a763ab..425e88c28 100644 --- a/screen/wallets/addMultisig.js +++ b/screen/wallets/addMultisig.js @@ -2,7 +2,7 @@ import React, { useState, useRef, useEffect, useContext } from 'react'; import { Keyboard, KeyboardAvoidingView, Platform, StatusBar, StyleSheet, Text, TouchableOpacity, View } from 'react-native'; import LottieView from 'lottie-react-native'; import { Icon } from 'react-native-elements'; -import { useNavigation, useTheme } from '@react-navigation/native'; +import { useNavigation, useRoute, useTheme } from '@react-navigation/native'; import { SafeAreaView } from 'react-native-safe-area-context'; import { BlueButton, BlueListItem, BlueSpacing20 } from '../../BlueComponents'; @@ -16,7 +16,7 @@ const WalletsAddMultisig = () => { const { colors } = useTheme(); const { navigate } = useNavigation(); const loadingAnimation = useRef(); - + const { walletLabel = loc.multisig.default_label } = useRoute().params; const [m, setM] = useState(2); const [n, setN] = useState(3); const [isModalVisible, setIsModalVisible] = useState(false); @@ -60,7 +60,7 @@ const WalletsAddMultisig = () => { }, []); const onLetsStartPress = () => { - navigate('WalletsAddMultisigStep2', { m, n, format }); + navigate('WalletsAddMultisigStep2', { m, n, format, walletLabel }); }; const setFormatP2wsh = () => setFormat(MultisigHDWallet.FORMAT_P2WSH); diff --git a/screen/wallets/addMultisigStep2.js b/screen/wallets/addMultisigStep2.js index 1bceca6bb..2d844f7d1 100644 --- a/screen/wallets/addMultisigStep2.js +++ b/screen/wallets/addMultisigStep2.js @@ -54,7 +54,7 @@ const WalletsAddMultisigStep2 = () => { const { colors } = useTheme(); const navigation = useNavigation(); - const { m, n, format } = useRoute().params; + const { m, n, format, walletLabel } = useRoute().params; const [cosigners, setCosigners] = useState([]); // array of cosigners user provided. if format [cosigner, fp, path] const [isLoading, setIsLoading] = useState(false); @@ -166,7 +166,7 @@ const WalletsAddMultisigStep2 = () => { const fp = cc[1] || getFpCacheForMnemonics(cc[0]); w.addCosigner(cc[0], fp, cc[2]); } - w.setLabel('Multisig Vault'); + w.setLabel(walletLabel); await w.fetchBalance(); addWallet(w);