From 5cc54f282e8ce93bbb2b6698df52c3f72eb1def8 Mon Sep 17 00:00:00 2001 From: Overtorment Date: Mon, 7 Dec 2020 16:35:28 +0000 Subject: [PATCH 1/5] FIX: animation on ms creation screen --- screen/wallets/addMultisigStep2.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/screen/wallets/addMultisigStep2.js b/screen/wallets/addMultisigStep2.js index 9db144c1d..572b1f8c2 100644 --- a/screen/wallets/addMultisigStep2.js +++ b/screen/wallets/addMultisigStep2.js @@ -131,8 +131,12 @@ const WalletsAddMultisigStep2 = () => { }, }); - const onCreate = async () => { + const onCreate = () => { setIsLoading(true); + setTimeout(_onCreate, 100); + }; + + const _onCreate = async () => { const w = new MultisigHDWallet(); w.setM(m); switch (format) { From 57ec7c981398999203a0fa105fb35d230af237bd Mon Sep 17 00:00:00 2001 From: Overtorment Date: Mon, 7 Dec 2020 18:05:35 +0000 Subject: [PATCH 2/5] ADD: is it my address check on wallet details screen (closes #829) --- Navigation.js | 2 + loc/en.json | 6 ++ screen/send/isItMyAddress.js | 149 +++++++++++++++++++++++++++++++++++ screen/wallets/details.js | 8 ++ 4 files changed, 165 insertions(+) create mode 100644 screen/send/isItMyAddress.js diff --git a/Navigation.js b/Navigation.js index 0cdd61db4..acc767ce1 100644 --- a/Navigation.js +++ b/Navigation.js @@ -60,6 +60,7 @@ import PsbtWithHardwareWallet from './screen/send/psbtWithHardwareWallet'; import PsbtMultisig from './screen/send/psbtMultisig'; import Success from './screen/send/success'; import Broadcast from './screen/send/broadcast'; +import IsItMyAddress from './screen/send/isItMyAddress'; import CoinControl from './screen/send/coinControl'; import ScanLndInvoice from './screen/lnd/scanLndInvoice'; @@ -148,6 +149,7 @@ const WalletsRoot = () => ( /> + { + /** @type {AbstractWallet[]} */ + const wallets = useContext(BlueStorageContext).wallets; + const navigation = useNavigation(); + const route = useRoute(); + + const [address, setAddress] = useState(''); + const [result, setResult] = useState(''); + + const handleUpdateAddress = nextValue => setAddress(nextValue.trim()); + + const checkAddress = async () => { + const cleanAddress = address.replace('bitcoin:', '').replace('BITCOIN:', '').replace('bitcoin=', '').split('?')[0]; + const _result = []; + for (const w of wallets) { + if (w.weOwnAddress(cleanAddress)) { + _result.push(loc.formatString(loc.is_it_my_address.owns, { label: w.getLabel(), address: cleanAddress })); + } + } + + setResult(_result.join('\n\n')); + }; + + const onBarScanned = async value => { + setAddress(value); + }; + + const importScan = async () => { + navigation.navigate('ScanQRCodeRoot', { + screen: 'ScanQRCode', + params: { + launchedBy: route.name, + onBarScanned: onBarScanned, + showFileImportButton: true, + }, + }); + }; + + return ( + + + + + + {loc.is_it_my_address.enter_address} + + + + + + + + + {result} + + + + + ); +}; + +export default IsItMyAddress; +IsItMyAddress.navigationOptions = () => ({ + ...BlueNavigationStyle(), + title: loc.is_it_my_address.title, +}); + +const styles = StyleSheet.create({ + wrapper: { + marginTop: 16, + alignItems: 'center', + justifyContent: 'flex-start', + }, + blueArea: { + flex: 1, + paddingTop: 19, + }, + broadcastResultWrapper: { + flex: 1, + flexDirection: 'column', + justifyContent: 'center', + alignItems: 'center', + height: '100%', + width: '100%', + }, + link: { + color: BlueCurrentTheme.colors.foregroundColor, + }, + mainCard: { + padding: 0, + display: 'flex', + flexDirection: 'column', + alignItems: 'center', + justifyContent: 'flex-start', + }, + topFormRow: { + flex: 0.1, + flexBasis: 0.1, + flexDirection: 'row', + alignItems: 'center', + justifyContent: 'space-between', + paddingBottom: 10, + paddingTop: 0, + paddingRight: 100, + height: 30, + maxHeight: 30, + }, + text: { + flex: 1, + borderColor: '#ebebeb', + backgroundColor: '#d2f8d6', + borderRadius: 4, + marginTop: 20, + color: BlueCurrentTheme.colors.foregroundColor, + fontWeight: '500', + fontSize: 14, + paddingHorizontal: 16, + paddingBottom: 16, + paddingTop: 16, + }, +}); diff --git a/screen/wallets/details.js b/screen/wallets/details.js index 8afa1392f..871b9d4b4 100644 --- a/screen/wallets/details.js +++ b/screen/wallets/details.js @@ -324,6 +324,10 @@ const WalletDetails = () => { navigate('Broadcast'); }; + const navigateToIsItMyAddress = () => { + navigate('IsItMyAddress'); + }; + const walletNameTextInputOnBlur = () => { if (walletName.trim().length === 0) { const walletLabel = wallet.getLabel(); @@ -512,6 +516,10 @@ const WalletDetails = () => { )} + <> + + + From 5efc58d9e59d8bdca5ce31145f3132dfdb492be6 Mon Sep 17 00:00:00 2001 From: Overtorment Date: Mon, 7 Dec 2020 18:05:35 +0000 Subject: [PATCH 3/5] ADD: is it my address check on wallet details screen (closes #829) --- Navigation.js | 2 + loc/en.json | 6 ++ screen/send/isItMyAddress.js | 149 +++++++++++++++++++++++++++++++++++ screen/wallets/details.js | 8 ++ 4 files changed, 165 insertions(+) create mode 100644 screen/send/isItMyAddress.js diff --git a/Navigation.js b/Navigation.js index 0cdd61db4..acc767ce1 100644 --- a/Navigation.js +++ b/Navigation.js @@ -60,6 +60,7 @@ import PsbtWithHardwareWallet from './screen/send/psbtWithHardwareWallet'; import PsbtMultisig from './screen/send/psbtMultisig'; import Success from './screen/send/success'; import Broadcast from './screen/send/broadcast'; +import IsItMyAddress from './screen/send/isItMyAddress'; import CoinControl from './screen/send/coinControl'; import ScanLndInvoice from './screen/lnd/scanLndInvoice'; @@ -148,6 +149,7 @@ const WalletsRoot = () => ( /> + { + /** @type {AbstractWallet[]} */ + const wallets = useContext(BlueStorageContext).wallets; + const navigation = useNavigation(); + const route = useRoute(); + + const [address, setAddress] = useState(''); + const [result, setResult] = useState(''); + + const handleUpdateAddress = nextValue => setAddress(nextValue.trim()); + + const checkAddress = async () => { + const cleanAddress = address.replace('bitcoin:', '').replace('BITCOIN:', '').replace('bitcoin=', '').split('?')[0]; + const _result = []; + for (const w of wallets) { + if (w.weOwnAddress(cleanAddress)) { + _result.push(loc.formatString(loc.is_it_my_address.owns, { label: w.getLabel(), address: cleanAddress })); + } + } + + setResult(_result.join('\n\n')); + }; + + const onBarScanned = async value => { + setAddress(value); + }; + + const importScan = async () => { + navigation.navigate('ScanQRCodeRoot', { + screen: 'ScanQRCode', + params: { + launchedBy: route.name, + onBarScanned: onBarScanned, + showFileImportButton: true, + }, + }); + }; + + return ( + + + + + + {loc.is_it_my_address.enter_address} + + + + + + + + + {result} + + + + + ); +}; + +export default IsItMyAddress; +IsItMyAddress.navigationOptions = () => ({ + ...BlueNavigationStyle(), + title: loc.is_it_my_address.title, +}); + +const styles = StyleSheet.create({ + wrapper: { + marginTop: 16, + alignItems: 'center', + justifyContent: 'flex-start', + }, + blueArea: { + flex: 1, + paddingTop: 19, + }, + broadcastResultWrapper: { + flex: 1, + flexDirection: 'column', + justifyContent: 'center', + alignItems: 'center', + height: '100%', + width: '100%', + }, + link: { + color: BlueCurrentTheme.colors.foregroundColor, + }, + mainCard: { + padding: 0, + display: 'flex', + flexDirection: 'column', + alignItems: 'center', + justifyContent: 'flex-start', + }, + topFormRow: { + flex: 0.1, + flexBasis: 0.1, + flexDirection: 'row', + alignItems: 'center', + justifyContent: 'space-between', + paddingBottom: 10, + paddingTop: 0, + paddingRight: 100, + height: 30, + maxHeight: 30, + }, + text: { + flex: 1, + borderColor: '#ebebeb', + backgroundColor: '#d2f8d6', + borderRadius: 4, + marginTop: 20, + color: BlueCurrentTheme.colors.foregroundColor, + fontWeight: '500', + fontSize: 14, + paddingHorizontal: 16, + paddingBottom: 16, + paddingTop: 16, + }, +}); diff --git a/screen/wallets/details.js b/screen/wallets/details.js index 8afa1392f..2945b868f 100644 --- a/screen/wallets/details.js +++ b/screen/wallets/details.js @@ -324,6 +324,10 @@ const WalletDetails = () => { navigate('Broadcast'); }; + const navigateToIsItMyAddress = () => { + navigate('IsItMyAddress'); + }; + const walletNameTextInputOnBlur = () => { if (walletName.trim().length === 0) { const walletLabel = wallet.getLabel(); @@ -512,6 +516,10 @@ const WalletDetails = () => { )} + <> + + + From 6899d78ea0cd632b1961b4e675b20fbdf928613f Mon Sep 17 00:00:00 2001 From: marcosrdz Date: Mon, 7 Dec 2020 13:24:24 -0500 Subject: [PATCH 4/5] Update isItMyAddress.js --- screen/send/isItMyAddress.js | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/screen/send/isItMyAddress.js b/screen/send/isItMyAddress.js index 3555955f9..3be7a092c 100644 --- a/screen/send/isItMyAddress.js +++ b/screen/send/isItMyAddress.js @@ -14,17 +14,27 @@ import { } from '../../BlueComponents'; import { BlueCurrentTheme } from '../../components/themes'; import { BlueStorageContext } from '../../blue_modules/storage-context'; -import { useNavigation, useRoute } from '@react-navigation/native'; +import { useNavigation, useRoute, useTheme } from '@react-navigation/native'; const IsItMyAddress = () => { /** @type {AbstractWallet[]} */ const wallets = useContext(BlueStorageContext).wallets; - const navigation = useNavigation(); - const route = useRoute(); + const { navigate } = useNavigation(); + const { name } = useRoute(); + const { colors } = useTheme(); const [address, setAddress] = useState(''); const [result, setResult] = useState(''); + const stylesHooks = StyleSheet.create({ + blueArea: { + backgroundColor: colors.background, + }, + text: { + color: colors.foregroundColor, + }, + }); + const handleUpdateAddress = nextValue => setAddress(nextValue.trim()); const checkAddress = async () => { @@ -44,18 +54,18 @@ const IsItMyAddress = () => { }; const importScan = async () => { - navigation.navigate('ScanQRCodeRoot', { + navigate('ScanQRCodeRoot', { screen: 'ScanQRCode', params: { - launchedBy: route.name, - onBarScanned: onBarScanned, + launchedBy: name, + onBarScanned, showFileImportButton: true, }, }); }; return ( - + @@ -63,7 +73,7 @@ const IsItMyAddress = () => { {loc.is_it_my_address.enter_address} Date: Mon, 7 Dec 2020 13:55:50 -0500 Subject: [PATCH 5/5] Update isItMyAddress.js --- screen/send/isItMyAddress.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/screen/send/isItMyAddress.js b/screen/send/isItMyAddress.js index 3be7a092c..4cefb44b6 100644 --- a/screen/send/isItMyAddress.js +++ b/screen/send/isItMyAddress.js @@ -37,7 +37,7 @@ const IsItMyAddress = () => { const handleUpdateAddress = nextValue => setAddress(nextValue.trim()); - const checkAddress = async () => { + const checkAddress = () => { const cleanAddress = address.replace('bitcoin:', '').replace('BITCOIN:', '').replace('bitcoin=', '').split('?')[0]; const _result = []; for (const w of wallets) { @@ -49,11 +49,11 @@ const IsItMyAddress = () => { setResult(_result.join('\n\n')); }; - const onBarScanned = async value => { + const onBarScanned = value => { setAddress(value); }; - const importScan = async () => { + const importScan = () => { navigate('ScanQRCodeRoot', { screen: 'ScanQRCode', params: {