forked from bitcoinvault/GoldWallet
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
62 lines (53 loc) · 1.45 KB
/
index.js
File metadata and controls
62 lines (53 loc) · 1.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import 'intl';
import 'intl/locale-data/jsonp/en';
import './shim.js';
import React from 'react';
import { AppRegistry, StatusBar } from 'react-native';
import SplashScreen from 'react-native-splash-screen';
import App from './App';
import UnlockWith from './UnlockWith.js';
import { name as appName } from './app.json';
import WalletMigrate from './walletMigrate';
if (!Error.captureStackTrace) {
// captureStackTrace is only available when debugging
Error.captureStackTrace = () => {};
}
class BlueAppComponent extends React.Component {
constructor(props) {
super(props);
this.state = {
isMigratingData: true,
successfullyAuthenticated: false,
};
}
componentDidMount() {
const walletMigrate = new WalletMigrate(this.setIsMigratingData);
walletMigrate.start();
}
setIsMigratingData = async () => {
SplashScreen.hide();
this.setState({
isMigratingData: false,
});
};
onSuccessfullyAuthenticated = () => {
this.setState({
successfullyAuthenticated: true,
});
};
render() {
if (this.state.isMigratingData) {
return null;
} else {
return this.state.successfullyAuthenticated ? (
<>
<StatusBar backgroundColor="rgba(0,0,0,0)" translucent />
<App />
</>
) : (
<UnlockWith onSuccessfullyAuthenticated={this.onSuccessfullyAuthenticated} />
);
}
}
}
AppRegistry.registerComponent(appName, () => BlueAppComponent);