2018-12-24 19:12:27 +01:00
|
|
|
import 'intl';
|
|
|
|
import 'intl/locale-data/jsonp/en';
|
2018-12-11 23:52:46 +01:00
|
|
|
import React from 'react';
|
|
|
|
import './shim.js';
|
2019-01-10 16:04:16 +01:00
|
|
|
import { Sentry } from 'react-native-sentry';
|
2018-12-11 23:52:46 +01:00
|
|
|
import { AppRegistry } from 'react-native';
|
|
|
|
import WalletMigrate from './screen/wallets/walletMigrate';
|
|
|
|
import { name as appName } from './app.json';
|
2019-09-25 05:42:21 +02:00
|
|
|
import App from './App';
|
2019-09-20 02:09:33 +02:00
|
|
|
import LottieView from 'lottie-react-native';
|
2019-09-25 05:42:21 +02:00
|
|
|
import UnlockWith from './UnlockWith.js';
|
2019-09-20 02:09:33 +02:00
|
|
|
|
2018-12-11 23:52:46 +01:00
|
|
|
/** @type {AppStorage} */
|
2019-08-17 21:27:40 +02:00
|
|
|
let A = require('./analytics');
|
2019-01-10 16:04:16 +01:00
|
|
|
if (process.env.NODE_ENV !== 'development') {
|
|
|
|
Sentry.config('https://23377936131848ca8003448a893cb622@sentry.io/1295736').install();
|
|
|
|
}
|
2018-12-11 23:52:46 +01:00
|
|
|
|
|
|
|
if (!Error.captureStackTrace) {
|
|
|
|
// captureStackTrace is only available when debugging
|
|
|
|
Error.captureStackTrace = () => {};
|
|
|
|
}
|
|
|
|
|
|
|
|
class BlueAppComponent extends React.Component {
|
|
|
|
constructor(props) {
|
|
|
|
super(props);
|
2019-09-25 05:42:21 +02:00
|
|
|
this.state = { isMigratingData: true, onAnimationFinished: false, successfullyAuthenticated: false };
|
2019-09-20 02:09:33 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
componentDidMount() {
|
|
|
|
const walletMigrate = new WalletMigrate(this.setIsMigratingData);
|
|
|
|
walletMigrate.start();
|
2018-12-11 23:52:46 +01:00
|
|
|
}
|
|
|
|
|
2019-01-30 03:13:45 +01:00
|
|
|
setIsMigratingData = async () => {
|
2019-08-17 21:27:40 +02:00
|
|
|
A(A.ENUM.INIT);
|
2018-12-11 23:52:46 +01:00
|
|
|
this.setState({ isMigratingData: false });
|
2019-01-30 03:13:45 +01:00
|
|
|
};
|
2018-12-11 23:52:46 +01:00
|
|
|
|
2019-09-20 02:09:33 +02:00
|
|
|
onAnimationFinish = () => {
|
|
|
|
if (this.state.isMigratingData) {
|
|
|
|
this.loadingSplash.play(0);
|
|
|
|
} else {
|
|
|
|
this.setState({ onAnimationFinished: true });
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2019-09-25 05:42:21 +02:00
|
|
|
onSuccessfullyAuthenticated = () => {
|
|
|
|
this.setState({ successfullyAuthenticated: true })
|
|
|
|
}
|
|
|
|
|
2018-12-11 23:52:46 +01:00
|
|
|
render() {
|
2019-09-20 02:09:33 +02:00
|
|
|
if (this.state.isMigratingData) {
|
|
|
|
return (
|
|
|
|
<LottieView
|
|
|
|
ref={ref => (this.loadingSplash = ref)}
|
|
|
|
onAnimationFinish={this.onAnimationFinish}
|
|
|
|
source={require('./img/bluewalletsplash.json')}
|
|
|
|
autoPlay
|
|
|
|
loop={false}
|
|
|
|
/>
|
|
|
|
);
|
|
|
|
} else {
|
|
|
|
if (this.state.onAnimationFinished) {
|
2019-09-25 05:42:21 +02:00
|
|
|
return this.state.successfullyAuthenticated ? <App /> : <UnlockWith onSuccessfullyAuthenticated={this.onSuccessfullyAuthenticated} />;
|
2019-09-20 02:09:33 +02:00
|
|
|
} else {
|
|
|
|
return (
|
|
|
|
<LottieView
|
|
|
|
ref={ref => (this.loadingSplash = ref)}
|
|
|
|
onAnimationFinish={this.onAnimationFinish}
|
|
|
|
source={require('./img/bluewalletsplash.json')}
|
|
|
|
autoPlay
|
|
|
|
loop={false}
|
|
|
|
/>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
2018-12-11 23:52:46 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
AppRegistry.registerComponent(appName, () => BlueAppComponent);
|