-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.js
83 lines (75 loc) · 2.63 KB
/
App.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
import React from 'react';
import { View } from 'react-native';
import { createStackNavigator } from 'react-navigation';
import Home from './screens/twoFactorOnboarding/Home';
import TwoFactorSetupIntro from './screens/twoFactorOnboarding/TwoFactorSetupIntro';
import TwoFactorSetupWebView from './screens/twoFactorOnboarding/TwoFactorSetupWebView';
import TwoFactorSetupEnd from './screens/twoFactorOnboarding/TwoFactorSetupEnd';
import AppSpecificPasswordWebView from './screens/twoFactorOnboarding/AppSpecificPasswordWebView';
import AppSpecificPasswordEnd from './screens/twoFactorOnboarding/AppSpecificPasswordEnd';
import {Theme} from './styles/common';
const TwoFactorNavigator = createStackNavigator(
{
Home: { screen: Home },
TwoFactorSetupIntro: { screen: TwoFactorSetupIntro },
TwoFactorSetupWebView: { screen: TwoFactorSetupWebView },
TwoFactorSetupEnd: { screen: TwoFactorSetupEnd },
AppSpecificPasswordWebView: { screen: AppSpecificPasswordWebView },
AppSpecificPasswordEnd: { screen: AppSpecificPasswordEnd },
},
{
initialRouteName: 'Home',
headerMode: 'none',
navigationOptions: {
headerVisible: false,
},
cardStyle: {
backgroundColor: Theme.primaryBackground,
},
}
);
//this screen gets launched with an array of obj
//this screen need to manage state of each emailAddress
export default class TwoFactorOnboarding extends React.PureComponent {
constructor(props) {
super(props);
//shuhao can we launch this screen with a prop for emailAddress and app name
let emailAddress = '[email protected]';
let appName = 'Kantar';
this.state = {
appName:appName,
account: {email:emailAddress}
};
}
updateEmailAddress = async (account, password) => {
//shuhao Send stuff out of library {email,password};
console.log(account+' '+password)
//sendAppSpecificPassword(account.email, password);
};
close = () => {
const { closeHandler } = this.props;
closeHandler && closeHandler();
};
dismiss = () => {
const { dismissHandler } = this.props;
dismissHandler && dismissHandler();
};
render() {
const { account } = this.state;
if (!account) return null; // if accounts don't exist, show nothing
// the accounts object and fucntions to update accounts and exit
const screenProps = {
account,
appName:this.state.appName,
library:true,
updateEmailAddress: this.updateEmailAddress,
close: this.close,
dismiss: this.dismiss,
};
return (
<View style={{ height: '100%', width: '100%' }}>
<TwoFactorNavigator screenProps={screenProps} />
</View>
);
}
}