create-disposabl-app 0.20.17 → 0.20.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/disposabl.js +1 -1
- package/dist/index.js +3 -1
- package/dist/templates/default/.github/scripts/release.sh +33 -5
- package/dist/templates/default/.github/workflows/pipeline.yml +1 -1
- package/dist/templates/default/apps/docs/content/mobile.mdx +2 -0
- package/dist/templates/default/apps/docs/content/publishing/apple.mdx +12 -0
- package/dist/templates/default/apps/docs/content/publishing/google-play.mdx +12 -0
- package/dist/templates/default/apps/docs/content/publishing/index.mdx +23 -0
- package/dist/templates/default/apps/mobile/package.json +1 -0
- package/dist/templates/default/apps/mobile/scripts/android-release-verify.mjs +51 -6
- package/dist/templates/default/apps/mobile/scripts/play-aab.mjs +4 -0
- package/dist/templates/default/apps/mobile/scripts/verify-play-aab.mjs +48 -0
- package/dist/templates/default/bun.lock +8 -0
- package/dist/templates/default/packages/disposabl-kit/PAYMENTS.md +2 -0
- package/dist/templates/default/packages/disposabl-kit/client/components/cookie-consent.tsx +117 -0
- package/dist/templates/default/packages/disposabl-kit/client/components/legal-page.tsx +15 -0
- package/dist/templates/default/packages/disposabl-kit/client/styles/cookie-consent.css +54 -0
- package/dist/templates/default/packages/disposabl-kit/mobile/billing/account-billing.tsx +168 -99
- package/dist/templates/default/packages/disposabl-kit/mobile/components/auth-ui.tsx +9 -21
- package/dist/templates/default/packages/disposabl-kit/mobile/components/settings-page.tsx +52 -20
- package/dist/templates/default/packages/disposabl-kit/mobile/layout.tsx +13 -4
- package/dist/templates/default/packages/disposabl-kit/package.json +7 -2
- package/dist/templates/default/packages/disposabl-kit/server/billing-functions.ts +15 -3
- package/dist/templates/default/packages/disposabl-kit/server/billing-native-capability.ts +33 -6
- package/dist/templates/default/packages/disposabl-kit/server/billing.ts +11 -3
- package/dist/templates/default/packages/tests/billing.test.ts +22 -0
- package/dist/templates/default/packages/tests/components/mobile-account-billing.test.mjs +149 -0
- package/dist/templates/default/packages/tests/ios-ota.test.ts +13 -10
- package/dist/templates/default/packages/tests/mobile-account-billing.test.ts +19 -0
- package/dist/templates/default/packages/tests/native-billing.test.ts +71 -0
- package/dist/templates/default/packages/tests/package-release.test.ts +37 -5
- package/package.json +1 -1
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { createContext, useEffect, useRef } from "react";
|
|
4
|
+
import * as CookieConsent from "vanilla-cookieconsent";
|
|
5
|
+
import "../styles/cookie-consent.css";
|
|
6
|
+
|
|
7
|
+
export const CookiePreferencesContext = createContext(false);
|
|
8
|
+
|
|
9
|
+
// Serialize async setup and teardown, including React StrictMode.
|
|
10
|
+
let lifecycle = Promise.resolve();
|
|
11
|
+
|
|
12
|
+
export function CookieConsentBanner({
|
|
13
|
+
onAnalyticsChange,
|
|
14
|
+
onInvalidate,
|
|
15
|
+
}: {
|
|
16
|
+
onAnalyticsChange: (allowed: boolean) => void;
|
|
17
|
+
onInvalidate: () => void;
|
|
18
|
+
}) {
|
|
19
|
+
const root = useRef<HTMLDivElement>(null);
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
let cancelled = false;
|
|
22
|
+
const isCancelled = () => cancelled;
|
|
23
|
+
let started = false;
|
|
24
|
+
const container = root.current;
|
|
25
|
+
const update = () => onAnalyticsChange(acceptedCookieCategory("analytics"));
|
|
26
|
+
lifecycle = lifecycle
|
|
27
|
+
.then(async () => {
|
|
28
|
+
if (isCancelled() || !container) return;
|
|
29
|
+
started = true;
|
|
30
|
+
await CookieConsent.run({
|
|
31
|
+
root: container,
|
|
32
|
+
mode: "opt-in",
|
|
33
|
+
hideFromBots: false,
|
|
34
|
+
cookie: {
|
|
35
|
+
name: "disposabl_cookie_consent_v1",
|
|
36
|
+
expiresAfterDays: 182,
|
|
37
|
+
sameSite: "Lax",
|
|
38
|
+
useLocalStorage: true,
|
|
39
|
+
},
|
|
40
|
+
categories: {
|
|
41
|
+
necessary: { enabled: true, readOnly: true },
|
|
42
|
+
analytics: { enabled: false },
|
|
43
|
+
},
|
|
44
|
+
language: {
|
|
45
|
+
default: "en",
|
|
46
|
+
translations: {
|
|
47
|
+
en: {
|
|
48
|
+
consentModal: {
|
|
49
|
+
title: "Cookie preferences",
|
|
50
|
+
description:
|
|
51
|
+
"We use necessary cookies and, with your permission, analytics to improve Disposabl.",
|
|
52
|
+
acceptAllBtn: "Accept all",
|
|
53
|
+
acceptNecessaryBtn: "Reject analytics",
|
|
54
|
+
showPreferencesBtn: "Preferences",
|
|
55
|
+
},
|
|
56
|
+
preferencesModal: {
|
|
57
|
+
title: "Cookie preferences",
|
|
58
|
+
acceptAllBtn: "Accept all",
|
|
59
|
+
acceptNecessaryBtn: "Reject analytics",
|
|
60
|
+
savePreferencesBtn: "Save preferences",
|
|
61
|
+
closeIconLabel: "Close",
|
|
62
|
+
sections: [
|
|
63
|
+
{
|
|
64
|
+
title: "Necessary",
|
|
65
|
+
description:
|
|
66
|
+
"Required for sign-in and saved preferences.",
|
|
67
|
+
linkedCategory: "necessary",
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
title: "Analytics",
|
|
71
|
+
description:
|
|
72
|
+
"Optional usage information helps improve Disposabl.",
|
|
73
|
+
linkedCategory: "analytics",
|
|
74
|
+
},
|
|
75
|
+
],
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
onConsent: update,
|
|
81
|
+
onChange: update,
|
|
82
|
+
});
|
|
83
|
+
if (!isCancelled()) update();
|
|
84
|
+
})
|
|
85
|
+
.catch((error) => {
|
|
86
|
+
console.error("Cookie preferences unavailable", error);
|
|
87
|
+
onAnalyticsChange(false);
|
|
88
|
+
});
|
|
89
|
+
return () => {
|
|
90
|
+
cancelled = true;
|
|
91
|
+
onInvalidate();
|
|
92
|
+
lifecycle = lifecycle.then(() => {
|
|
93
|
+
if (started) CookieConsent.reset(false);
|
|
94
|
+
});
|
|
95
|
+
};
|
|
96
|
+
}, [onAnalyticsChange, onInvalidate]);
|
|
97
|
+
return <div ref={root} className="cookie-consent" />;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export function showCookiePreferences() {
|
|
101
|
+
CookieConsent.showPreferences();
|
|
102
|
+
}
|
|
103
|
+
export function acceptedCookieCategory(category: string) {
|
|
104
|
+
try {
|
|
105
|
+
const value = JSON.parse(
|
|
106
|
+
localStorage.getItem("disposabl_cookie_consent_v1") ?? "null",
|
|
107
|
+
);
|
|
108
|
+
return (
|
|
109
|
+
Number.isFinite(value?.expirationTime) &&
|
|
110
|
+
value.expirationTime > Date.now() &&
|
|
111
|
+
CookieConsent.validConsent() &&
|
|
112
|
+
CookieConsent.acceptedCategory(category)
|
|
113
|
+
);
|
|
114
|
+
} catch {
|
|
115
|
+
return false;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
import { useContext } from "react";
|
|
2
|
+
import {
|
|
3
|
+
CookiePreferencesContext,
|
|
4
|
+
showCookiePreferences,
|
|
5
|
+
} from "./cookie-consent";
|
|
1
6
|
import { legalConfig, legalDocuments, legalIsDraft } from "../../legal";
|
|
2
7
|
import type { ReactNode } from "react";
|
|
3
8
|
|
|
@@ -108,11 +113,21 @@ export function LegalPage({
|
|
|
108
113
|
}
|
|
109
114
|
|
|
110
115
|
export function LegalFooter() {
|
|
116
|
+
const cookiePreferences = useContext(CookiePreferencesContext);
|
|
111
117
|
return (
|
|
112
118
|
<footer
|
|
113
119
|
className="mx-auto flex max-w-5xl flex-wrap justify-center gap-x-6 gap-y-2 px-6 py-8 text-xs text-muted-foreground"
|
|
114
120
|
aria-label="Legal"
|
|
115
121
|
>
|
|
122
|
+
{cookiePreferences && (
|
|
123
|
+
<button
|
|
124
|
+
type="button"
|
|
125
|
+
onClick={showCookiePreferences}
|
|
126
|
+
className="underline underline-offset-4"
|
|
127
|
+
>
|
|
128
|
+
Cookie preferences
|
|
129
|
+
</button>
|
|
130
|
+
)}
|
|
116
131
|
<a href="/legal/privacy" className="hover:underline">
|
|
117
132
|
Privacy
|
|
118
133
|
</a>
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
@import "vanilla-cookieconsent/dist/cookieconsent.css";
|
|
2
|
+
|
|
3
|
+
.cookie-consent #cc-main {
|
|
4
|
+
--cc-font-family: var(--font-sans, inherit);
|
|
5
|
+
--cc-modal-border-radius: var(--radius);
|
|
6
|
+
--cc-btn-border-radius: calc(var(--radius) * 0.8);
|
|
7
|
+
--cc-bg: var(--popover);
|
|
8
|
+
--cc-primary-color: var(--popover-foreground);
|
|
9
|
+
--cc-secondary-color: var(--muted-foreground);
|
|
10
|
+
--cc-link-color: var(--foreground);
|
|
11
|
+
--cc-btn-primary-bg: var(--primary);
|
|
12
|
+
--cc-btn-primary-color: var(--primary-foreground);
|
|
13
|
+
--cc-btn-primary-border-color: var(--primary);
|
|
14
|
+
--cc-btn-primary-hover-bg: color-mix(
|
|
15
|
+
in oklab,
|
|
16
|
+
var(--primary) 90%,
|
|
17
|
+
transparent
|
|
18
|
+
);
|
|
19
|
+
--cc-btn-primary-hover-color: var(--primary-foreground);
|
|
20
|
+
--cc-btn-primary-hover-border-color: var(--primary);
|
|
21
|
+
--cc-btn-secondary-bg: var(--secondary);
|
|
22
|
+
--cc-btn-secondary-color: var(--secondary-foreground);
|
|
23
|
+
--cc-btn-secondary-border-color: var(--border);
|
|
24
|
+
--cc-btn-secondary-hover-bg: var(--accent);
|
|
25
|
+
--cc-btn-secondary-hover-color: var(--accent-foreground);
|
|
26
|
+
--cc-btn-secondary-hover-border-color: var(--border);
|
|
27
|
+
--cc-separator-border-color: var(--border);
|
|
28
|
+
--cc-section-category-border: var(--border);
|
|
29
|
+
--cc-webkit-scrollbar-bg: var(--muted);
|
|
30
|
+
--cc-webkit-scrollbar-hover-bg: var(--accent);
|
|
31
|
+
--cc-toggle-enabled-icon-color: var(--primary-foreground);
|
|
32
|
+
--cc-toggle-disabled-icon-color: var(--foreground);
|
|
33
|
+
--cc-toggle-on-bg: var(--primary);
|
|
34
|
+
--cc-toggle-off-bg: var(--muted-foreground);
|
|
35
|
+
--cc-toggle-on-knob-bg: var(--primary-foreground);
|
|
36
|
+
--cc-toggle-off-knob-bg: var(--background);
|
|
37
|
+
--cc-toggle-readonly-bg: var(--muted);
|
|
38
|
+
--cc-toggle-readonly-knob-bg: var(--background);
|
|
39
|
+
--cc-toggle-readonly-knob-icon-color: var(--muted-foreground);
|
|
40
|
+
--cc-cookie-category-block-bg: var(--muted);
|
|
41
|
+
--cc-cookie-category-block-border: var(--border);
|
|
42
|
+
--cc-cookie-category-block-hover-bg: var(--accent);
|
|
43
|
+
--cc-cookie-category-block-hover-border: var(--border);
|
|
44
|
+
--cc-cookie-category-expanded-block-hover-bg: var(--accent);
|
|
45
|
+
--cc-footer-bg: var(--muted);
|
|
46
|
+
--cc-footer-color: var(--muted-foreground);
|
|
47
|
+
--cc-footer-border-color: var(--border);
|
|
48
|
+
--cc-overlay-bg: rgb(0 0 0 / 50%);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.cookie-consent #cc-main :is(button, a, input):focus-visible {
|
|
52
|
+
outline: 2px solid var(--ring);
|
|
53
|
+
outline-offset: 2px;
|
|
54
|
+
}
|
|
@@ -1,16 +1,22 @@
|
|
|
1
1
|
import { useAction } from "convex/react";
|
|
2
2
|
import { makeFunctionReference } from "convex/server";
|
|
3
3
|
import { useCallback, useEffect, useRef, useState } from "react";
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
AppState,
|
|
6
|
+
Linking,
|
|
7
|
+
Platform,
|
|
8
|
+
Pressable,
|
|
9
|
+
Text,
|
|
10
|
+
View,
|
|
11
|
+
} from "react-native";
|
|
5
12
|
import type { PurchasesPackage } from "react-native-purchases";
|
|
6
|
-
import { AuthButton, authClasses } from "../components/auth-ui";
|
|
7
13
|
import { billingSession } from "./session";
|
|
8
14
|
import {
|
|
9
15
|
monthlyOfferingId,
|
|
10
16
|
presentMonthlyPaywall,
|
|
11
17
|
selectMonthlyOffering,
|
|
12
18
|
} from "./paywall";
|
|
13
|
-
import { creditQuantity
|
|
19
|
+
import { creditQuantity } from "../../payments/config";
|
|
14
20
|
import { paymentOptions, storeEligibility } from "./policy";
|
|
15
21
|
import { useWebCheckout } from "./web-checkout";
|
|
16
22
|
import { useTopup } from "./use-topup";
|
|
@@ -63,10 +69,19 @@ export function AccountBilling({ customerId }: { customerId: string }) {
|
|
|
63
69
|
const latest = () =>
|
|
64
70
|
current(version) && sequence === refreshSequence.current;
|
|
65
71
|
if (latest()) setMonthly(null);
|
|
72
|
+
let result: Snapshot;
|
|
73
|
+
try {
|
|
74
|
+
result = await getSnapshot({});
|
|
75
|
+
} catch {
|
|
76
|
+
if (latest()) {
|
|
77
|
+
setData(null);
|
|
78
|
+
setRefreshError("Billing could not refresh. Please try again.");
|
|
79
|
+
}
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
if (!latest()) return;
|
|
83
|
+
setData(result);
|
|
66
84
|
try {
|
|
67
|
-
const result = await getSnapshot({});
|
|
68
|
-
if (!latest()) return;
|
|
69
|
-
setData(result);
|
|
70
85
|
if (key && productId && result.nativeSubscriptionsEnabled) {
|
|
71
86
|
const store = await billingSession.run(
|
|
72
87
|
customerId,
|
|
@@ -97,8 +112,8 @@ export function AccountBilling({ customerId }: { customerId: string }) {
|
|
|
97
112
|
if (latest()) setRefreshError("");
|
|
98
113
|
} catch {
|
|
99
114
|
if (latest()) {
|
|
100
|
-
|
|
101
|
-
setRefreshError("
|
|
115
|
+
setMonthly(null);
|
|
116
|
+
setRefreshError("Store unavailable. Please try again.");
|
|
102
117
|
}
|
|
103
118
|
}
|
|
104
119
|
},
|
|
@@ -210,121 +225,175 @@ export function AccountBilling({ customerId }: { customerId: string }) {
|
|
|
210
225
|
}
|
|
211
226
|
}
|
|
212
227
|
|
|
228
|
+
const disabled = busy || web.busy || topup.busy;
|
|
229
|
+
const openManagement = (url: string) => {
|
|
230
|
+
void Linking.openURL(url).catch(() =>
|
|
231
|
+
setMessage("Could not open subscription settings."),
|
|
232
|
+
);
|
|
233
|
+
};
|
|
234
|
+
|
|
213
235
|
return (
|
|
214
|
-
<View className=
|
|
215
|
-
<
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
236
|
+
<View className="gap-4">
|
|
237
|
+
<View>
|
|
238
|
+
<Text className="text-[13px] font-medium text-muted-foreground">
|
|
239
|
+
Available
|
|
240
|
+
</Text>
|
|
241
|
+
<Text className="text-[28px] font-bold tracking-[-0.5px] text-foreground">
|
|
242
|
+
{data?.balance == null
|
|
243
|
+
? "Unavailable"
|
|
244
|
+
: `${new Intl.NumberFormat().format(data.balance)} credits`}
|
|
245
|
+
</Text>
|
|
246
|
+
</View>
|
|
223
247
|
{data?.hasMonthlyPlan && (
|
|
224
|
-
<Text className=
|
|
225
|
-
|
|
248
|
+
<Text className="text-[14px] text-muted-foreground">
|
|
249
|
+
Monthly plan active or scheduled.
|
|
226
250
|
</Text>
|
|
227
251
|
)}
|
|
228
252
|
{data?.monthlyCheckoutPending && (
|
|
229
|
-
<Text className=
|
|
230
|
-
Finish or cancel your website checkout
|
|
253
|
+
<Text className="text-[14px] text-muted-foreground">
|
|
254
|
+
Finish or cancel your website checkout first.
|
|
231
255
|
</Text>
|
|
232
256
|
)}
|
|
233
257
|
{monthly ? (
|
|
234
|
-
<
|
|
235
|
-
|
|
258
|
+
<Pressable
|
|
259
|
+
accessibilityRole="button"
|
|
260
|
+
accessibilityState={{
|
|
261
|
+
disabled:
|
|
262
|
+
disabled ||
|
|
263
|
+
data?.hasMonthlyPlan !== false ||
|
|
264
|
+
data?.monthlyCheckoutPending !== false,
|
|
265
|
+
}}
|
|
236
266
|
disabled={
|
|
237
|
-
|
|
238
|
-
web.busy ||
|
|
239
|
-
topup.busy ||
|
|
267
|
+
disabled ||
|
|
240
268
|
data?.hasMonthlyPlan !== false ||
|
|
241
269
|
data?.monthlyCheckoutPending !== false
|
|
242
270
|
}
|
|
243
271
|
onPress={() => void transact(false)}
|
|
244
|
-
|
|
272
|
+
className={`rounded-[14px] bg-foreground p-4 active:opacity-60 ${disabled || data?.hasMonthlyPlan !== false || data?.monthlyCheckoutPending !== false ? "opacity-60" : ""}`}
|
|
273
|
+
>
|
|
274
|
+
<View className="flex-row items-center justify-between gap-2">
|
|
275
|
+
<Text className="text-[16px] font-semibold text-background">
|
|
276
|
+
{creditQuantity("monthly")} credits / month
|
|
277
|
+
</Text>
|
|
278
|
+
<Text className="text-[16px] font-semibold text-background">
|
|
279
|
+
{monthly.product.priceString} / mo
|
|
280
|
+
</Text>
|
|
281
|
+
</View>
|
|
282
|
+
<Text className="mt-1 text-[13px] text-background opacity-70">
|
|
283
|
+
Unused credits expire monthly
|
|
284
|
+
</Text>
|
|
285
|
+
</Pressable>
|
|
245
286
|
) : (
|
|
246
|
-
<Text className=
|
|
247
|
-
Store subscriptions
|
|
287
|
+
<Text className="text-[14px] text-muted-foreground">
|
|
288
|
+
Store subscriptions unavailable.
|
|
248
289
|
</Text>
|
|
249
290
|
)}
|
|
250
|
-
{web.available && (
|
|
251
|
-
<AuthButton
|
|
252
|
-
title="Buy monthly on website"
|
|
253
|
-
disabled={busy || web.busy || topup.busy}
|
|
254
|
-
onPress={() => void web.open()}
|
|
255
|
-
/>
|
|
256
|
-
)}
|
|
257
291
|
{topup.product && (
|
|
258
|
-
<
|
|
259
|
-
|
|
260
|
-
|
|
292
|
+
<Pressable
|
|
293
|
+
accessibilityRole="button"
|
|
294
|
+
accessibilityState={{ disabled }}
|
|
295
|
+
disabled={disabled}
|
|
261
296
|
onPress={() => void topup.purchase()}
|
|
262
|
-
|
|
297
|
+
className={`rounded-[14px] border border-border px-4 py-3 active:opacity-60 ${disabled ? "opacity-60" : ""}`}
|
|
298
|
+
>
|
|
299
|
+
<View className="flex-row items-center justify-between gap-2">
|
|
300
|
+
<Text className="text-[16px] font-semibold text-foreground">
|
|
301
|
+
{creditQuantity("topup")} credits once
|
|
302
|
+
</Text>
|
|
303
|
+
<Text className="text-[16px] font-semibold text-foreground">
|
|
304
|
+
{topup.product.priceString}
|
|
305
|
+
</Text>
|
|
306
|
+
</View>
|
|
307
|
+
<Text className="mt-1 text-[13px] text-muted-foreground">
|
|
308
|
+
Never expires
|
|
309
|
+
</Text>
|
|
310
|
+
</Pressable>
|
|
263
311
|
)}
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
}}
|
|
282
|
-
/>
|
|
283
|
-
{!!key && data?.nativeSubscriptionsEnabled && (
|
|
284
|
-
<AuthButton
|
|
285
|
-
title="Restore purchases"
|
|
312
|
+
<View className="flex-row flex-wrap gap-x-5 gap-y-2">
|
|
313
|
+
{web.available && (
|
|
314
|
+
<BillingLink
|
|
315
|
+
title="Monthly on website"
|
|
316
|
+
disabled={disabled}
|
|
317
|
+
onPress={() => void web.open()}
|
|
318
|
+
/>
|
|
319
|
+
)}
|
|
320
|
+
{web.topupAvailable && (
|
|
321
|
+
<BillingLink
|
|
322
|
+
title="Top-up on website"
|
|
323
|
+
disabled={disabled}
|
|
324
|
+
onPress={() => void web.open("topup")}
|
|
325
|
+
/>
|
|
326
|
+
)}
|
|
327
|
+
<BillingLink
|
|
328
|
+
title="Refresh"
|
|
286
329
|
disabled={busy}
|
|
287
|
-
onPress={() => void
|
|
330
|
+
onPress={() => void refresh(generation.current)}
|
|
288
331
|
/>
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
332
|
+
{!!key && data?.nativeSubscriptionsEnabled && (
|
|
333
|
+
<BillingLink
|
|
334
|
+
title="Restore"
|
|
335
|
+
disabled={busy}
|
|
336
|
+
onPress={() => void transact(true)}
|
|
337
|
+
/>
|
|
338
|
+
)}
|
|
339
|
+
</View>
|
|
340
|
+
<Text className="text-[13px] leading-[18px] text-muted-foreground">
|
|
341
|
+
Manage or cancel where you subscribed:
|
|
294
342
|
</Text>
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
"
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
"Manage Google Play subscriptions",
|
|
302
|
-
"https://play.google.com/store/account/subscriptions",
|
|
303
|
-
],
|
|
304
|
-
].map(([title, url]) => (
|
|
305
|
-
<AuthButton
|
|
306
|
-
key={title}
|
|
307
|
-
title={title!}
|
|
308
|
-
onPress={() => {
|
|
309
|
-
void Linking.openURL(url!).catch(() =>
|
|
310
|
-
setMessage("Could not open subscription settings."),
|
|
311
|
-
);
|
|
312
|
-
}}
|
|
343
|
+
<View className="flex-row flex-wrap gap-x-5 gap-y-2">
|
|
344
|
+
<BillingLink
|
|
345
|
+
title="Apple"
|
|
346
|
+
onPress={() =>
|
|
347
|
+
openManagement("https://apps.apple.com/account/subscriptions")
|
|
348
|
+
}
|
|
313
349
|
/>
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
<Text accessibilityRole="alert" className={authClasses.body}>
|
|
325
|
-
{web.error}
|
|
350
|
+
<BillingLink
|
|
351
|
+
title="Google Play"
|
|
352
|
+
onPress={() =>
|
|
353
|
+
openManagement(
|
|
354
|
+
"https://play.google.com/store/account/subscriptions",
|
|
355
|
+
)
|
|
356
|
+
}
|
|
357
|
+
/>
|
|
358
|
+
<Text className="py-1 text-[13px] text-muted-foreground">
|
|
359
|
+
Website: pricing page
|
|
326
360
|
</Text>
|
|
327
|
-
|
|
361
|
+
</View>
|
|
362
|
+
{[topup.message, refreshError, message, web.error]
|
|
363
|
+
.filter(Boolean)
|
|
364
|
+
.map((text, index) => (
|
|
365
|
+
<Text
|
|
366
|
+
key={index}
|
|
367
|
+
accessibilityRole="alert"
|
|
368
|
+
className="text-[14px] leading-[20px] text-muted-foreground"
|
|
369
|
+
>
|
|
370
|
+
{text}
|
|
371
|
+
</Text>
|
|
372
|
+
))}
|
|
328
373
|
</View>
|
|
329
374
|
);
|
|
330
375
|
}
|
|
376
|
+
|
|
377
|
+
function BillingLink({
|
|
378
|
+
title,
|
|
379
|
+
onPress,
|
|
380
|
+
disabled = false,
|
|
381
|
+
}: {
|
|
382
|
+
title: string;
|
|
383
|
+
onPress: () => void;
|
|
384
|
+
disabled?: boolean;
|
|
385
|
+
}) {
|
|
386
|
+
return (
|
|
387
|
+
<Pressable
|
|
388
|
+
accessibilityRole="button"
|
|
389
|
+
accessibilityState={{ disabled }}
|
|
390
|
+
disabled={disabled}
|
|
391
|
+
onPress={onPress}
|
|
392
|
+
className={`py-1 active:opacity-60 ${disabled ? "opacity-60" : ""}`}
|
|
393
|
+
>
|
|
394
|
+
<Text className="text-[14px] font-semibold text-primary-text">
|
|
395
|
+
{title}
|
|
396
|
+
</Text>
|
|
397
|
+
</Pressable>
|
|
398
|
+
);
|
|
399
|
+
}
|
|
@@ -1,31 +1,19 @@
|
|
|
1
1
|
import type { PropsWithChildren } from "react";
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
KeyboardAvoidingView,
|
|
5
|
-
Platform,
|
|
6
|
-
Pressable,
|
|
7
|
-
ScrollView,
|
|
8
|
-
Text,
|
|
9
|
-
} from "react-native";
|
|
10
|
-
import { useHeaderHeight } from "expo-router/react-navigation";
|
|
2
|
+
import { ActivityIndicator, Pressable, Text } from "react-native";
|
|
3
|
+
import { KeyboardAwareScrollView } from "react-native-keyboard-controller";
|
|
11
4
|
import { useTheme } from "../design/use-theme";
|
|
12
5
|
|
|
13
6
|
export function AuthScreen({ children }: PropsWithChildren) {
|
|
14
|
-
const headerHeight = useHeaderHeight();
|
|
15
7
|
return (
|
|
16
|
-
<
|
|
8
|
+
<KeyboardAwareScrollView
|
|
17
9
|
className="flex-1 bg-background"
|
|
18
|
-
|
|
19
|
-
|
|
10
|
+
contentContainerClassName={authClasses.content}
|
|
11
|
+
bottomOffset={48}
|
|
12
|
+
keyboardShouldPersistTaps="handled"
|
|
13
|
+
keyboardDismissMode="none"
|
|
20
14
|
>
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
keyboardShouldPersistTaps="handled"
|
|
24
|
-
keyboardDismissMode="on-drag"
|
|
25
|
-
>
|
|
26
|
-
{children}
|
|
27
|
-
</ScrollView>
|
|
28
|
-
</KeyboardAvoidingView>
|
|
15
|
+
{children}
|
|
16
|
+
</KeyboardAwareScrollView>
|
|
29
17
|
);
|
|
30
18
|
}
|
|
31
19
|
|
|
@@ -1,38 +1,66 @@
|
|
|
1
1
|
import { VariableContextProvider } from "nativewind";
|
|
2
2
|
import { router, Stack } from "expo-router";
|
|
3
3
|
import type { ReactNode } from "react";
|
|
4
|
-
import { Pressable, ScrollView
|
|
4
|
+
import { Pressable, ScrollView } from "react-native";
|
|
5
5
|
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
|
6
|
-
import { usePreferenceColors } from "../design/preferences";
|
|
6
|
+
import { GlassIconButton, usePreferenceColors } from "../design/preferences";
|
|
7
|
+
import { useAccentColor } from "../design/theme-provider";
|
|
8
|
+
import { SymbolView } from "../design/nativewind";
|
|
7
9
|
|
|
8
10
|
export function ScreenCloseButton({
|
|
9
11
|
label,
|
|
10
12
|
onPress,
|
|
13
|
+
purpose = "close",
|
|
11
14
|
}: {
|
|
12
15
|
label: string;
|
|
13
16
|
onPress: () => void;
|
|
17
|
+
purpose?: "done" | "close";
|
|
14
18
|
}) {
|
|
19
|
+
const accent = useAccentColor();
|
|
20
|
+
const colors = usePreferenceColors();
|
|
21
|
+
const done = purpose === "done";
|
|
15
22
|
return process.env.EXPO_OS === "ios" ? (
|
|
16
|
-
|
|
17
|
-
<Stack.
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
23
|
+
<>
|
|
24
|
+
<Stack.Screen options={{ headerBackVisible: false }} />
|
|
25
|
+
<Stack.Toolbar placement="right">
|
|
26
|
+
<Stack.Toolbar.Button
|
|
27
|
+
accessibilityLabel={label}
|
|
28
|
+
icon={done ? "checkmark" : "xmark"}
|
|
29
|
+
tintColor={done ? accent : colors.text}
|
|
30
|
+
variant={done ? "prominent" : "plain"}
|
|
31
|
+
onPress={onPress}
|
|
32
|
+
/>
|
|
33
|
+
</Stack.Toolbar>
|
|
34
|
+
</>
|
|
21
35
|
) : (
|
|
22
36
|
<Stack.Screen
|
|
23
37
|
options={{
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
38
|
+
headerBackVisible: false,
|
|
39
|
+
headerRight: () =>
|
|
40
|
+
done ? (
|
|
41
|
+
<Pressable
|
|
42
|
+
accessibilityRole="button"
|
|
43
|
+
accessibilityLabel={label}
|
|
44
|
+
hitSlop={12}
|
|
45
|
+
onPress={onPress}
|
|
46
|
+
className="min-h-[44px] min-w-[44px] items-center justify-center"
|
|
47
|
+
>
|
|
48
|
+
<SymbolView
|
|
49
|
+
name={{
|
|
50
|
+
ios: done ? "checkmark" : "xmark",
|
|
51
|
+
android: done ? "check" : "close",
|
|
52
|
+
}}
|
|
53
|
+
size={24}
|
|
54
|
+
tintColor={done ? accent : colors.text}
|
|
55
|
+
/>
|
|
56
|
+
</Pressable>
|
|
57
|
+
) : (
|
|
58
|
+
<GlassIconButton
|
|
59
|
+
label={label}
|
|
60
|
+
icon={{ ios: "xmark", android: "close" }}
|
|
61
|
+
onPress={onPress}
|
|
62
|
+
/>
|
|
63
|
+
),
|
|
36
64
|
}}
|
|
37
65
|
/>
|
|
38
66
|
);
|
|
@@ -65,7 +93,11 @@ export function SettingsPage({
|
|
|
65
93
|
contentStyle: { backgroundColor: colors.background },
|
|
66
94
|
}}
|
|
67
95
|
/>
|
|
68
|
-
<ScreenCloseButton
|
|
96
|
+
<ScreenCloseButton
|
|
97
|
+
label="Close settings"
|
|
98
|
+
purpose="done"
|
|
99
|
+
onPress={onClose}
|
|
100
|
+
/>
|
|
69
101
|
<VariableContextProvider
|
|
70
102
|
value={{ "--layout-padding-bottom": inset.bottom + 32 }}
|
|
71
103
|
>
|