Browse Source

Merge branch 'master' into screensize

shakedebug
Overtorment 5 years ago
committed by GitHub
parent
commit
ceb2f129d0
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 40
      BlueComponents.js
  2. 6
      ios/Podfile.lock
  3. 4
      package-lock.json
  4. 1
      package.json
  5. 7
      screen/lnd/lndViewAdditionalInvoiceInformation.js
  6. 14
      screen/lnd/lndViewInvoice.js
  7. 6
      screen/receive/details.js
  8. 8
      screen/receive/receiveAmount.js
  9. 49
      screen/wallets/details.js
  10. 8
      screen/wallets/export.js
  11. 22
      screen/wallets/import.js
  12. 6
      screen/wallets/xpub.js

40
BlueComponents.js

@ -561,10 +561,6 @@ export class BlueFormMultiInput extends Component {
};
}
onSelectionChange = ({ nativeEvent: { selection, text } }) => {
this.setState({ selection: { start: selection.end, end: selection.end } });
};
render() {
return (
<TextInput
@ -587,8 +583,6 @@ export class BlueFormMultiInput extends Component {
spellCheck={false}
{...this.props}
selectTextOnFocus={false}
onSelectionChange={this.onSelectionChange}
selection={this.state.selection}
keyboardType={Platform.OS === 'android' ? 'visible-password' : 'default'}
/>
);
@ -857,6 +851,40 @@ export class BlueDismissKeyboardInputAccessory extends Component {
}
}
export class BlueDoneAndDismissKeyboardInputAccessory extends Component {
static InputAccessoryViewID = 'BlueDoneAndDismissKeyboardInputAccessory';
onPasteTapped = async () => {
const clipboard = await Clipboard.getString();
this.props.onPasteTapped(clipboard);
};
render() {
const inputView = (
<View
style={{
backgroundColor: '#eef0f4',
height: 44,
flex: 1,
flexDirection: 'row',
justifyContent: 'flex-end',
alignItems: 'center',
}}
>
<BlueButtonLink title="Clear" onPress={this.props.onClearTapped} />
<BlueButtonLink title="Paste" onPress={this.onPasteTapped} />
<BlueButtonLink title="Done" onPress={() => Keyboard.dismiss()} />
</View>
);
if (Platform.OS === 'ios') {
return <InputAccessoryView nativeID={BlueDoneAndDismissKeyboardInputAccessory.InputAccessoryViewID}>{inputView}</InputAccessoryView>;
} else {
return <KeyboardAvoidingView style={{ height: 44 }}>{inputView}</KeyboardAvoidingView>;
}
}
}
export class BlueLoading extends Component {
render() {
return (

6
ios/Podfile.lock

@ -33,6 +33,8 @@ PODS:
- DoubleConversion
- glog
- glog (0.3.5)
- RCTSystemSetting (1.7.2):
- React
- React (0.60.5):
- React-Core (= 0.60.5)
- React-DevSupport (= 0.60.5)
@ -163,6 +165,7 @@ DEPENDENCIES:
- EFQRCode (~> 5.0.0)
- Folly (from `../node_modules/react-native/third-party-podspecs/Folly.podspec`)
- glog (from `../node_modules/react-native/third-party-podspecs/glog.podspec`)
- RCTSystemSetting (from `../node_modules/react-native-system-setting`)
- React (from `../node_modules/react-native/`)
- React-Core (from `../node_modules/react-native/React`)
- React-cxxreact (from `../node_modules/react-native/ReactCommon/cxxreact`)
@ -226,6 +229,8 @@ EXTERNAL SOURCES:
:podspec: "../node_modules/react-native/third-party-podspecs/Folly.podspec"
glog:
:podspec: "../node_modules/react-native/third-party-podspecs/glog.podspec"
RCTSystemSetting:
:path: "../node_modules/react-native-system-setting"
React:
:path: "../node_modules/react-native/"
React-Core:
@ -315,6 +320,7 @@ SPEC CHECKSUMS:
EFQRCode: 07437cfbce3a1e497397a4f3d766c980d8972608
Folly: 30e7936e1c45c08d884aa59369ed951a8e68cf51
glog: 1f3da668190260b06b429bb211bfbee5cd790c28
RCTSystemSetting: 9279ff44c49bb4fb0a5d335a0851852c8f3eda99
React: 53c53c4d99097af47cf60594b8706b4e3321e722
React-Core: ba421f6b4f4cbe2fb17c0b6fc675f87622e78a64
React-cxxreact: 8384287780c4999351ad9b6e7a149d9ed10a2395

4
package-lock.json

@ -10885,6 +10885,10 @@
"resolved": "https://registry.npmjs.org/react-native-svg/-/react-native-svg-9.5.1.tgz",
"integrity": "sha512-cRGfomzG/5LEwuJ6ct3m5yccckeI9aj8BNYwDPVxOeJ84LuJuvk5OqcjlYNeEzOWmWiH+QrFXfpLH1ag04bUeQ=="
},
"react-native-system-setting": {
"version": "git+https://github.com/marcosrdz/react-native-system-setting.git#81e4fff3257d2efd0c0f3bccb17e11e94aaa2509",
"from": "git+https://github.com/marcosrdz/react-native-system-setting.git"
},
"react-native-tab-view": {
"version": "1.4.1",
"resolved": "https://registry.npmjs.org/react-native-tab-view/-/react-native-tab-view-1.4.1.tgz",

1
package.json

@ -108,6 +108,7 @@
"react-native-snap-carousel": "3.8.0",
"react-native-sortable-list": "0.0.23",
"react-native-svg": "9.5.1",
"react-native-system-setting": "git+https://github.com/marcosrdz/react-native-system-setting.git",
"react-native-tcp": "3.3.1",
"react-native-tooltip": "git+https://github.com/marcosrdz/react-native-tooltip.git",
"react-native-vector-icons": "6.6.0",

7
screen/lnd/lndViewAdditionalInvoiceInformation.js

@ -12,6 +12,7 @@ import {
} from '../../BlueComponents';
import PropTypes from 'prop-types';
import QRCode from 'react-native-qrcode-svg';
import SystemSetting from 'react-native-system-setting';
/** @type {AppStorage} */
let BlueApp = require('../../BlueApp');
const loc = require('../../loc');
@ -33,6 +34,12 @@ export default class LNDViewAdditionalInvoiceInformation extends Component {
return;
}
this.setState({ walletInfo: fromWallet.info_raw, addressText: fromWallet.info_raw.uris[0] });
await SystemSetting.saveBrightness();
await SystemSetting.setAppBrightness(1.0);
}
async componentWillUnmount() {
await SystemSetting.restoreBrightness();
}
render() {

14
screen/lnd/lndViewInvoice.js

@ -14,6 +14,7 @@ import PropTypes from 'prop-types';
import ReactNativeHapticFeedback from 'react-native-haptic-feedback';
import { Icon } from 'react-native-elements';
import QRCode from 'react-native-qrcode-svg';
import SystemSetting from 'react-native-system-setting';
/** @type {AppStorage} */
let BlueApp = require('../../BlueApp');
const loc = require('../../loc');
@ -43,7 +44,7 @@ export default class LNDViewInvoice extends Component {
qrCodeHeight: height > width ? width - 20 : width / 2,
};
this.fetchInvoiceInterval = undefined;
BackHandler.addEventListener('hardwareBackPress', this.handleBackButton.bind(this));
BackHandler.addEventListener('hardwareBackPress', this.handleBackButton);
}
async componentDidMount() {
@ -62,6 +63,8 @@ export default class LNDViewInvoice extends Component {
if (typeof updatedUserInvoice !== 'undefined') {
this.setState({ invoice: updatedUserInvoice, isLoading: false, addressText: updatedUserInvoice.payment_request });
await SystemSetting.saveBrightness();
await SystemSetting.setAppBrightness(1.0);
if (updatedUserInvoice.ispaid) {
// we fetched the invoice, and it is paid :-)
this.setState({ isFetchingInvoices: false });
@ -90,16 +93,17 @@ export default class LNDViewInvoice extends Component {
}, 3000);
}
componentWillUnmount() {
async componentWillUnmount() {
clearInterval(this.fetchInvoiceInterval);
this.fetchInvoiceInterval = undefined;
BackHandler.removeEventListener('hardwareBackPress', this.handleBackButton.bind(this));
BackHandler.removeEventListener('hardwareBackPress', this.handleBackButton);
await SystemSetting.restoreBrightness();
}
handleBackButton() {
handleBackButton = () => {
this.props.navigation.goBack(null);
return true;
}
};
onLayout = () => {
const { height } = Dimensions.get('window');

6
screen/receive/details.js

@ -16,6 +16,7 @@ import PropTypes from 'prop-types';
import Privacy from '../../Privacy';
import Share from 'react-native-share';
import { ScrollView } from 'react-native-gesture-handler';
import SystemSetting from 'react-native-system-setting';
/** @type {AppStorage} */
let BlueApp = require('../../BlueApp');
let loc = require('../../loc');
@ -80,13 +81,16 @@ export default class ReceiveDetails extends Component {
}
InteractionManager.runAfterInteractions(async () => {
await SystemSetting.saveBrightness();
await SystemSetting.setAppBrightness(1.0);
const bip21encoded = bip21.encode(this.state.address);
this.setState({ bip21encoded });
});
}
componentWillUnmount() {
async componentWillUnmount() {
Privacy.disableBlur();
await SystemSetting.restoreBrightness();
}
render() {

8
screen/receive/receiveAmount.js

@ -13,6 +13,7 @@ import {
} from '../../BlueComponents';
import PropTypes from 'prop-types';
import Privacy from '../../Privacy';
import SystemSetting from 'react-native-system-setting';
/** @type {AppStorage} */
let BlueApp = require('../../BlueApp');
let loc = require('../../loc');
@ -48,12 +49,15 @@ export default class ReceiveAmount extends Component {
};
}
componentDidMount() {
async componentDidMount() {
Privacy.enableBlur();
await SystemSetting.saveBrightness();
await SystemSetting.setAppBrightness(1.0);
}
componentWillUnmount() {
async componentWillUnmount() {
Privacy.disableBlur();
await SystemSetting.restoreBrightness();
}
determineSize = () => {

49
screen/wallets/details.js

@ -10,6 +10,7 @@ import { HDSegwitP2SHWallet } from '../../class/hd-segwit-p2sh-wallet';
import ReactNativeHapticFeedback from 'react-native-haptic-feedback';
import { HDSegwitBech32Wallet } from '../../class';
let EV = require('../../events');
let prompt = require('../../prompt');
/** @type {AppStorage} */
let BlueApp = require('../../BlueApp');
let loc = require('../../loc');
@ -65,6 +66,32 @@ export default class WalletDetails extends Component {
});
}
async presentWalletHasBalanceAlert() {
ReactNativeHapticFeedback.trigger('notificationWarning', { ignoreAndroidSystemSettings: false });
const walletBalanceConfirmation = await prompt(
'Wallet Balance',
`This wallet has a balance. Before proceeding, please be aware that you will not be able to recover the funds without this wallet's seed phrase. In order to avoid accidental removal this wallet, please enter your wallet's balance of ${this.state.wallet.getBalance()} satoshis.`,
true,
'plain-text',
);
if (Number(walletBalanceConfirmation) === this.state.wallet.getBalance()) {
this.props.navigation.setParams({ isLoading: true });
this.setState({ isLoading: true }, async () => {
BlueApp.deleteWallet(this.state.wallet);
ReactNativeHapticFeedback.trigger('notificationSuccess', { ignoreAndroidSystemSettings: false });
await BlueApp.saveToDisk();
EV(EV.enum.TRANSACTIONS_COUNT_CHANGED);
EV(EV.enum.WALLETS_COUNT_CHANGED);
this.props.navigation.navigate('Wallets');
});
} else {
ReactNativeHapticFeedback.trigger('notificationError', { ignoreAndroidSystemSettings: false });
this.setState({ isLoading: false }, async () => {
alert("The provided balance amount does not match this wallet's balance. Please, try again");
});
}
}
render() {
if (this.state.isLoading) {
return (
@ -190,15 +217,19 @@ export default class WalletDetails extends Component {
{
text: loc.wallets.details.yes_delete,
onPress: async () => {
this.props.navigation.setParams({ isLoading: true });
this.setState({ isLoading: true }, async () => {
BlueApp.deleteWallet(this.state.wallet);
ReactNativeHapticFeedback.trigger('notificationSuccess', { ignoreAndroidSystemSettings: false });
await BlueApp.saveToDisk();
EV(EV.enum.TRANSACTIONS_COUNT_CHANGED);
EV(EV.enum.WALLETS_COUNT_CHANGED);
this.props.navigation.navigate('Wallets');
});
if (this.state.wallet.getBalance() > 0) {
this.presentWalletHasBalanceAlert();
} else {
this.props.navigation.setParams({ isLoading: true });
this.setState({ isLoading: true }, async () => {
BlueApp.deleteWallet(this.state.wallet);
ReactNativeHapticFeedback.trigger('notificationSuccess', { ignoreAndroidSystemSettings: false });
await BlueApp.saveToDisk();
EV(EV.enum.TRANSACTIONS_COUNT_CHANGED);
EV(EV.enum.WALLETS_COUNT_CHANGED);
this.props.navigation.navigate('Wallets');
});
}
},
style: 'destructive',
},

8
screen/wallets/export.js

@ -4,6 +4,7 @@ import QRCode from 'react-native-qrcode-svg';
import { BlueSpacing20, SafeBlueArea, BlueNavigationStyle, BlueText } from '../../BlueComponents';
import PropTypes from 'prop-types';
import Privacy from '../../Privacy';
import SystemSetting from 'react-native-system-setting';
/** @type {AppStorage} */
let BlueApp = require('../../BlueApp');
let loc = require('../../loc');
@ -36,15 +37,18 @@ export default class WalletExport extends Component {
};
}
componentDidMount() {
async componentDidMount() {
Privacy.enableBlur();
this.setState({
isLoading: false,
});
await SystemSetting.saveBrightness();
await SystemSetting.setAppBrightness(1.0);
}
componentWillUnmount() {
async componentWillUnmount() {
Privacy.disableBlur();
await SystemSetting.restoreBrightness();
}
onLayout = () => {

22
screen/wallets/import.js

@ -9,12 +9,13 @@ import {
HDSegwitBech32Wallet,
} from '../../class';
import React, { Component } from 'react';
import { KeyboardAvoidingView, Dimensions, View, TouchableWithoutFeedback, Keyboard } from 'react-native';
import { KeyboardAvoidingView, Platform, Dimensions, View, TouchableWithoutFeedback, Keyboard } from 'react-native';
import {
BlueFormMultiInput,
BlueButtonLink,
BlueFormLabel,
BlueLoading,
BlueDoneAndDismissKeyboardInputAccessory,
BlueButton,
SafeBlueArea,
BlueSpacing20,
@ -41,6 +42,7 @@ export default class WalletsImport extends Component {
super(props);
this.state = {
isLoading: true,
isToolbarVisibleForAndroid: false,
};
}
@ -255,10 +257,28 @@ export default class WalletsImport extends Component {
<BlueFormMultiInput
value={this.state.label}
placeholder=""
contextMenuHidden
onChangeText={text => {
this.setLabel(text);
}}
inputAccessoryViewID={BlueDoneAndDismissKeyboardInputAccessory.InputAccessoryViewID}
onFocus={() => this.setState({ isToolbarVisibleForAndroid: true })}
onBlur={() => this.setState({ isToolbarVisibleForAndroid: false })}
/>
{Platform.select({
ios: (
<BlueDoneAndDismissKeyboardInputAccessory
onClearTapped={() => this.setState({ label: '' }, () => Keyboard.dismiss())}
onPasteTapped={text => this.setState({ label: text }, () => Keyboard.dismiss())}
/>
),
android: this.state.isToolbarVisibleForAndroid && (
<BlueDoneAndDismissKeyboardInputAccessory
onClearTapped={() => this.setState({ label: '' }, () => Keyboard.dismiss())}
onPasteTapped={text => this.setState({ label: text }, () => Keyboard.dismiss())}
/>
),
})}
</KeyboardAvoidingView>
</TouchableWithoutFeedback>

6
screen/wallets/xpub.js

@ -4,6 +4,7 @@ import QRCode from 'react-native-qrcode-svg';
import { BlueSpacing20, SafeBlueArea, BlueText, BlueNavigationStyle, BlueCopyTextToClipboard } from '../../BlueComponents';
import PropTypes from 'prop-types';
import Privacy from '../../Privacy';
import SystemSetting from 'react-native-system-setting';
/** @type {AppStorage} */
let BlueApp = require('../../BlueApp');
let loc = require('../../loc');
@ -43,9 +44,12 @@ export default class WalletXpub extends Component {
this.setState({
isLoading: false,
});
await SystemSetting.saveBrightness();
await SystemSetting.setAppBrightness(1.0);
}
componentWillUnmount() {
async componentWillUnmount() {
await SystemSetting.restoreBrightness();
Privacy.disableBlur();
}

Loading…
Cancel
Save