From b22b6f05f17c6eb8756228c3d97445adf8516b3a Mon Sep 17 00:00:00 2001 From: ShivaniKhaire Date: Mon, 5 Oct 2026 14:26:52 +0530 Subject: [PATCH 1/3] fix(subscription): redirect back navigation to modules library after unlock (#12) --- app.json | 5 ++++- src/app/subscription/index.tsx | 29 ++++++++++++++++++++++++++++- 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/app.json b/app.json index 282b9d1..b9e1873 100644 --- a/app.json +++ b/app.json @@ -5,7 +5,10 @@ "version": "1.0.0", "orientation": "portrait", "icon": "./assets/images/icon.png", - "scheme": "myapp", + "scheme": [ + "myapp", + "acupedia" + ], "userInterfaceStyle": "automatic", "ios": { "bundleIdentifier": "com.renownent.mobile.acupedia", diff --git a/src/app/subscription/index.tsx b/src/app/subscription/index.tsx index 3e90f1e..17d885c 100644 --- a/src/app/subscription/index.tsx +++ b/src/app/subscription/index.tsx @@ -1,6 +1,7 @@ import React, { useCallback, useMemo, useState } from "react"; import { Alert, + BackHandler, Linking, Platform, ScrollView, @@ -81,6 +82,30 @@ export default function SubscriptionScreen() { }, [accessToken, refreshAccess]), ); + const handleBack = useCallback(() => { + if (unlocked) { + router.replace("/modules"); + return true; + } + if (router.canGoBack()) { + router.back(); + } else { + router.replace("/modules"); + } + return true; + }, [unlocked]); + + useFocusEffect( + useCallback(() => { + const onBackPress = () => handleBack(); + const subscription = BackHandler.addEventListener( + "hardwareBackPress", + onBackPress + ); + return () => subscription.remove(); + }, [handleBack]) + ); + const showAlert = (alertTitle: string, message: string, onConfirm?: () => void) => { if (Platform.OS === "web") { alert(`${alertTitle}\n\n${message}`); @@ -132,9 +157,11 @@ export default function SubscriptionScreen() { router.back()} + onPress={handleBack} style={styles.backButton} hitSlop={{ top: 12, bottom: 12, left: 12, right: 12 }} + accessibilityRole="button" + accessibilityLabel="Go back" > -- 2.34.1 From f3c3a3e8acd8559ebe2d3a3f51a4014f64fa442d Mon Sep 17 00:00:00 2001 From: ShivaniKhaire Date: Mon, 5 Oct 2026 14:38:32 +0530 Subject: [PATCH 2/3] refactor(subscription): make return route and deep link parameters completely generic and dynamic (#12) --- src/app/subscription/index.tsx | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/app/subscription/index.tsx b/src/app/subscription/index.tsx index 17d885c..674dd3d 100644 --- a/src/app/subscription/index.tsx +++ b/src/app/subscription/index.tsx @@ -54,6 +54,8 @@ function resolveStorefrontUrl(): string { return "http://localhost:3000"; } +const DEFAULT_RETURN_ROUTE = "/modules"; + export default function SubscriptionScreen() { const params = useLocalSearchParams(); const accessToken = useAuthStore((state) => state.accessToken); @@ -65,6 +67,7 @@ export default function SubscriptionScreen() { const title = param(params.title) || "Clinical Module"; const description = param(params.desc); const planCode = param(params.planCode).trim().toUpperCase(); + const returnRoute = param(params.returnRoute) || param(params.returnTo) || DEFAULT_RETURN_ROUTE; const [openingCheckout, setOpeningCheckout] = useState(false); @@ -84,16 +87,16 @@ export default function SubscriptionScreen() { const handleBack = useCallback(() => { if (unlocked) { - router.replace("/modules"); + router.replace(returnRoute as never); return true; } if (router.canGoBack()) { router.back(); } else { - router.replace("/modules"); + router.replace(returnRoute as never); } return true; - }, [unlocked]); + }, [unlocked, returnRoute]); useFocusEffect( useCallback(() => { @@ -139,6 +142,13 @@ export default function SubscriptionScreen() { if (apiUrl) query.set("apiUrl", apiUrl); if (moduleId) query.set("moduleId", moduleId); if (moduleCode) query.set("moduleCode", moduleCode); + const returnRouteClean = returnRoute.replace(/^\/+/, ""); + if (returnRouteClean) query.set("returnRoute", returnRouteClean); + + const appScheme = Array.isArray(Constants.expoConfig?.scheme) + ? Constants.expoConfig?.scheme[0] + : Constants.expoConfig?.scheme; + if (appScheme) query.set("scheme", appScheme); const checkoutUrl = `${storefrontUrl}?${query.toString()}`; showAlert( @@ -206,7 +216,7 @@ export default function SubscriptionScreen() { ) : ( router.replace("/modules")} + onPress={() => router.replace(returnRoute as never)} /> )} -- 2.34.1 From 8e56d5eb4f96fa7b6bfef379502188a60d6936d0 Mon Sep 17 00:00:00 2001 From: ShivaniKhaire Date: Tue, 6 Oct 2026 11:05:47 +0530 Subject: [PATCH 3/3] fix(scheme): use acupedia as url scheme in app.json (#12) --- app.json | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/app.json b/app.json index b9e1873..ae71c0e 100644 --- a/app.json +++ b/app.json @@ -5,10 +5,7 @@ "version": "1.0.0", "orientation": "portrait", "icon": "./assets/images/icon.png", - "scheme": [ - "myapp", - "acupedia" - ], + "scheme": "acupedia", "userInterfaceStyle": "automatic", "ios": { "bundleIdentifier": "com.renownent.mobile.acupedia", -- 2.34.1