-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
commit: handle SpidL2 and SpidL3 for both uat and prod
- Loading branch information
1 parent
a226133
commit 5baad5d
Showing
7 changed files
with
154 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { StyleSheet } from 'react-native'; | ||
|
||
export const styles = StyleSheet.create({ | ||
container: { | ||
flex: 1, | ||
justifyContent: 'center', | ||
marginHorizontal: 16, | ||
}, | ||
switchContainer: { | ||
flexDirection: 'row', | ||
justifyContent: 'space-between', | ||
alignItems: 'center', | ||
marginVertical: 8, | ||
}, | ||
title: { | ||
textAlign: 'center', | ||
marginVertical: 8, | ||
fontWeight: 'bold', | ||
fontSize: 14, | ||
}, | ||
separator: { | ||
marginVertical: 8, | ||
borderBottomColor: '#737373', | ||
borderBottomWidth: StyleSheet.hairlineWidth, | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,12 @@ | ||
import { createNativeStackNavigator } from '@react-navigation/native-stack'; | ||
import type { WebViewLoginNavigationProps } from '../screen/WebViewLoginScreen'; | ||
|
||
export type NavigatorStackParamList = { | ||
Home: undefined; | ||
NativeModule: undefined; | ||
NativeView: undefined; | ||
WebViewLogin: undefined; | ||
WebViewLoginConfig: undefined; | ||
WebViewLogin: WebViewLoginNavigationProps; | ||
}; | ||
|
||
export const Stack = createNativeStackNavigator<NavigatorStackParamList>(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
import * as React from 'react'; | ||
|
||
import { Button, SafeAreaView, Switch, Text, View } from 'react-native'; | ||
import type { NavigatorStackParamList } from '../navigation'; | ||
import { styles } from '../common/style'; | ||
import { useNavigation } from '@react-navigation/native'; | ||
import type { NativeStackNavigationProp } from '@react-navigation/native-stack'; | ||
|
||
type HomeScreenNavigationProp = NativeStackNavigationProp< | ||
NavigatorStackParamList, | ||
'Home' | ||
>; | ||
type HomeScreenProps = { | ||
navigation: HomeScreenNavigationProp; | ||
}; | ||
|
||
export const WebViewLoginConfig: React.FC<HomeScreenProps> = () => { | ||
const [isSpidLevel3Enabled, setIsSpidLevel3Enabled] = React.useState(false); | ||
const toggleSpidLevel3Switch = () => | ||
setIsSpidLevel3Enabled((previousState) => !previousState); | ||
const [isUatEnabled, setIsUatEnabled] = React.useState(false); | ||
const toggleUatSwitch = () => | ||
setIsUatEnabled((previousState) => !previousState); | ||
|
||
const navigation = | ||
useNavigation< | ||
NativeStackNavigationProp<NavigatorStackParamList, 'WebViewLoginConfig'> | ||
>(); | ||
|
||
return ( | ||
<SafeAreaView style={styles.container}> | ||
<View style={styles.switchContainer}> | ||
<Text style={styles.title}>SPID Level 3 (default is 2)</Text> | ||
<Switch | ||
value={isSpidLevel3Enabled} | ||
onValueChange={toggleSpidLevel3Switch} | ||
/> | ||
</View> | ||
<View style={styles.separator} /> | ||
<View style={styles.switchContainer}> | ||
<Text style={styles.title}> | ||
Set UAT environment (default is production) | ||
</Text> | ||
<Switch value={isUatEnabled} onValueChange={toggleUatSwitch} /> | ||
</View> | ||
<View style={styles.separator} /> | ||
<View> | ||
<Text style={styles.title}>Test CieId production login</Text> | ||
<Button | ||
title="Test CieId Login" | ||
// nice fluo color | ||
color="#00ee66" | ||
onPress={() => | ||
navigation.navigate({ | ||
name: 'WebViewLogin', | ||
params: { | ||
spidLevel: isSpidLevel3Enabled ? 'SpidL3' : 'SpidL2', | ||
isUat: isUatEnabled, | ||
}, | ||
}) | ||
} | ||
/> | ||
</View> | ||
</SafeAreaView> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters