Browse Source

ADD: brought back Lapp browser

ble
Overtorment 5 years ago
parent
commit
65fcb1bbff
  1. 32
      screen/lnd/browser.js
  2. 42
      screen/wallets/transactions.js

32
screen/lnd/browser.js

@ -1,5 +1,5 @@
import React, { Component } from 'react';
import { TouchableOpacity, ActivityIndicator, TextInput, Keyboard, BackHandler, View, Alert } from 'react-native';
import { TouchableOpacity, ActivityIndicator, TextInput, Keyboard, BackHandler, View, Alert, Platform } from 'react-native';
import { WebView } from 'react-native-webview';
import { BlueNavigationStyle, SafeBlueArea } from '../../BlueComponents';
import Ionicons from 'react-native-vector-icons/Ionicons';
@ -402,21 +402,23 @@ export default class Browser extends Component {
</View>
</View>
<View style={{ alignContent: 'flex-end', height: 44, flexDirection: 'row', marginHorizontal: 8 }}>
<TouchableOpacity
onPress={() => {
processedInvoices = {};
this.setState({ url: 'https://bluewallet.io/marketplace/' });
}}
>
<Ionicons
name={'ios-home'}
size={36}
style={{
color: this.state.weblnEnabled ? 'green' : 'red',
backgroundColor: 'transparent',
{Platform.OS !== 'ios' && ( // on iOS lappbrowser opens blank page, thus, no HOME button
<TouchableOpacity
onPress={() => {
processedInvoices = {};
this.setState({ url: 'https://bluewallet.io/marketplace/' });
}}
/>
</TouchableOpacity>
>
<Ionicons
name={'ios-home'}
size={36}
style={{
color: this.state.weblnEnabled ? 'green' : 'red',
backgroundColor: 'transparent',
}}
/>
</TouchableOpacity>
)}
<TouchableOpacity
onPress={() => {

42
screen/wallets/transactions.js

@ -326,6 +326,33 @@ export default class WalletTransactions extends Component {
});
};
renderLappBrowserButton = () => {
return (
<TouchableOpacity
onPress={() => {
this.props.navigation.navigate('LappBrowser', {
fromSecret: this.state.wallet.getSecret(),
fromWallet: this.state.wallet,
url: 'about:blank',
});
}}
style={{
marginLeft: 5,
backgroundColor: '#f2f2f2',
borderRadius: 9,
minHeight: 49,
flex: 1,
paddingHorizontal: 8,
justifyContent: 'center',
flexDirection: 'row',
alignItems: 'center',
}}
>
<Text style={{ color: '#062453', fontSize: 18 }}>LApp Browser</Text>
</TouchableOpacity>
);
};
onWalletSelect = async wallet => {
NavigationService.navigate('WalletTransactions');
/** @type {LightningCustodianWallet} */
@ -394,7 +421,20 @@ export default class WalletTransactions extends Component {
onManageFundsPressed={() => this.setState({ isManageFundsModalVisible: true })}
/>
<View style={{ backgroundColor: '#FFFFFF' }}>
<View style={{ flexDirection: 'row', margin: 16, justifyContent: 'space-evenly' }}>{this.renderMarketplaceButton()}</View>
<View style={{ flexDirection: 'row', margin: 16, justifyContent: 'space-evenly' }}>
{/*
So the idea here, due to Apple banning native Lapp marketplace, is:
On Android everythins works as it worked before. Single "Marketplace" button that leads to LappBrowser that
opens /marketplace/ url of offchain wallet type, and /marketplace-btc/ for onchain.
On iOS its more complicated - we have one button that opens same page _externally_ (in Safari), and second
button that opens actual LappBrowser but with _blank_ page. This is important to not trigger Apple.
Blank page is also the way Trust Wallet does it with Dapp Browser.
For ONCHAIN wallet type no LappBrowser button should be displayed, its Lightning-network specific.
*/}
{this.renderMarketplaceButton()}
{this.state.wallet.type === LightningCustodianWallet.type && Platform.OS === 'ios' && this.renderLappBrowserButton()}
</View>
<FlatList
onEndReachedThreshold={0.3}
onEndReached={() => {

Loading…
Cancel
Save