From 178b4cf277d83515220ec07e464d2ceb5066fe63 Mon Sep 17 00:00:00 2001 From: marcosrdz Date: Mon, 6 Apr 2020 11:33:45 -0400 Subject: [PATCH 1/6] ADD: Open clipboard modal if address is detected at launch --- App.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/App.js b/App.js index 7712b868..f80b99c4 100644 --- a/App.js +++ b/App.js @@ -40,6 +40,7 @@ export default class App extends React.Component { AppState.addEventListener('change', this._handleAppStateChange); QuickActions.popInitialAction().then(this.popInitialAction); DeviceEventEmitter.addListener('quickActionShortcut', this.walletQuickActions); + this._handleAppStateChange(undefined); } popInitialAction = async data => { @@ -107,7 +108,7 @@ export default class App extends React.Component { _handleAppStateChange = async nextAppState => { if (BlueApp.getWallets().length > 0) { - if (this.state.appState.match(/background/) && nextAppState === 'active') { + if ((this.state.appState.match(/background/) && nextAppState) === 'active' || nextAppState === undefined) { setTimeout(() => A(A.ENUM.APP_UNSUSPENDED), 2000); const clipboard = await Clipboard.getString(); const isAddressFromStoredWallet = BlueApp.getWallets().some(wallet => { @@ -138,7 +139,9 @@ export default class App extends React.Component { } this.setState({ clipboardContent: clipboard }); } - this.setState({ appState: nextAppState }); + if (nextAppState) { + this.setState({ appState: nextAppState }); + } } }; From 55825a9d08845ca854d71bda9b4cf5653c7c2b0b Mon Sep 17 00:00:00 2001 From: ncoelho Date: Sat, 4 Apr 2020 19:14:17 +0200 Subject: [PATCH 2/6] allow copy to clipboard on watch-only wallets --- screen/wallets/export.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/screen/wallets/export.js b/screen/wallets/export.js index ebf49881..f052061b 100644 --- a/screen/wallets/export.js +++ b/screen/wallets/export.js @@ -5,7 +5,7 @@ import { BlueSpacing20, SafeBlueArea, BlueNavigationStyle, BlueText, BlueCopyTex import PropTypes from 'prop-types'; import Privacy from '../../Privacy'; import Biometric from '../../class/biometrics'; -import { LegacyWallet, LightningCustodianWallet, SegwitBech32Wallet, SegwitP2SHWallet } from '../../class'; +import { LegacyWallet, LightningCustodianWallet, SegwitBech32Wallet, SegwitP2SHWallet, WatchOnlyWallet } from '../../class'; /** @type {AppStorage} */ let BlueApp = require('../../BlueApp'); let loc = require('../../loc'); @@ -96,7 +96,7 @@ export default class WalletExport extends Component { /> - {this.state.wallet.type === LightningCustodianWallet.type ? ( + {this.state.wallet.type === LightningCustodianWallet.type || this.state.wallet.type === WatchOnlyWallet.type ? ( ) : ( From 35a1bd5390aee179ffb604a979735b59c146f744 Mon Sep 17 00:00:00 2001 From: ncoelho Date: Sat, 4 Apr 2020 18:29:42 +0200 Subject: [PATCH 3/6] fix fix aligment on new Settings and promote Electrum --- screen/settings/GeneralSettings.js | 65 +++++++++++++----------------- screen/settings/NetworkSettings.js | 2 +- 2 files changed, 29 insertions(+), 38 deletions(-) diff --git a/screen/settings/GeneralSettings.js b/screen/settings/GeneralSettings.js index 046ca14c..a587c391 100644 --- a/screen/settings/GeneralSettings.js +++ b/screen/settings/GeneralSettings.js @@ -36,45 +36,36 @@ const GeneralSettings = () => { ) : ( + {BlueApp.getWallets().length > 1 && ( + <> + navigate('DefaultView')} title="On Launch" /> + + )} + {Platform.OS === 'ios' ? ( + <> + + + + When enabled, you will be able to view selected wallets, and transactions, using your other Apple iCloud connected devices. + + + + + ) : null} + - {BlueApp.getWallets().length > 1 && ( - <> - navigate('DefaultView')} title="On Launch" /> - - )} - {Platform.OS === 'ios' ? ( - <> - - - - When enabled, you will be able to view selected wallets, and transactions, using your other Apple iCloud connected - devices. - - - - - ) : null} - - - - When enabled, you will see advanced options such as different wallet types and the ability to specify the LNDHub instance you - wish to connect to. - - - + + When enabled, you will see advanced options such as different wallet types and the ability to specify the LNDHub instance you + wish to connect to. + + ); diff --git a/screen/settings/NetworkSettings.js b/screen/settings/NetworkSettings.js index af2b0056..2ece6840 100644 --- a/screen/settings/NetworkSettings.js +++ b/screen/settings/NetworkSettings.js @@ -17,8 +17,8 @@ const NetworkSettings = () => { ) : ( - navigate('LightningSettings')} /> navigate('ElectrumSettings')} /> + navigate('LightningSettings')} /> ); From aab1fd24a296bbb1f25f2cf2c5ff7b5017da4eee Mon Sep 17 00:00:00 2001 From: Overtorment Date: Wed, 18 Mar 2020 11:56:59 +0000 Subject: [PATCH 4/6] REF: react hooks --- .eslintrc | 4 +++- BlueComponents.js | 7 ++----- screen/settings/about.js | 2 +- screen/settings/releasenotes.js | 2 +- screen/wallets/selectWallet.js | 2 +- 5 files changed, 8 insertions(+), 9 deletions(-) diff --git a/.eslintrc b/.eslintrc index 4bf98c89..8c1132ed 100644 --- a/.eslintrc +++ b/.eslintrc @@ -1,10 +1,12 @@ { "parser": "babel-eslint", "plugins": [ - "react", "prettier" + "react", "prettier", "react-hooks" ], "extends": ["standard", "standard-react", "prettier"], "rules": { + "react-hooks/rules-of-hooks": "error", + "react-hooks/exhaustive-deps": "error", 'prettier/prettier': [ 'warn', { diff --git a/BlueComponents.js b/BlueComponents.js index 4a3565d9..69d554a8 100644 --- a/BlueComponents.js +++ b/BlueComponents.js @@ -1429,13 +1429,10 @@ export class NewWalletPanel extends Component { export const BlueTransactionListItem = ({ item, itemPriceUnit = BitcoinUnit.BTC, shouldRefresh }) => { const [transactionTimeToReadable, setTransactionTimeToReadable] = useState('...'); const [subtitleNumberOfLines, setSubtitleNumberOfLines] = useState(1); - const calculateTimeLabel = () => { - const transactionTimeToReadable = loc.transactionTimeToReadable(item.received); - return setTransactionTimeToReadable(transactionTimeToReadable); - }; useEffect(() => { - calculateTimeLabel(); + const transactionTimeToReadable = loc.transactionTimeToReadable(item.received); + return setTransactionTimeToReadable(transactionTimeToReadable); }, [item, itemPriceUnit, shouldRefresh]); const txMemo = () => { diff --git a/screen/settings/about.js b/screen/settings/about.js index 33836f03..51dcfbe5 100644 --- a/screen/settings/about.js +++ b/screen/settings/about.js @@ -23,7 +23,7 @@ const About = () => { useEffect(() => { setIsLoading(false); - }); + }, []); const handleOnReleaseNotesPress = () => { navigate('ReleaseNotes'); diff --git a/screen/settings/releasenotes.js b/screen/settings/releasenotes.js index b854c0a9..fa515a29 100644 --- a/screen/settings/releasenotes.js +++ b/screen/settings/releasenotes.js @@ -9,7 +9,7 @@ const ReleaseNotes = () => { useEffect(() => { setIsLoading(false); - }); + }, []); return isLoading ? ( () diff --git a/screen/wallets/selectWallet.js b/screen/wallets/selectWallet.js index bd29bd03..9998a86d 100644 --- a/screen/wallets/selectWallet.js +++ b/screen/wallets/selectWallet.js @@ -21,7 +21,7 @@ const SelectWallet = () => { useEffect(() => { setIsLoading(false); - }); + }, []); const renderItem = ({ item }) => { return ( From 6cb344286cef1c8847f32c89048b7b0efaf8282b Mon Sep 17 00:00:00 2001 From: marcosrdz Date: Thu, 2 Apr 2020 12:47:13 -0400 Subject: [PATCH 5/6] OPS: Lint --- screen/send/ScanQRCode.js | 3 +++ screen/settings/NetworkSettings.js | 2 +- screen/settings/licensing.js | 2 +- screen/settings/settings.js | 2 +- 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/screen/send/ScanQRCode.js b/screen/send/ScanQRCode.js index 80fa7c72..70d9ceb5 100644 --- a/screen/send/ScanQRCode.js +++ b/screen/send/ScanQRCode.js @@ -12,10 +12,13 @@ const LocalQRCode = require('@remobile/react-native-qrcode-local-image'); const createHash = require('create-hash'); const ScanQRCode = ({ + // eslint-disable-next-line react-hooks/rules-of-hooks onBarScanned = useNavigationParam('onBarScanned'), cameraPreviewIsPaused = false, showCloseButton = true, + // eslint-disable-next-line react-hooks/rules-of-hooks showFileImportButton = useNavigationParam('showFileImportButton') || false, + // eslint-disable-next-line react-hooks/rules-of-hooks launchedBy = useNavigationParam('launchedBy'), }) => { if (!launchedBy || !onBarScanned) console.warn('Necessary params missing'); diff --git a/screen/settings/NetworkSettings.js b/screen/settings/NetworkSettings.js index 2ece6840..bcf16f86 100644 --- a/screen/settings/NetworkSettings.js +++ b/screen/settings/NetworkSettings.js @@ -10,7 +10,7 @@ const NetworkSettings = () => { useEffect(() => { setIsLoading(false); - }); + }, []); return isLoading ? ( diff --git a/screen/settings/licensing.js b/screen/settings/licensing.js index 1d8a9ef7..794518c1 100644 --- a/screen/settings/licensing.js +++ b/screen/settings/licensing.js @@ -8,7 +8,7 @@ const Licensing = () => { useEffect(() => { setIsLoading(false); - }); + }, []); return isLoading ? ( () diff --git a/screen/settings/settings.js b/screen/settings/settings.js index 14a9db31..13855089 100644 --- a/screen/settings/settings.js +++ b/screen/settings/settings.js @@ -10,7 +10,7 @@ const Settings = () => { useEffect(() => { setIsLoading(false); - }); + }, []); return isLoading ? ( From 424dc29afcfd42b4e1a0fabc611ca2937c80b1c1 Mon Sep 17 00:00:00 2001 From: snyk-bot Date: Sat, 4 Apr 2020 05:50:42 +0000 Subject: [PATCH 6/6] fix: upgrade react-native-camera from 3.17.0 to 3.19.1 Snyk has created this PR to upgrade react-native-camera from 3.17.0 to 3.19.1. See this package in NPM: https://www.npmjs.com/package/react-native-camera See this project in Snyk: https://app.snyk.io/org/bluewallet/project/4d0df22a-0152-410a-8584-6df0d0a596d4?utm_source=github&utm_medium=upgrade-pr --- package-lock.json | 6 +++--- package.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index 378aae77..783e76fc 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11449,9 +11449,9 @@ "from": "git+https://github.com/BlueWallet/react-native-biometrics.git#2.0.0" }, "react-native-camera": { - "version": "3.17.0", - "resolved": "https://registry.npmjs.org/react-native-camera/-/react-native-camera-3.17.0.tgz", - "integrity": "sha512-Gd9E5XHrEScYPsugO4sYBYw+RnFg+M1kbjvsCE3B/pk+4Fk01tNY14RYoghYsimWWsQVgYNqOOJG5f1fQ3BUeg==", + "version": "3.19.1", + "resolved": "https://registry.npmjs.org/react-native-camera/-/react-native-camera-3.19.1.tgz", + "integrity": "sha512-d6tMnIXLps322pXeH7HpQ/O10nhTclSbTd9J8WGxO71QxRpTTxq3NlMPHtwaGYOBVAEl9zho3lbe+/Zxql95jw==", "requires": { "prop-types": "^15.6.2" } diff --git a/package.json b/package.json index bcf1ce11..63bdd16e 100644 --- a/package.json +++ b/package.json @@ -96,7 +96,7 @@ "react-localization": "1.0.15", "react-native": "0.61.5", "react-native-biometrics": "git+https://github.com/BlueWallet/react-native-biometrics.git#2.0.0", - "react-native-camera": "3.17.0", + "react-native-camera": "3.19.1", "react-native-default-preference": "1.4.1", "react-native-device-info": "4.0.1", "react-native-document-picker": "git+https://github.com/BlueWallet/react-native-document-picker.git#9ce83792db340d01b1361d24b19613658abef4aa",