BlueWallet/screen/plausibledeniability.js
Igor Korsakov 6f581a2f2e
Eject (#126)
* 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
2018-12-11 22:52:46 +00:00

115 lines
3.4 KiB
JavaScript

/* global alert */
import React, { Component } from 'react';
import { ScrollView } from 'react-native';
import Ionicons from 'react-native-vector-icons/Ionicons';
import { BlueLoading, BlueButton, SafeBlueArea, BlueCard, BlueText, BlueHeader, BlueSpacing20 } from '../BlueComponents';
import PropTypes from 'prop-types';
/** @type {AppStorage} */
let BlueApp = require('../BlueApp');
let prompt = require('../prompt');
let EV = require('../events');
let loc = require('../loc');
export default class PlausibleDeniability extends Component {
static navigationOptions = {
tabBarLabel: loc.plausibledeniability.title,
tabBarIcon: ({ tintColor, focused }) => (
<Ionicons name={focused ? 'ios-settings' : 'ios-settings-outline'} size={26} style={{ color: tintColor }} />
),
};
constructor(props) {
super(props);
this.state = {
isLoading: true,
};
}
async componentDidMount() {
this.setState({
isLoading: false,
});
}
render() {
if (this.state.isLoading) {
return <BlueLoading />;
}
return (
<SafeBlueArea forceInset={{ horizontal: 'always' }} style={{ flex: 1 }}>
<BlueHeader
backgroundColor={BlueApp.settings.brandingColor}
centerComponent={{
text: loc.plausibledeniability.title,
style: { color: BlueApp.settings.foregroundColor, fontSize: 23 },
}}
/>
<BlueCard>
<ScrollView maxHeight={450}>
<BlueText>{loc.plausibledeniability.help}</BlueText>
<BlueText />
<BlueText>{loc.plausibledeniability.help2}</BlueText>
<BlueSpacing20 />
<BlueButton
icon={{
name: 'shield',
type: 'octicon',
color: BlueApp.settings.buttonTextColor,
}}
title={loc.plausibledeniability.create_fake_storage}
onPress={async () => {
let p1 = await prompt(loc.plausibledeniability.create_password, loc.plausibledeniability.create_password_explanation);
if (p1 === BlueApp.cachedPassword) {
return alert(loc.plausibledeniability.password_should_not_match);
}
if (!p1) {
return;
}
let p2 = await prompt(loc.plausibledeniability.retype_password);
if (p1 !== p2) {
return alert(loc.plausibledeniability.passwords_do_not_match);
}
await BlueApp.createFakeStorage(p1);
EV(EV.enum.WALLETS_COUNT_CHANGED);
EV(EV.enum.TRANSACTIONS_COUNT_CHANGED);
alert(loc.plausibledeniability.success);
this.props.navigation.navigate('Wallets');
}}
/>
<BlueSpacing20 />
<BlueButton
icon={{
name: 'arrow-left',
type: 'octicon',
color: BlueApp.settings.buttonTextColor,
}}
title={loc.plausibledeniability.go_back}
onPress={() => {
this.props.navigation.goBack();
}}
/>
</ScrollView>
</BlueCard>
</SafeBlueArea>
);
}
}
PlausibleDeniability.propTypes = {
navigation: PropTypes.shape({
navigate: PropTypes.func,
goBack: PropTypes.func,
}),
};