-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
98 lines (89 loc) · 2.52 KB
/
index.js
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
import 'intl';
import 'intl/locale-data/jsonp/en';
import React from 'react';
import './shim.js';
import { AppRegistry, StyleSheet, View, Text } from 'react-native';
import { initializeImageGateway } from './screen/data/mediaManager';
import { name as appName } from './app.json';
import App from './App';
import LottieView from 'lottie-react-native';
import UnlockWith from './UnlockWith.js';
if (!Error.captureStackTrace) {
// captureStackTrace is only available when debugging
Error.captureStackTrace = () => {};
}
class BlueAppComponent extends React.Component {
constructor(props) {
super(props);
this.state = { isMigratingData: false, onAnimationFinished: false, successfullyAuthenticated: false };
}
async componentDidMount() {
await initializeImageGateway();
}
setIsMigratingData = async () => {
this.setState({ isMigratingData: false });
};
onAnimationFinish = () => {
if (this.state.isMigratingData) {
this.loadingSplash.play(0);
} else {
this.setState({ onAnimationFinished: true });
}
};
onSuccessfullyAuthenticated = () => {
this.setState({ successfullyAuthenticated: true });
};
render() {
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) {
return this.state.successfullyAuthenticated ? (
<App />
) : (
<UnlockWith onSuccessfullyAuthenticated={this.onSuccessfullyAuthenticated} />
);
} else {
return (
<View style={styles.lottieContainer}>
<LottieView
ref={ref => (this.loadingSplash = ref)}
resizeMode="center"
onAnimationFinish={this.onAnimationFinish}
source={require('./img/bluewalletsplash.json')}
autoPlay
loop={false}
/>
<Text style={styles.keva}>
{"KEVA"}
</Text>
</View>
);
}
}
}
}
const styles = StyleSheet.create({
lottieContainer: {
flex: 1,
flexDirection: 'column',
justifyContent: 'flex-end'
},
keva: {
alignSelf: 'center',
fontSize: 42,
fontWeight: "100",
marginBottom: 80,
color: '#b1325d',
letterSpacing: 16
}
});
AppRegistry.registerComponent(appName, () => BlueAppComponent);