create-disposabl-app 0.14.14 → 0.14.16
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 +1 -1
- package/dist/templates/default/AGENTS.md +1 -0
- package/dist/templates/default/apps/mobile/eslint.config.js +24 -0
- package/dist/templates/default/packages/disposabl-kit/mobile/billing/account-billing.tsx +15 -11
- package/dist/templates/default/packages/disposabl-kit/mobile/components/account-profile.tsx +8 -23
- package/dist/templates/default/packages/disposabl-kit/mobile/components/appearance-settings.tsx +39 -44
- package/dist/templates/default/packages/disposabl-kit/mobile/components/auth-form.tsx +20 -19
- package/dist/templates/default/packages/disposabl-kit/mobile/components/auth-ui.tsx +22 -100
- package/dist/templates/default/packages/disposabl-kit/mobile/components/email-verification.tsx +6 -6
- package/dist/templates/default/packages/disposabl-kit/mobile/components/google-button.tsx +3 -27
- package/dist/templates/default/packages/disposabl-kit/mobile/components/google-sign-in.tsx +3 -4
- package/dist/templates/default/packages/disposabl-kit/mobile/components/settings-page.tsx +12 -22
- package/dist/templates/default/packages/disposabl-kit/mobile/design/avatar.tsx +1 -1
- package/dist/templates/default/packages/disposabl-kit/mobile/design/brand-mark.tsx +2 -10
- package/dist/templates/default/packages/disposabl-kit/mobile/design/nativewind.ts +11 -0
- package/dist/templates/default/packages/disposabl-kit/mobile/design/preferences.tsx +30 -54
- package/dist/templates/default/packages/disposabl-kit/mobile/design/primitives.tsx +17 -39
- package/dist/templates/default/packages/disposabl-kit/mobile/design/themed-text.tsx +3 -5
- package/dist/templates/default/packages/disposabl-kit/mobile/global.css +1 -56
- package/dist/templates/default/packages/disposabl-kit/mobile/layout.tsx +7 -10
- package/dist/templates/default/packages/disposabl-kit/mobile/screens/account.tsx +3 -10
- package/dist/templates/default/packages/disposabl-kit/mobile/screens/change-password.tsx +13 -19
- package/dist/templates/default/packages/disposabl-kit/mobile/screens/forgot-password.tsx +17 -15
- package/dist/templates/default/packages/disposabl-kit/mobile/screens/home.tsx +75 -120
- package/dist/templates/default/packages/disposabl-kit/mobile/typography.css +59 -0
- package/dist/templates/default/packages/disposabl-kit/mobile/updates/update-prompt.tsx +69 -96
- package/dist/templates/default/packages/tests/components/mobile-google.test.mjs +1 -1
- package/dist/templates/default/packages/tests/components/mobile-updates.test.mjs +3 -1
- package/dist/templates/default/packages/tests/mobile-styling.test.ts +64 -0
- package/package.json +1 -1
|
@@ -2,11 +2,10 @@ import { authErrorMessage } from "../../lib/auth-errors";
|
|
|
2
2
|
import { useMutation, useQuery } from "convex/react";
|
|
3
3
|
import { useRef, useState } from "react";
|
|
4
4
|
import { Keyboard, Switch, Text, TextInput, View } from "react-native";
|
|
5
|
-
import { AuthButton, AuthScreen,
|
|
5
|
+
import { AuthButton, AuthScreen, authClasses } from "../components/auth-ui";
|
|
6
6
|
import { api } from "../lib/convex";
|
|
7
7
|
|
|
8
8
|
export function ChangePasswordScreen() {
|
|
9
|
-
const styles = useAuthStyles();
|
|
10
9
|
const user = useQuery(api.auth.account);
|
|
11
10
|
const usernameChange = useMutation(api.auth.changePassword);
|
|
12
11
|
const emailChange = useMutation(api.authEmail.changePassword);
|
|
@@ -64,13 +63,15 @@ export function ChangePasswordScreen() {
|
|
|
64
63
|
|
|
65
64
|
return (
|
|
66
65
|
<AuthScreen>
|
|
67
|
-
<Text
|
|
66
|
+
<Text className={authClasses.title}>Change password</Text>
|
|
68
67
|
{user === undefined ? (
|
|
69
|
-
<Text
|
|
68
|
+
<Text className={authClasses.body}>Loading your account...</Text>
|
|
70
69
|
) : user === null ? (
|
|
71
|
-
<Text
|
|
70
|
+
<Text className={authClasses.error}>
|
|
71
|
+
Your account could not be found.
|
|
72
|
+
</Text>
|
|
72
73
|
) : !user.passwordMethod ? (
|
|
73
|
-
<Text
|
|
74
|
+
<Text className={authClasses.body}>
|
|
74
75
|
This account uses an external sign-in provider. Continue using your
|
|
75
76
|
sign-in provider.
|
|
76
77
|
</Text>
|
|
@@ -93,11 +94,11 @@ export function ChangePasswordScreen() {
|
|
|
93
94
|
],
|
|
94
95
|
] as const
|
|
95
96
|
).map(([label, value, onChangeText, autoComplete]) => (
|
|
96
|
-
<View key={label}
|
|
97
|
-
<Text
|
|
97
|
+
<View key={label} className={authClasses.field}>
|
|
98
|
+
<Text className={authClasses.label}>{label}</Text>
|
|
98
99
|
<TextInput
|
|
99
100
|
accessibilityLabel={label}
|
|
100
|
-
|
|
101
|
+
className={authClasses.input}
|
|
101
102
|
value={value}
|
|
102
103
|
onChangeText={onChangeText}
|
|
103
104
|
secureTextEntry
|
|
@@ -108,15 +109,8 @@ export function ChangePasswordScreen() {
|
|
|
108
109
|
/>
|
|
109
110
|
</View>
|
|
110
111
|
))}
|
|
111
|
-
<View
|
|
112
|
-
|
|
113
|
-
flexDirection: "row",
|
|
114
|
-
alignItems: "center",
|
|
115
|
-
justifyContent: "space-between",
|
|
116
|
-
gap: 12,
|
|
117
|
-
}}
|
|
118
|
-
>
|
|
119
|
-
<Text style={[styles.label, { flex: 1 }]}>
|
|
112
|
+
<View className="flex-row items-center justify-between gap-[12px]">
|
|
113
|
+
<Text className={`${authClasses.label} flex-1`}>
|
|
120
114
|
Log out other devices
|
|
121
115
|
</Text>
|
|
122
116
|
<Switch
|
|
@@ -129,7 +123,7 @@ export function ChangePasswordScreen() {
|
|
|
129
123
|
{message && (
|
|
130
124
|
<Text
|
|
131
125
|
accessibilityRole="alert"
|
|
132
|
-
|
|
126
|
+
className={message.success ? authClasses.body : authClasses.error}
|
|
133
127
|
>
|
|
134
128
|
{message.text}
|
|
135
129
|
</Text>
|
|
@@ -8,11 +8,10 @@ import { useState } from "react";
|
|
|
8
8
|
import { Text, TextInput } from "react-native";
|
|
9
9
|
import { api } from "../lib/convex";
|
|
10
10
|
import { authErrorMessage } from "../../lib/auth-errors";
|
|
11
|
-
import { AuthButton, AuthScreen,
|
|
11
|
+
import { AuthButton, AuthScreen, authClasses } from "../components/auth-ui";
|
|
12
12
|
import { EmailLinkInput } from "../components/email-verification";
|
|
13
13
|
|
|
14
14
|
export function ForgotPasswordScreen() {
|
|
15
|
-
const styles = useAuthStyles();
|
|
16
15
|
const providers = useQuery(api.auth.providers);
|
|
17
16
|
const { startPasswordRecovery, pending } = useStartPasswordRecovery(
|
|
18
17
|
api.authEmail,
|
|
@@ -23,11 +22,11 @@ export function ForgotPasswordScreen() {
|
|
|
23
22
|
const [error, setError] = useState<string | null>(null);
|
|
24
23
|
return (
|
|
25
24
|
<AuthScreen>
|
|
26
|
-
<Text
|
|
25
|
+
<Text className={authClasses.title}>Reset password</Text>
|
|
27
26
|
{!providers ? (
|
|
28
|
-
<Text
|
|
27
|
+
<Text className={authClasses.body}>Loading…</Text>
|
|
29
28
|
) : !providers.emailDelivery ? (
|
|
30
|
-
<Text
|
|
29
|
+
<Text className={authClasses.body}>
|
|
31
30
|
Email recovery is not available. Username-only accounts need help from
|
|
32
31
|
the app owner.
|
|
33
32
|
</Text>
|
|
@@ -35,7 +34,7 @@ export function ForgotPasswordScreen() {
|
|
|
35
34
|
<ResetPassword code={code} />
|
|
36
35
|
) : sent ? (
|
|
37
36
|
<>
|
|
38
|
-
<Text
|
|
37
|
+
<Text className={authClasses.body}>
|
|
39
38
|
If this email belongs to an account, a reset link will arrive
|
|
40
39
|
shortly. It expires in 10 minutes.
|
|
41
40
|
</Text>
|
|
@@ -43,12 +42,12 @@ export function ForgotPasswordScreen() {
|
|
|
43
42
|
</>
|
|
44
43
|
) : (
|
|
45
44
|
<>
|
|
46
|
-
<Text
|
|
45
|
+
<Text className={authClasses.body}>
|
|
47
46
|
Enter the verified email for your account.
|
|
48
47
|
</Text>
|
|
49
48
|
<TextInput
|
|
50
49
|
accessibilityLabel="Email"
|
|
51
|
-
|
|
50
|
+
className={authClasses.input}
|
|
52
51
|
value={email}
|
|
53
52
|
onChangeText={setEmail}
|
|
54
53
|
autoCapitalize="none"
|
|
@@ -58,7 +57,7 @@ export function ForgotPasswordScreen() {
|
|
|
58
57
|
editable={!pending}
|
|
59
58
|
/>
|
|
60
59
|
{error && (
|
|
61
|
-
<Text accessibilityRole="alert"
|
|
60
|
+
<Text accessibilityRole="alert" className={authClasses.error}>
|
|
62
61
|
{error}
|
|
63
62
|
</Text>
|
|
64
63
|
)}
|
|
@@ -79,7 +78,7 @@ export function ForgotPasswordScreen() {
|
|
|
79
78
|
/>
|
|
80
79
|
</>
|
|
81
80
|
)}
|
|
82
|
-
<Link href="/(auth)/login"
|
|
81
|
+
<Link href="/(auth)/login" className={authClasses.link}>
|
|
83
82
|
Back to login
|
|
84
83
|
</Link>
|
|
85
84
|
</AuthScreen>
|
|
@@ -87,14 +86,17 @@ export function ForgotPasswordScreen() {
|
|
|
87
86
|
}
|
|
88
87
|
|
|
89
88
|
function ResetPassword({ code }: { code: string }) {
|
|
90
|
-
const styles = useAuthStyles();
|
|
91
89
|
const state = useCompletePasswordRecovery(api.authEmail, { emailCode: code });
|
|
92
90
|
const [password, setPassword] = useState("");
|
|
93
91
|
const [confirmation, setConfirmation] = useState("");
|
|
94
92
|
const [error, setError] = useState<string | null>(null);
|
|
95
93
|
if (state.status !== "ready")
|
|
96
94
|
return (
|
|
97
|
-
<Text
|
|
95
|
+
<Text
|
|
96
|
+
className={
|
|
97
|
+
state.status === "error" ? authClasses.error : authClasses.body
|
|
98
|
+
}
|
|
99
|
+
>
|
|
98
100
|
{state.status === "error"
|
|
99
101
|
? authErrorMessage(state.userError)
|
|
100
102
|
: state.status === "complete"
|
|
@@ -107,7 +109,7 @@ function ResetPassword({ code }: { code: string }) {
|
|
|
107
109
|
<TextInput
|
|
108
110
|
accessibilityLabel="New password"
|
|
109
111
|
placeholder="New password"
|
|
110
|
-
|
|
112
|
+
className={authClasses.input}
|
|
111
113
|
value={password}
|
|
112
114
|
onChangeText={setPassword}
|
|
113
115
|
secureTextEntry
|
|
@@ -119,7 +121,7 @@ function ResetPassword({ code }: { code: string }) {
|
|
|
119
121
|
<TextInput
|
|
120
122
|
accessibilityLabel="Confirm new password"
|
|
121
123
|
placeholder="Confirm new password"
|
|
122
|
-
|
|
124
|
+
className={authClasses.input}
|
|
123
125
|
value={confirmation}
|
|
124
126
|
onChangeText={setConfirmation}
|
|
125
127
|
secureTextEntry
|
|
@@ -129,7 +131,7 @@ function ResetPassword({ code }: { code: string }) {
|
|
|
129
131
|
editable={!state.pending}
|
|
130
132
|
/>
|
|
131
133
|
{error && (
|
|
132
|
-
<Text accessibilityRole="alert"
|
|
134
|
+
<Text accessibilityRole="alert" className={authClasses.error}>
|
|
133
135
|
{error}
|
|
134
136
|
</Text>
|
|
135
137
|
)}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { VariableContextProvider } from "nativewind";
|
|
1
2
|
import { router, Stack } from "expo-router";
|
|
2
3
|
import {
|
|
3
4
|
Alert,
|
|
@@ -9,12 +10,10 @@ import {
|
|
|
9
10
|
} from "react-native";
|
|
10
11
|
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
|
11
12
|
import { GlassIconButton } from "../design/preferences";
|
|
12
|
-
import { useTheme } from "../design/use-theme";
|
|
13
13
|
import { starterFeatures, starterPlatforms } from "../../lib/starter";
|
|
14
14
|
import { docsEnabled } from "../../features";
|
|
15
15
|
|
|
16
16
|
export function HomeScreen() {
|
|
17
|
-
const c = useTheme();
|
|
18
17
|
const inset = useSafeAreaInsets();
|
|
19
18
|
const site = process.env.EXPO_PUBLIC_CONVEX_SITE_URL;
|
|
20
19
|
const docs = docsEnabled && site ? `${site.replace(/\/$/, "")}/docs` : null;
|
|
@@ -31,7 +30,7 @@ export function HomeScreen() {
|
|
|
31
30
|
options={{
|
|
32
31
|
title: "Your app",
|
|
33
32
|
headerRight: () => (
|
|
34
|
-
<View
|
|
33
|
+
<View className="flex-row gap-[8px]">
|
|
35
34
|
{docs && (
|
|
36
35
|
<GlassIconButton
|
|
37
36
|
label="Docs"
|
|
@@ -48,133 +47,89 @@ export function HomeScreen() {
|
|
|
48
47
|
),
|
|
49
48
|
}}
|
|
50
49
|
/>
|
|
51
|
-
<
|
|
52
|
-
|
|
53
|
-
contentInsetAdjustmentBehavior="automatic"
|
|
54
|
-
contentContainerStyle={{
|
|
55
|
-
padding: 24,
|
|
56
|
-
paddingBottom: inset.bottom + 32,
|
|
57
|
-
width: "100%",
|
|
58
|
-
maxWidth: 680,
|
|
59
|
-
alignSelf: "center",
|
|
60
|
-
gap: 24,
|
|
61
|
-
}}
|
|
50
|
+
<VariableContextProvider
|
|
51
|
+
value={{ "--layout-padding-bottom": inset.bottom + 32 }}
|
|
62
52
|
>
|
|
63
|
-
<
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
backgroundColor: c.foreground,
|
|
68
|
-
gap: 18,
|
|
69
|
-
}}
|
|
53
|
+
<ScrollView
|
|
54
|
+
className="flex-1 bg-background"
|
|
55
|
+
contentInsetAdjustmentBehavior="automatic"
|
|
56
|
+
contentContainerClassName="p-[24px] pb-[var(--layout-padding-bottom)] w-[100%] max-w-[680px] self-center gap-[24px]"
|
|
70
57
|
>
|
|
71
|
-
<
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
✦
|
|
77
|
-
</Text>
|
|
78
|
-
<Text
|
|
79
|
-
style={{
|
|
80
|
-
color: c.background,
|
|
81
|
-
fontSize: 34,
|
|
82
|
-
fontWeight: "700",
|
|
83
|
-
letterSpacing: -1,
|
|
84
|
-
}}
|
|
85
|
-
>
|
|
86
|
-
Your app starts here.
|
|
87
|
-
</Text>
|
|
88
|
-
<Text style={{ color: c.background, fontSize: 17, lineHeight: 25 }}>
|
|
89
|
-
Your workspace is ready. Build on this foundation while your app
|
|
90
|
-
takes shape.
|
|
91
|
-
</Text>
|
|
92
|
-
{docs && (
|
|
93
|
-
<Pressable
|
|
94
|
-
accessibilityRole="link"
|
|
95
|
-
onPress={() => void openGuide("getting-started")}
|
|
96
|
-
style={{ alignSelf: "flex-start", paddingVertical: 14 }}
|
|
58
|
+
<View className="p-[28px] rounded-[28px] bg-foreground gap-[18px]">
|
|
59
|
+
<Text
|
|
60
|
+
accessibilityElementsHidden
|
|
61
|
+
importantForAccessibility="no"
|
|
62
|
+
className="text-background text-[52px]"
|
|
97
63
|
>
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
key={id}
|
|
113
|
-
style={{
|
|
114
|
-
padding: 24,
|
|
115
|
-
borderRadius: 24,
|
|
116
|
-
backgroundColor: c.card,
|
|
117
|
-
gap: 8,
|
|
118
|
-
}}
|
|
119
|
-
>
|
|
120
|
-
<Text
|
|
121
|
-
style={{ color: c.foreground, fontSize: 21, fontWeight: "600" }}
|
|
64
|
+
✦
|
|
65
|
+
</Text>
|
|
66
|
+
<Text className="text-background text-[34px] font-bold tracking-[-1px]">
|
|
67
|
+
Your app starts here.
|
|
68
|
+
</Text>
|
|
69
|
+
<Text className="text-background text-[17px] leading-[25px]">
|
|
70
|
+
Your workspace is ready. Build on this foundation while your app
|
|
71
|
+
takes shape.
|
|
72
|
+
</Text>
|
|
73
|
+
{docs && (
|
|
74
|
+
<Pressable
|
|
75
|
+
accessibilityRole="link"
|
|
76
|
+
onPress={() => void openGuide("getting-started")}
|
|
77
|
+
className="self-start py-[14px]"
|
|
122
78
|
>
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
79
|
+
<Text className="text-background text-[17px] font-semibold">
|
|
80
|
+
Explore your starter ↗
|
|
81
|
+
</Text>
|
|
82
|
+
</Pressable>
|
|
83
|
+
)}
|
|
84
|
+
</View>
|
|
85
|
+
<Text className="text-foreground text-[24px] font-semibold">
|
|
86
|
+
Built for your platforms
|
|
87
|
+
</Text>
|
|
88
|
+
<View className="gap-[12px]">
|
|
89
|
+
{starterPlatforms.map(({ id, title, detail, guide }) => (
|
|
90
|
+
<View
|
|
91
|
+
key={id}
|
|
92
|
+
className="p-[24px] rounded-[24px] bg-card gap-[8px]"
|
|
131
93
|
>
|
|
132
|
-
|
|
94
|
+
<Text className="text-foreground text-[21px] font-semibold">
|
|
95
|
+
{title}
|
|
96
|
+
</Text>
|
|
97
|
+
<Text className="text-muted-foreground text-[16px] leading-[23px]">
|
|
98
|
+
{detail}
|
|
99
|
+
</Text>
|
|
100
|
+
{docs && (
|
|
101
|
+
<Pressable
|
|
102
|
+
accessibilityRole="link"
|
|
103
|
+
onPress={() => void openGuide(guide)}
|
|
104
|
+
className="py-[12px]"
|
|
105
|
+
>
|
|
106
|
+
<Text className="text-primary-text text-[16px] font-semibold">
|
|
107
|
+
Get started with {title} ↗
|
|
108
|
+
</Text>
|
|
109
|
+
</Pressable>
|
|
110
|
+
)}
|
|
111
|
+
</View>
|
|
112
|
+
))}
|
|
113
|
+
</View>
|
|
114
|
+
{starterFeatures.length > 0 && (
|
|
115
|
+
<View className="gap-[12px]">
|
|
116
|
+
<Text className="text-muted-foreground text-[16px]">
|
|
117
|
+
Also included
|
|
133
118
|
</Text>
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
accessibilityRole="link"
|
|
137
|
-
onPress={() => void openGuide(guide)}
|
|
138
|
-
style={{ paddingVertical: 12 }}
|
|
139
|
-
>
|
|
119
|
+
<View className="flex-row flex-wrap gap-[8px]">
|
|
120
|
+
{starterFeatures.map((feature) => (
|
|
140
121
|
<Text
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
fontSize: 16,
|
|
144
|
-
fontWeight: "600",
|
|
145
|
-
}}
|
|
122
|
+
key={feature}
|
|
123
|
+
className="px-[14px] py-[8px] rounded-[20px] bg-card text-foreground"
|
|
146
124
|
>
|
|
147
|
-
|
|
125
|
+
{feature}
|
|
148
126
|
</Text>
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
</View>
|
|
152
|
-
))}
|
|
153
|
-
</View>
|
|
154
|
-
{starterFeatures.length > 0 && (
|
|
155
|
-
<View style={{ gap: 12 }}>
|
|
156
|
-
<Text style={{ color: c.mutedForeground, fontSize: 16 }}>
|
|
157
|
-
Also included
|
|
158
|
-
</Text>
|
|
159
|
-
<View style={{ flexDirection: "row", flexWrap: "wrap", gap: 8 }}>
|
|
160
|
-
{starterFeatures.map((feature) => (
|
|
161
|
-
<Text
|
|
162
|
-
key={feature}
|
|
163
|
-
style={{
|
|
164
|
-
paddingHorizontal: 14,
|
|
165
|
-
paddingVertical: 8,
|
|
166
|
-
borderRadius: 20,
|
|
167
|
-
backgroundColor: c.card,
|
|
168
|
-
color: c.foreground,
|
|
169
|
-
}}
|
|
170
|
-
>
|
|
171
|
-
{feature}
|
|
172
|
-
</Text>
|
|
173
|
-
))}
|
|
127
|
+
))}
|
|
128
|
+
</View>
|
|
174
129
|
</View>
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
</
|
|
130
|
+
)}
|
|
131
|
+
</ScrollView>
|
|
132
|
+
</VariableContextProvider>
|
|
178
133
|
</>
|
|
179
134
|
);
|
|
180
135
|
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
.themed-text {
|
|
2
|
+
color: var(--foreground);
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.type-default,
|
|
6
|
+
.type-title,
|
|
7
|
+
.type-subtitle,
|
|
8
|
+
.type-small,
|
|
9
|
+
.type-small-bold,
|
|
10
|
+
.type-link {
|
|
11
|
+
font-family: "Spline Sans";
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.type-default {
|
|
15
|
+
font-size: 16px;
|
|
16
|
+
font-weight: 500;
|
|
17
|
+
line-height: 24px;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.type-title {
|
|
21
|
+
font-size: 48px;
|
|
22
|
+
font-weight: 600;
|
|
23
|
+
line-height: 52px;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.type-subtitle {
|
|
27
|
+
font-size: 32px;
|
|
28
|
+
font-weight: 600;
|
|
29
|
+
line-height: 44px;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.type-small {
|
|
33
|
+
font-size: 14px;
|
|
34
|
+
font-weight: 500;
|
|
35
|
+
line-height: 20px;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.type-small-bold {
|
|
39
|
+
font-size: 14px;
|
|
40
|
+
font-weight: 700;
|
|
41
|
+
line-height: 20px;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.type-link {
|
|
45
|
+
font-size: 14px;
|
|
46
|
+
line-height: 30px;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.type-code {
|
|
50
|
+
font-family: ui-monospace;
|
|
51
|
+
font-size: 12px;
|
|
52
|
+
font-weight: 500;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
@media android {
|
|
56
|
+
.type-code {
|
|
57
|
+
font-weight: 700;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { VariableContextProvider } from "nativewind";
|
|
1
2
|
import * as Updates from "expo-updates";
|
|
2
3
|
import {
|
|
3
4
|
useCallback,
|
|
@@ -7,14 +8,7 @@ import {
|
|
|
7
8
|
useState,
|
|
8
9
|
type PropsWithChildren,
|
|
9
10
|
} from "react";
|
|
10
|
-
import {
|
|
11
|
-
Alert,
|
|
12
|
-
AppState,
|
|
13
|
-
Pressable,
|
|
14
|
-
StyleSheet,
|
|
15
|
-
Text,
|
|
16
|
-
View,
|
|
17
|
-
} from "react-native";
|
|
11
|
+
import { Alert, AppState, Pressable, Text, View } from "react-native";
|
|
18
12
|
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
|
19
13
|
import { fetchCurrentUpdate } from "./current-update";
|
|
20
14
|
import { foregroundCheck } from "./foreground-check";
|
|
@@ -108,94 +102,73 @@ export function UpdatePrompt({ children }: PropsWithChildren) {
|
|
|
108
102
|
const visible = enabled && (isUpdatePending || state === "error");
|
|
109
103
|
|
|
110
104
|
return (
|
|
111
|
-
<
|
|
112
|
-
{
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
{state === "error"
|
|
121
|
-
? "Could not apply the update"
|
|
122
|
-
: "An update is ready"}
|
|
123
|
-
</Text>
|
|
124
|
-
<Text style={styles.description}>
|
|
125
|
-
{state === "error"
|
|
126
|
-
? "Could not update. Check your connection and try again."
|
|
127
|
-
: "Update now, or it will load the next time you start the app."}
|
|
128
|
-
</Text>
|
|
129
|
-
</View>
|
|
130
|
-
<Pressable
|
|
131
|
-
accessibilityRole="button"
|
|
132
|
-
accessibilityState={{
|
|
133
|
-
disabled: busy || isNativeBusy,
|
|
134
|
-
busy: busy || isNativeBusy,
|
|
135
|
-
}}
|
|
136
|
-
disabled={busy || isNativeBusy}
|
|
137
|
-
style={styles.button}
|
|
138
|
-
onPress={() => {
|
|
139
|
-
const confirmationGeneration = generation.current;
|
|
140
|
-
Alert.alert(
|
|
141
|
-
"Update now?",
|
|
142
|
-
"Finish or save any unsent work before restarting.",
|
|
143
|
-
[
|
|
144
|
-
{ text: "Not now", style: "cancel" },
|
|
145
|
-
{
|
|
146
|
-
text: "Update now",
|
|
147
|
-
onPress: () => {
|
|
148
|
-
if (generation.current !== confirmationGeneration) return;
|
|
149
|
-
if (running.current || nativeBusy.current) {
|
|
150
|
-
Alert.alert(
|
|
151
|
-
"Checking for updates",
|
|
152
|
-
"Please try again when the check finishes.",
|
|
153
|
-
);
|
|
154
|
-
return;
|
|
155
|
-
}
|
|
156
|
-
void refresh(true);
|
|
157
|
-
},
|
|
158
|
-
},
|
|
159
|
-
],
|
|
160
|
-
);
|
|
161
|
-
}}
|
|
105
|
+
<VariableContextProvider
|
|
106
|
+
value={{ "--update-bottom": Math.max(insets.bottom, 12) }}
|
|
107
|
+
>
|
|
108
|
+
<View className="flex-1">
|
|
109
|
+
{children}
|
|
110
|
+
{visible && (
|
|
111
|
+
<View
|
|
112
|
+
className="absolute inset-x-[16px] bottom-[var(--update-bottom)] flex-row items-center gap-[12px] rounded-[20px] bg-[#171717] p-[16px]"
|
|
113
|
+
accessibilityLiveRegion="polite"
|
|
162
114
|
>
|
|
163
|
-
<
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
115
|
+
<View className="flex-1 gap-[4px]">
|
|
116
|
+
<Text className="text-[15px] font-semibold text-white">
|
|
117
|
+
{state === "error"
|
|
118
|
+
? "Could not apply the update"
|
|
119
|
+
: "An update is ready"}
|
|
120
|
+
</Text>
|
|
121
|
+
<Text className="text-[13px] leading-[19px] text-[#d4d4d4]">
|
|
122
|
+
{state === "error"
|
|
123
|
+
? "Could not update. Check your connection and try again."
|
|
124
|
+
: "Update now, or it will load the next time you start the app."}
|
|
125
|
+
</Text>
|
|
126
|
+
</View>
|
|
127
|
+
<Pressable
|
|
128
|
+
accessibilityRole="button"
|
|
129
|
+
accessibilityState={{
|
|
130
|
+
disabled: busy || isNativeBusy,
|
|
131
|
+
busy: busy || isNativeBusy,
|
|
132
|
+
}}
|
|
133
|
+
disabled={busy || isNativeBusy}
|
|
134
|
+
className="min-h-[44px] justify-center rounded-[12px] bg-white px-[12px]"
|
|
135
|
+
onPress={() => {
|
|
136
|
+
const confirmationGeneration = generation.current;
|
|
137
|
+
Alert.alert(
|
|
138
|
+
"Update now?",
|
|
139
|
+
"Finish or save any unsent work before restarting.",
|
|
140
|
+
[
|
|
141
|
+
{ text: "Not now", style: "cancel" },
|
|
142
|
+
{
|
|
143
|
+
text: "Update now",
|
|
144
|
+
onPress: () => {
|
|
145
|
+
if (generation.current !== confirmationGeneration)
|
|
146
|
+
return;
|
|
147
|
+
if (running.current || nativeBusy.current) {
|
|
148
|
+
Alert.alert(
|
|
149
|
+
"Checking for updates",
|
|
150
|
+
"Please try again when the check finishes.",
|
|
151
|
+
);
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
void refresh(true);
|
|
155
|
+
},
|
|
156
|
+
},
|
|
157
|
+
],
|
|
158
|
+
);
|
|
159
|
+
}}
|
|
160
|
+
>
|
|
161
|
+
<Text className="text-[14px] font-semibold text-[#171717]">
|
|
162
|
+
{busy || isNativeBusy
|
|
163
|
+
? "Updating..."
|
|
164
|
+
: state === "error"
|
|
165
|
+
? "Try again"
|
|
166
|
+
: "Update now"}
|
|
167
|
+
</Text>
|
|
168
|
+
</Pressable>
|
|
169
|
+
</View>
|
|
170
|
+
)}
|
|
171
|
+
</View>
|
|
172
|
+
</VariableContextProvider>
|
|
174
173
|
);
|
|
175
174
|
}
|
|
176
|
-
|
|
177
|
-
const styles = StyleSheet.create({
|
|
178
|
-
container: { flex: 1 },
|
|
179
|
-
notice: {
|
|
180
|
-
position: "absolute",
|
|
181
|
-
left: 16,
|
|
182
|
-
right: 16,
|
|
183
|
-
borderRadius: 20,
|
|
184
|
-
padding: 16,
|
|
185
|
-
backgroundColor: "#171717",
|
|
186
|
-
flexDirection: "row",
|
|
187
|
-
gap: 12,
|
|
188
|
-
alignItems: "center",
|
|
189
|
-
},
|
|
190
|
-
copy: { flex: 1, gap: 4 },
|
|
191
|
-
title: { color: "#fff", fontSize: 15, fontWeight: "600" },
|
|
192
|
-
description: { color: "#d4d4d4", fontSize: 13, lineHeight: 19 },
|
|
193
|
-
button: {
|
|
194
|
-
minHeight: 44,
|
|
195
|
-
justifyContent: "center",
|
|
196
|
-
paddingHorizontal: 12,
|
|
197
|
-
borderRadius: 12,
|
|
198
|
-
backgroundColor: "#fff",
|
|
199
|
-
},
|
|
200
|
-
buttonText: { color: "#171717", fontWeight: "600", fontSize: 14 },
|
|
201
|
-
});
|
|
@@ -23,7 +23,7 @@ mock.module("../../disposabl-kit/mobile/lib/convex", () => ({
|
|
|
23
23
|
api: { auth: {} },
|
|
24
24
|
}));
|
|
25
25
|
mock.module("../../disposabl-kit/mobile/components/auth-ui", () => ({
|
|
26
|
-
|
|
26
|
+
authClasses: {},
|
|
27
27
|
}));
|
|
28
28
|
mock.module("../../disposabl-kit/mobile/components/google-button", () => ({
|
|
29
29
|
GoogleButton: "Button",
|