diff --git a/screen/wallets/transactions.js b/screen/wallets/transactions.js index da31c559..4b66254e 100644 --- a/screen/wallets/transactions.js +++ b/screen/wallets/transactions.js @@ -73,9 +73,6 @@ export default class WalletTransactions extends Component { const wallet = props.navigation.getParam('wallet'); this.props.navigation.setParams({ wallet: wallet, isLoading: true }); this.state = { - showMarketplace: Platform.OS === 'ios' ? wallet.getBalance() > 0 : true, - isIos: Platform.OS === 'ios', - isAndroid: Platform.OS !== 'ios', isLoading: true, isManageFundsModalVisible: false, showShowFlatListRefreshControl: false, @@ -276,6 +273,63 @@ export default class WalletTransactions extends Component { ); }; + renderMarketplaceButton = () => { + return Platform.select({ + android: ( + { + if (this.state.wallet.type === LightningCustodianWallet.type) { + this.props.navigation.navigate('LappBrowser', { fromSecret: this.state.wallet.getSecret(), fromWallet: this.state.wallet }); + } else { + this.props.navigation.navigate('Marketplace', { fromWallet: this.state.wallet }); + } + }} + > + + marketplace + + + ), + ios: + this.state.wallet.getBalance() > 0 ? ( + { + if (this.state.wallet.type === LightningCustodianWallet.type) { + Linking.openURL('https://bluewallet.io/marketplace/'); + } else { + let address = await this.state.wallet.getAddressAsync(); + Linking.openURL('https://bluewallet.io/marketplace-btc/?address=' + address); + } + }} + > + + + marketplace + + + ) : null, + }); + }; + onWalletSelect = async wallet => { NavigationService.navigate('WalletTransactions'); /** @type {LightningCustodianWallet} */ @@ -344,56 +398,7 @@ export default class WalletTransactions extends Component { onManageFundsPressed={() => this.setState({ isManageFundsModalVisible: true })} /> - {this.state.showMarketplace && this.state.isAndroid && ( - { - if (this.state.wallet.type === LightningCustodianWallet.type) { - navigate('LappBrowser', { fromSecret: this.state.wallet.getSecret(), fromWallet: this.state.wallet }); - } else { - navigate('Marketplace', { fromWallet: this.state.wallet }); - } - }} - > - - marketplace - - - )} - {this.state.showMarketplace && this.state.isIos && ( - { - if (this.state.wallet.type === LightningCustodianWallet.type) { - Linking.openURL('https://bluewallet.io/marketplace/'); - } else { - let address = await this.state.wallet.getAddressAsync(); - Linking.openURL('https://bluewallet.io/marketplace-btc/?address=' + address); - } - }} - > - - - marketplace - - - )} + {this.renderMarketplaceButton()} {