Skip to content

Commit 868faa5

Browse files
YoanRosarnaudambro
YoanRos
authored andcommitted
fix: handle frequency and closing
1 parent f0c43cf commit 868faa5

File tree

2 files changed

+21
-10
lines changed

2 files changed

+21
-10
lines changed

expo/src/Router.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,11 @@ const Router = () => {
280280
onReady={() => {
281281
API.navigation = navigationRef.current;
282282
if (alreadyExported) navigationRef.current.navigate("MODAL_EXPORT_DONE");
283-
else navigationRef.current.navigate("MODAL_CLOSE_APP");
283+
const lastShownEndModal = storage.getString("@lastShownEndModal");
284+
if (!lastShownEndModal || dayjsInstance().diff(lastShownEndModal, "day") >= 5) {
285+
storage.set("@lastShownEndModal", dayjsInstance().format("YYYY-MM-DD"));
286+
navigationRef.current.navigate("MODAL_CLOSE_APP");
287+
}
284288
}}
285289
onStateChange={onNavigationStateChange}
286290
linking={deepLinkingConfig}

expo/src/scenes/WelcomeScreen/EndOzModal.js

+16-9
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@ const EndOzModal = ({ navigation }) => {
1212
const [currentPage, setCurrentPage] = useState(0);
1313
const pagerRef = useRef(null);
1414

15-
const onStartPress = async () => {
16-
storage.set("@OnboardingDoneWithCGU", true);
17-
navigation.navigate("USER_SURVEY_START", { from: "NEW_USER" });
18-
};
19-
2015
const onPressNext = () => {
2116
if (pagerRef.current) {
22-
pagerRef.current.setPage(currentPage + 1);
23-
setCurrentPage(currentPage + 1);
17+
if (currentPage === 3) {
18+
navigation.goBack();
19+
} else {
20+
pagerRef.current.setPage(currentPage + 1);
21+
22+
setCurrentPage(currentPage + 1);
23+
}
2424
} else {
2525
console.warn("Pager ref is not defined");
2626
}
@@ -40,7 +40,12 @@ const EndOzModal = ({ navigation }) => {
4040
<SafeAreaView className="flex-1 justify-center items-center">
4141
<View className="bg-white rounded-xl w-[90%] h-[70%]">
4242
<View className="h-5 flex flex-row justify-end p-3">
43-
<TouchableOpacity hitSlop={hitSlop(15)} onPress={() => {}}>
43+
<TouchableOpacity
44+
hitSlop={hitSlop(15)}
45+
onPress={() => {
46+
navigation.goBack();
47+
}}
48+
>
4449
<Svg fill="none" viewBox="0 0 24 24" className="h-5 w-5">
4550
<Path
4651
strokeLinecap="round"
@@ -79,7 +84,9 @@ const EndOzModal = ({ navigation }) => {
7984
onPress={onPressNext}
8085
className="justify-center items-center flex-row rounded-3xl bg-[#DE285E] px-6 py-3"
8186
>
82-
<Text className="font-bold text-white text-center text-base">Suivant</Text>
87+
<Text className="font-bold text-white text-center text-base">
88+
{currentPage === 3 ? "Terminer" : "Suivant"}
89+
</Text>
8390
</TouchableOpacity>
8491
</View>
8592
</View>

0 commit comments

Comments
 (0)