mirror of
https://github.com/BlueWallet/BlueWallet.git
synced 2025-01-19 05:45:15 +01:00
6f581a2f2e
* OPS: randombytes work * OPS: porting to RN android: added prompt, refactoring * OPS: better android prompt * FIX: scan qr callback * FIX: correct fee sat calculation for HD & classic segwit wallets * FIX: Fixed height for button in empty transaction list * FIX: keyboard issue on fee selection modal * FIX: slow QR code generation for HD backup screen * ADD: wallet reorder * FIX: TypeError: undefined is not an object (evaluating 'recommendedFees.halfHourFee') #133 * FIX: android appstore link * OPS: Code to Migrate Expo json * REF: renamed blitzhub to lndhub * OPS: Migration: move expo files instead of parsing * FIX: lndhub uri usage * FIX: no security alert on android (it was ios specific) * REF: better tx list rendering and sorting * ADD: verify tx on coinb.in * FIX: Tap to dismiss is not working #137 * REF: Removed Wallet gradients duplication. * REF: about screen * FIX: bech32 qr scan in send screen * FIX: better bip21 handling * Use of dayjs for transaction details * REF: QR code content follows BIP21 * ADD: fee in local currency when send * FIX: Refresh wallet info on page focus
106 lines
3.4 KiB
JavaScript
106 lines
3.4 KiB
JavaScript
/* global alert */
|
|
import React, { Component } from 'react';
|
|
import { View } from 'react-native';
|
|
import { FormValidationMessage } from 'react-native-elements';
|
|
import { BlueLoading, BlueSpacing20, BlueButton, SafeBlueArea, BlueCard, BlueText, BlueNavigationStyle } from '../../BlueComponents';
|
|
import PropTypes from 'prop-types';
|
|
/** @type {AppStorage} */
|
|
let BlueApp = require('../../BlueApp');
|
|
let prompt = require('../../prompt');
|
|
let loc = require('../../loc');
|
|
|
|
export default class EncryptStorage extends Component {
|
|
static navigationOptions = () => ({
|
|
...BlueNavigationStyle(),
|
|
title: loc.settings.encrypt_storage,
|
|
});
|
|
|
|
constructor(props) {
|
|
super(props);
|
|
this.state = {
|
|
isLoading: true,
|
|
language: loc.getLanguage(),
|
|
};
|
|
}
|
|
|
|
async componentDidMount() {
|
|
this.setState({
|
|
isLoading: false,
|
|
storageIsEncrypted: await BlueApp.storageIsEncrypted(),
|
|
});
|
|
}
|
|
|
|
render() {
|
|
if (this.state.isLoading) {
|
|
return <BlueLoading />;
|
|
}
|
|
|
|
return (
|
|
<SafeBlueArea forceInset={{ horizontal: 'always' }} style={{ flex: 1 }}>
|
|
<BlueCard>
|
|
{(() => {
|
|
if (this.state.storageIsEncrypted) {
|
|
return (
|
|
<View>
|
|
<BlueText>{loc.settings.storage_encrypted}</BlueText>
|
|
<BlueSpacing20 />
|
|
<BlueButton
|
|
onPress={() => this.props.navigation.navigate('PlausibleDeniability')}
|
|
title={loc.settings.plausible_deniability}
|
|
/>
|
|
</View>
|
|
);
|
|
} else {
|
|
return (
|
|
<View>
|
|
<FormValidationMessage>{loc.settings.storage_not_encrypted}</FormValidationMessage>
|
|
<BlueSpacing20 />
|
|
<BlueButton
|
|
icon={{
|
|
name: 'shield',
|
|
type: 'octicon',
|
|
color: BlueApp.settings.buttonTextColor,
|
|
}}
|
|
onPress={async () => {
|
|
this.setState({ isLoading: true });
|
|
let p1 = await prompt(loc.settings.password, loc.settings.password_explain).catch(() => {
|
|
this.setState({ isLoading: false });
|
|
p1 = undefined;
|
|
});
|
|
if (!p1) {
|
|
this.setState({ isLoading: false });
|
|
return;
|
|
}
|
|
let p2 = await prompt(loc.settings.password, loc.settings.retype_password).catch(() => {
|
|
this.setState({ isLoading: false });
|
|
});
|
|
if (p1 === p2) {
|
|
await BlueApp.encryptStorage(p1);
|
|
this.setState({
|
|
isLoading: false,
|
|
storageIsEncrypted: await BlueApp.storageIsEncrypted(),
|
|
});
|
|
} else {
|
|
this.setState({ isLoading: false });
|
|
alert(loc.settings.passwords_do_not_match);
|
|
}
|
|
}}
|
|
title={loc.settings.encrypt_storage}
|
|
/>
|
|
</View>
|
|
);
|
|
}
|
|
})()}
|
|
</BlueCard>
|
|
</SafeBlueArea>
|
|
);
|
|
}
|
|
}
|
|
|
|
EncryptStorage.propTypes = {
|
|
navigation: PropTypes.shape({
|
|
navigate: PropTypes.func,
|
|
goBack: PropTypes.func,
|
|
}),
|
|
};
|