FIX: Handoff enabled flag

This commit is contained in:
marcosrdz 2020-03-30 09:50:19 -04:00
parent 971d92f4e3
commit 69ecddc5b8
2 changed files with 23 additions and 5 deletions

View file

@ -10,6 +10,8 @@ import {
BlueCopyToClipboardButton, BlueCopyToClipboardButton,
BlueNavigationStyle, BlueNavigationStyle,
} from '../../BlueComponents'; } from '../../BlueComponents';
import HandoffSettings from '../../class/handoff';
import Handoff from 'react-native-handoff';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
/** @type {AppStorage} */ /** @type {AppStorage} */
let BlueApp = require('../../BlueApp'); let BlueApp = require('../../BlueApp');
@ -69,13 +71,16 @@ export default class TransactionsDetails extends Component {
from, from,
to, to,
wallet, wallet,
isHandOffUseEnabled: false,
}; };
} }
async componentDidMount() { async componentDidMount() {
console.log('transactions/details - componentDidMount'); console.log('transactions/details - componentDidMount');
const isHandOffUseEnabled = await HandoffSettings.isHandoffUseEnabled();
this.setState({ this.setState({
isLoading: false, isLoading: false,
isHandOffUseEnabled,
}); });
} }
@ -86,6 +91,13 @@ export default class TransactionsDetails extends Component {
return ( return (
<SafeBlueArea forceInset={{ horizontal: 'always' }} style={{ flex: 1 }}> <SafeBlueArea forceInset={{ horizontal: 'always' }} style={{ flex: 1 }}>
{this.state.isHandOffUseEnabled && (
<Handoff
title={`Bitcoin Transaction ${this.state.tx.hash}`}
type="io.bluewallet.bluewallet"
url={`https://blockstream.info/tx/${this.state.tx.hash}`}
/>
)}
<BlueHeaderDefaultSub leftText={loc.transactions.details.title} rightComponent={null} /> <BlueHeaderDefaultSub leftText={loc.transactions.details.title} rightComponent={null} />
<ScrollView style={{ flex: 1 }}> <ScrollView style={{ flex: 1 }}>
<BlueCard> <BlueCard>

View file

@ -17,6 +17,7 @@ import { HDSegwitBech32Transaction } from '../../class';
import { BitcoinUnit } from '../../models/bitcoinUnits'; import { BitcoinUnit } from '../../models/bitcoinUnits';
import { Icon } from 'react-native-elements'; import { Icon } from 'react-native-elements';
import Handoff from 'react-native-handoff'; import Handoff from 'react-native-handoff';
import HandoffSettings from '../../class/handoff';
/** @type {AppStorage} */ /** @type {AppStorage} */
let BlueApp = require('../../BlueApp'); let BlueApp = require('../../BlueApp');
let loc = require('../../loc'); let loc = require('../../loc');
@ -70,13 +71,16 @@ export default class TransactionsStatus extends Component {
isCPFPpossible: buttonStatus.unknown, isCPFPpossible: buttonStatus.unknown,
isRBFBumpFeePossible: buttonStatus.unknown, isRBFBumpFeePossible: buttonStatus.unknown,
isRBFCancelPossible: buttonStatus.unknown, isRBFCancelPossible: buttonStatus.unknown,
isHandOffUseEnabled: false,
}; };
} }
async componentDidMount() { async componentDidMount() {
console.log('transactions/details - componentDidMount'); console.log('transactions/details - componentDidMount');
const isHandOffUseEnabled = await HandoffSettings.isHandoffUseEnabled();
this.setState({ this.setState({
isLoading: false, isLoading: false,
isHandOffUseEnabled,
}); });
try { try {
@ -143,11 +147,13 @@ export default class TransactionsStatus extends Component {
return ( return (
<SafeBlueArea forceInset={{ horizontal: 'always' }} style={{ flex: 1 }}> <SafeBlueArea forceInset={{ horizontal: 'always' }} style={{ flex: 1 }}>
<Handoff {this.state.isHandOffUseEnabled && (
title={`Bitcoin Transaction ${this.state.tx.hash}`} <Handoff
type="io.bluewallet.bluewallet" title={`Bitcoin Transaction ${this.state.tx.hash}`}
url={`https://blockstream.info/tx/${this.state.tx.hash}`} type="io.bluewallet.bluewallet"
/> url={`https://blockstream.info/tx/${this.state.tx.hash}`}
/>
)}
<View style={{ flex: 1, justifyContent: 'space-between' }}> <View style={{ flex: 1, justifyContent: 'space-between' }}>
<BlueCard> <BlueCard>
<View style={{ alignItems: 'center' }}> <View style={{ alignItems: 'center' }}>