-
Notifications
You must be signed in to change notification settings - Fork 127
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: adding explicit accept TC steps in the onboarding flow (#3218)
* feat: adding explicit accept TC steps in the onboarding flow * chore: address feedback --------- Co-authored-by: Nicolas Burtey <[email protected]>
- Loading branch information
1 parent
b4b40d0
commit 7fccaf8
Showing
15 changed files
with
237 additions
and
53 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
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
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,12 @@ | ||
import React from "react" | ||
|
||
import { StoryScreen } from "../../../.storybook/views" | ||
import { AcceptTermsAndConditionsScreen } from "./accept-t-and-c" | ||
|
||
export default { | ||
title: "AcceptTAndC", | ||
component: AcceptTermsAndConditionsScreen, | ||
decorators: [(Story) => <StoryScreen>{Story()}</StoryScreen>], | ||
} | ||
|
||
export const Default = () => <AcceptTermsAndConditionsScreen /> |
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,125 @@ | ||
import * as React from "react" | ||
import { Alert, View } from "react-native" | ||
|
||
import { GaloyPrimaryButton } from "@app/components/atomic/galoy-primary-button" | ||
import { useI18nContext } from "@app/i18n/i18n-react" | ||
import { RootStackParamList } from "@app/navigation/stack-param-lists" | ||
import { RouteProp, useNavigation, useRoute } from "@react-navigation/native" | ||
import { StackNavigationProp } from "@react-navigation/stack" | ||
import { Text, makeStyles } from "@rneui/themed" | ||
|
||
import { GaloySecondaryButton } from "@app/components/atomic/galoy-secondary-button" | ||
import InAppBrowser from "react-native-inappbrowser-reborn" | ||
import { Screen } from "../../components/screen" | ||
import { PhoneLoginInitiateType } from "../phone-auth-screen" | ||
import { DeviceAccountModal } from "../get-started-screen/device-account-modal" | ||
|
||
export const AcceptTermsAndConditionsScreen: React.FC = () => { | ||
const styles = useStyles() | ||
|
||
const navigation = | ||
useNavigation<StackNavigationProp<RootStackParamList, "acceptTermsAndConditions">>() | ||
|
||
const { LL } = useI18nContext() | ||
|
||
const route = useRoute<RouteProp<RootStackParamList, "acceptTermsAndConditions">>() | ||
const { flow } = route.params || { flow: "phone" } | ||
|
||
const [confirmationModalVisible, setConfirmationModalVisible] = React.useState(false) | ||
const openConfirmationModal = () => setConfirmationModalVisible(true) | ||
const closeConfirmationModal = () => { | ||
setConfirmationModalVisible(false) | ||
} | ||
|
||
const action = () => { | ||
if (flow === "phone") { | ||
navigation.navigate("phoneFlow", { | ||
screen: "phoneLoginInitiate", | ||
params: { | ||
type: PhoneLoginInitiateType.CreateAccount, | ||
}, | ||
}) | ||
} else if (flow === "trial") { | ||
openConfirmationModal() | ||
} else { | ||
Alert.alert("unknown flow") | ||
} | ||
} | ||
|
||
return ( | ||
<Screen | ||
preset="scroll" | ||
style={styles.screenStyle} | ||
keyboardOffset="navigationHeader" | ||
keyboardShouldPersistTaps="handled" | ||
> | ||
<DeviceAccountModal | ||
isVisible={confirmationModalVisible} | ||
closeModal={closeConfirmationModal} | ||
/> | ||
<View style={styles.viewWrapper}> | ||
<View style={styles.textContainer}> | ||
<Text type={"p1"}>{LL.AcceptTermsAndConditionsScreen.text()}</Text> | ||
</View> | ||
|
||
<View style={styles.textContainer}> | ||
<GaloySecondaryButton | ||
title={LL.AcceptTermsAndConditionsScreen.termsAndConditions()} | ||
onPress={() => InAppBrowser.open("https://www.blink.sv/en/terms-conditions")} | ||
/> | ||
</View> | ||
<View style={styles.textContainer}> | ||
<GaloySecondaryButton | ||
title={LL.AcceptTermsAndConditionsScreen.prohibitedCountry()} | ||
onPress={() => | ||
InAppBrowser.open( | ||
"https://faq.blink.sv/creating-a-blink-account/which-countries-are-unable-to-download-and-activate-blink", | ||
) | ||
} | ||
/> | ||
</View> | ||
|
||
<View style={styles.buttonsContainer}> | ||
<GaloyPrimaryButton | ||
title={LL.AcceptTermsAndConditionsScreen.accept()} | ||
onPress={action} | ||
/> | ||
</View> | ||
</View> | ||
</Screen> | ||
) | ||
} | ||
|
||
const useStyles = makeStyles(({ colors }) => ({ | ||
screenStyle: { | ||
padding: 20, | ||
flexGrow: 1, | ||
}, | ||
buttonsContainer: { | ||
flex: 1, | ||
justifyContent: "flex-end", | ||
}, | ||
|
||
inputContainer: { | ||
marginBottom: 20, | ||
flexDirection: "row", | ||
alignItems: "stretch", | ||
minHeight: 48, | ||
}, | ||
textContainer: { | ||
marginBottom: 20, | ||
}, | ||
viewWrapper: { flex: 1 }, | ||
|
||
inputContainerStyle: { | ||
flex: 1, | ||
borderWidth: 2, | ||
borderBottomWidth: 2, | ||
paddingHorizontal: 10, | ||
borderColor: colors.primary5, | ||
borderRadius: 8, | ||
}, | ||
errorContainer: { | ||
marginBottom: 20, | ||
}, | ||
})) |
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 @@ | ||
export * from "./accept-t-and-c" |
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
Oops, something went wrong.