Compare commits
No commits in common. "35dd4710100d3e4d97688c2b141aa1a79a852fbc" and "82d0b54b93148ce86b08f546e8a78f654dadfe21" have entirely different histories.
35dd471010
...
82d0b54b93
2
app.json
2
app.json
|
|
@ -5,7 +5,7 @@
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"orientation": "portrait",
|
"orientation": "portrait",
|
||||||
"icon": "./assets/images/icon.png",
|
"icon": "./assets/images/icon.png",
|
||||||
"scheme": "acupedia",
|
"scheme": "myapp",
|
||||||
"userInterfaceStyle": "automatic",
|
"userInterfaceStyle": "automatic",
|
||||||
"ios": {
|
"ios": {
|
||||||
"bundleIdentifier": "com.renownent.mobile.acupedia",
|
"bundleIdentifier": "com.renownent.mobile.acupedia",
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
import React, { useCallback, useMemo, useState } from "react";
|
import React, { useCallback, useMemo, useState } from "react";
|
||||||
import {
|
import {
|
||||||
Alert,
|
Alert,
|
||||||
BackHandler,
|
|
||||||
Linking,
|
Linking,
|
||||||
Platform,
|
Platform,
|
||||||
ScrollView,
|
ScrollView,
|
||||||
|
|
@ -54,8 +53,6 @@ function resolveStorefrontUrl(): string {
|
||||||
return "http://localhost:3000";
|
return "http://localhost:3000";
|
||||||
}
|
}
|
||||||
|
|
||||||
const DEFAULT_RETURN_ROUTE = "/modules";
|
|
||||||
|
|
||||||
export default function SubscriptionScreen() {
|
export default function SubscriptionScreen() {
|
||||||
const params = useLocalSearchParams();
|
const params = useLocalSearchParams();
|
||||||
const accessToken = useAuthStore((state) => state.accessToken);
|
const accessToken = useAuthStore((state) => state.accessToken);
|
||||||
|
|
@ -67,7 +64,6 @@ export default function SubscriptionScreen() {
|
||||||
const title = param(params.title) || "Clinical Module";
|
const title = param(params.title) || "Clinical Module";
|
||||||
const description = param(params.desc);
|
const description = param(params.desc);
|
||||||
const planCode = param(params.planCode).trim().toUpperCase();
|
const planCode = param(params.planCode).trim().toUpperCase();
|
||||||
const returnRoute = param(params.returnRoute) || param(params.returnTo) || DEFAULT_RETURN_ROUTE;
|
|
||||||
|
|
||||||
const [openingCheckout, setOpeningCheckout] = useState(false);
|
const [openingCheckout, setOpeningCheckout] = useState(false);
|
||||||
|
|
||||||
|
|
@ -85,30 +81,6 @@ export default function SubscriptionScreen() {
|
||||||
}, [accessToken, refreshAccess]),
|
}, [accessToken, refreshAccess]),
|
||||||
);
|
);
|
||||||
|
|
||||||
const handleBack = useCallback(() => {
|
|
||||||
if (unlocked) {
|
|
||||||
router.replace(returnRoute as never);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (router.canGoBack()) {
|
|
||||||
router.back();
|
|
||||||
} else {
|
|
||||||
router.replace(returnRoute as never);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}, [unlocked, returnRoute]);
|
|
||||||
|
|
||||||
useFocusEffect(
|
|
||||||
useCallback(() => {
|
|
||||||
const onBackPress = () => handleBack();
|
|
||||||
const subscription = BackHandler.addEventListener(
|
|
||||||
"hardwareBackPress",
|
|
||||||
onBackPress
|
|
||||||
);
|
|
||||||
return () => subscription.remove();
|
|
||||||
}, [handleBack])
|
|
||||||
);
|
|
||||||
|
|
||||||
const showAlert = (alertTitle: string, message: string, onConfirm?: () => void) => {
|
const showAlert = (alertTitle: string, message: string, onConfirm?: () => void) => {
|
||||||
if (Platform.OS === "web") {
|
if (Platform.OS === "web") {
|
||||||
alert(`${alertTitle}\n\n${message}`);
|
alert(`${alertTitle}\n\n${message}`);
|
||||||
|
|
@ -142,13 +114,6 @@ export default function SubscriptionScreen() {
|
||||||
if (apiUrl) query.set("apiUrl", apiUrl);
|
if (apiUrl) query.set("apiUrl", apiUrl);
|
||||||
if (moduleId) query.set("moduleId", moduleId);
|
if (moduleId) query.set("moduleId", moduleId);
|
||||||
if (moduleCode) query.set("moduleCode", moduleCode);
|
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()}`;
|
const checkoutUrl = `${storefrontUrl}?${query.toString()}`;
|
||||||
showAlert(
|
showAlert(
|
||||||
|
|
@ -167,11 +132,9 @@ export default function SubscriptionScreen() {
|
||||||
<SafeAreaView style={styles.safeArea} edges={["top", "bottom", "left", "right"]}>
|
<SafeAreaView style={styles.safeArea} edges={["top", "bottom", "left", "right"]}>
|
||||||
<View style={styles.header}>
|
<View style={styles.header}>
|
||||||
<TouchableOpacity
|
<TouchableOpacity
|
||||||
onPress={handleBack}
|
onPress={() => router.back()}
|
||||||
style={styles.backButton}
|
style={styles.backButton}
|
||||||
hitSlop={{ top: 12, bottom: 12, left: 12, right: 12 }}
|
hitSlop={{ top: 12, bottom: 12, left: 12, right: 12 }}
|
||||||
accessibilityRole="button"
|
|
||||||
accessibilityLabel="Go back"
|
|
||||||
>
|
>
|
||||||
<Ionicons name="chevron-back" size={24} color={Colors.textPrimary} />
|
<Ionicons name="chevron-back" size={24} color={Colors.textPrimary} />
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
|
|
@ -216,7 +179,7 @@ export default function SubscriptionScreen() {
|
||||||
) : (
|
) : (
|
||||||
<PrimaryButton
|
<PrimaryButton
|
||||||
title="Back to Modules"
|
title="Back to Modules"
|
||||||
onPress={() => router.replace(returnRoute as never)}
|
onPress={() => router.replace("/modules")}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</View>
|
</View>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue