2018-12-12 14:29:10 +01:00
|
|
|
import React from 'react';
|
|
|
|
import { Linking } from 'react-native';
|
|
|
|
import { NavigationActions } from 'react-navigation';
|
|
|
|
|
|
|
|
import MainBottomTabs from './MainBottomTabs';
|
|
|
|
|
|
|
|
export default class App extends React.Component {
|
|
|
|
navigator = null;
|
|
|
|
|
|
|
|
componentDidMount() {
|
|
|
|
Linking.getInitialURL()
|
|
|
|
.then(url => this.handleOpenURL({ url }))
|
|
|
|
.catch(console.error);
|
|
|
|
|
|
|
|
Linking.addEventListener('url', this.handleOpenURL);
|
|
|
|
}
|
|
|
|
|
|
|
|
componentWillUnmount() {
|
|
|
|
Linking.removeEventListener('url', this.handleOpenURL);
|
|
|
|
}
|
|
|
|
|
|
|
|
handleOpenURL = event => {
|
2018-12-19 02:46:06 +01:00
|
|
|
if (event.url && event.url.toLowerCase().indexOf('bitcoin:') === 0) {
|
2018-12-12 14:29:10 +01:00
|
|
|
this.navigator &&
|
|
|
|
this.navigator.dispatch(
|
|
|
|
NavigationActions.navigate({
|
|
|
|
routeName: 'SendDetails',
|
|
|
|
params: {
|
|
|
|
uri: event.url,
|
|
|
|
},
|
|
|
|
}),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
render() {
|
|
|
|
return (
|
|
|
|
<MainBottomTabs
|
|
|
|
ref={nav => {
|
|
|
|
this.navigator = nav;
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|