mirror of
https://github.com/BlueWallet/BlueWallet.git
synced 2024-11-20 02:09:10 +01:00
commit
4ef3340b52
21
App.js
21
App.js
@ -95,6 +95,12 @@ export default class App extends React.Component {
|
||||
return isValidLightningInvoice;
|
||||
}
|
||||
|
||||
isSafelloRedirect(event) {
|
||||
let urlObject = url.parse(event.url, true) // eslint-disable-line
|
||||
|
||||
return !!urlObject.query["safello-state-token"]
|
||||
}
|
||||
|
||||
handleOpenURL = event => {
|
||||
if (event.url === null) {
|
||||
return;
|
||||
@ -122,6 +128,21 @@ export default class App extends React.Component {
|
||||
},
|
||||
}),
|
||||
);
|
||||
} else if (this.isSafelloRedirect(event)) {
|
||||
let urlObject = url.parse(event.url, true) // eslint-disable-line
|
||||
|
||||
const safelloStateToken = urlObject.query["safello-state-token"]
|
||||
|
||||
this.navigator &&
|
||||
this.navigator.dispatch(
|
||||
NavigationActions.navigate({
|
||||
routeName: "BuyBitcoin",
|
||||
params: {
|
||||
uri: event.url,
|
||||
safelloStateToken,
|
||||
},
|
||||
}),
|
||||
)
|
||||
} else {
|
||||
let urlObject = url.parse(event.url, true); // eslint-disable-line
|
||||
console.log('parsed', urlObject);
|
||||
|
@ -63,7 +63,21 @@ export default class BuyBitcoin extends Component {
|
||||
return <BlueLoading />;
|
||||
}
|
||||
|
||||
return <WebView source={{ uri: 'https://bluewallet.io/buy-bitcoin-redirect.html?address=' + this.state.address }} />;
|
||||
const { safelloStateToken } = this.props.navigation.state.params
|
||||
|
||||
let uri = "https://bluewallet.io/buy-bitcoin-redirect.html?address=" + this.state.address
|
||||
|
||||
if (safelloStateToken) {
|
||||
uri += "&safelloStateToken=" + safelloStateToken
|
||||
}
|
||||
|
||||
return (
|
||||
<WebView
|
||||
source={{
|
||||
uri,
|
||||
}}
|
||||
/>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@ -74,6 +88,7 @@ BuyBitcoin.propTypes = {
|
||||
params: PropTypes.shape({
|
||||
address: PropTypes.string,
|
||||
secret: PropTypes.string,
|
||||
safelloStateToken: PropTypes.string,
|
||||
}),
|
||||
}),
|
||||
}),
|
||||
|
Loading…
Reference in New Issue
Block a user