@vvedantb/native-ui 0.30.0 → 0.32.0

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/README.md CHANGED
@@ -24,7 +24,7 @@ Optional, only if you import those components:
24
24
  - `@rn-primitives/portal` — `Select`. Mount one `<PortalHost />` from this package at the app root (for example in the root layout), outside any `Modal`. The package does not re-export it, so install it with `@rn-primitives/select`.
25
25
  - `@swmansion/react-native-bottom-sheet` — `BottomSheetContainer`. It needs the New Architecture, React Native 0.82 or later and a native build (no Expo Go), and no root provider.
26
26
  - `@react-native-community/datetimepicker` and `dayjs` — `DateTimeField`
27
- - `@clerk/clerk-expo`, `convex`, `expo-auth-session`, `expo-web-browser` and `expo-router` — `@vvedantb/native-ui/auth` (0.7.0). `expo-router` also for `@vvedantb/native-ui/expo-web-root`.
27
+ - `@clerk/expo`, `convex`, `expo-auth-session`, `expo-web-browser` and `expo-router` — `@vvedantb/native-ui/auth` (0.7.0). `expo-router` also for `@vvedantb/native-ui/expo-web-root`.
28
28
  - `react-native-gesture-handler` (`>=2.0.0`) — `@vvedantb/native-ui/gesture-handler` (Unreleased). Wrap the app in `GestureHandlerRootView`, and put `GestureHandlerProvider` from that entry inside it: the sheet drags (`SheetContent`, the compact `DialogContent`) then run on Gesture Handler, on the UI thread, and each overlay's `Modal` gets its own root view (Android needs one in every `Modal`). It also turns on the `SwipeableRow` swipe. Without the provider, the sheets drag with `PanResponder`, with the same rules, and a `SwipeableRow` does not swipe. Only that entry imports the peer, so an app without it bundles as before. In a Metro monorepo, resolve the peer from the app (one copy), as for `react`.
29
29
  - `react-native-keyboard-controller` (`>=1.21.0`) — `@vvedantb/native-ui/keyboard-controller` (Unreleased). Put `KeyboardControllerProvider` from that entry inside the app's `KeyboardProvider`: the chat transcript (`ConversationList`), the dock (`ConversationDock`) and its scroll button then follow the keyboard frame by frame, a drag down on the transcript moves the keyboard with the finger (iOS, Android 11+; Android 10 and below lower it at once), and `PromptInput`, `ChatThread`, the overlays and `KeyboardAvoidingView` pad frame by frame. The dock moves by the keyboard less the bottom inset: its content pads that inset, as `PromptInput` does. Without the provider, every part keeps React Native's `KeyboardAvoidingView`. Only that entry imports the peer. In a Metro monorepo, resolve the peer from the app (one copy): the parts read its provider's context.
30
30
  - `react-native-svg` — the app marks (`APP_ICONS`, `Icon*`, `AppMark`, `AppWordmark`), `GoogleMark` and `PricingModal`. Apps with the icon peers above already have it: `lucide-react-native` and `@tabler/icons-react-native` both require it.
@@ -82,7 +82,7 @@ The root entry exports everything. It still imports `BottomSheetContainer` and `
82
82
  | `@vvedantb/native-ui/tab-bar` | `FloatingTabBar`, `FloatingTabBarProps`, `FLOATING_INSET`, `FLOATING_TAB_BAR_HEIGHT`, `FLOATING_TAB_BAR_HEIGHT_LARGE`, `tabBarReserve` | `expo-blur`, `expo-haptics` (loaders) |
83
83
  | `@vvedantb/native-ui/brand` | `AppMark`, `AppWordmark`, `GoogleMark` (from 0.3.15), `APP_ICONS`, `IconVibot` and the other `Icon*`, the SVG helpers (`APP_MARKS`, `appMarkSvg`, `appTileSvg` and the rest), `FAMILY_APPS`, `familyApp`, `V_PRO_APP_BENEFITS` | none |
84
84
  | `@vvedantb/native-ui/button` | `Button`, `ButtonProps`, `ButtonShape` (0.6.0), `ButtonSize`, `ButtonVariant` | none |
85
- | `@vvedantb/native-ui/primitives` | `Button`, `Input`, `SearchInput`, `PasswordInput` (0.11.0), `Textarea`, `Label`, `Select`, `Switch`, `LabeledSwitchRow`, `Checkbox`, `Card` and its parts, `Badge`, `StatusDot`, `Avatar`, `Separator`, `Progress`, `Spinner`, `Skeleton`, `EmptyState`, `ListRow`, `Chip`, `HeaderIconButton`, `ThemeToggle` (from 0.3.16), `Tabs`, `PillTabs`, `Dialog`, `AlertDialog`, `ConfirmDialog`, `Sheet`, `toast`, `Toaster`. From 0.5.0: `Text` and `TextClassContext` (only here, not on the root), `ColorSwatches`, `StatGrid`, `SectionLabel`, `SheetRow`, `PageIndicator`, `IconButton`, `CaptureButton`, and the `ListRowProps` and `CardProps` types. From 0.6.0: the `ButtonShape` type. Unreleased: `DropdownMenu` and its parts, `BulkActionBar`, `SwipeableRow` (with `closeSwipeRows`, `swipeActionsAccessibility` and the `SwipeAction` and `SwipeableRowProps` types). From 0.14.0: `formatCompactRelativeTime` (with the `CompactRelativeTimeOptions` type), and `TabsTrigger` `minHeight` | `expo-blur`, `expo-haptics` (loaders) |
85
+ | `@vvedantb/native-ui/primitives` | `Button`, `Input`, `SearchInput`, `PasswordInput` (0.11.0), `Textarea`, `Label`, `Select`, `Switch`, `LabeledSwitchRow`, `Checkbox`, `Card` and its parts, `Badge`, `StatusDot`, `Avatar`, `Separator`, `Progress`, `Spinner`, `Skeleton`, `EmptyState`, `ListRow`, `Chip`, `HeaderIconButton`, `ThemeToggle` (from 0.3.16), `Tabs`, `PillTabs`, `Dialog`, `AlertDialog`, `ConfirmDialog`, `Sheet`, `toast`, `Toaster`. From 0.5.0: `Text` and `TextClassContext` (only here, not on the root), `ColorSwatches`, `StatGrid`, `SectionLabel`, `SheetRow`, `PageIndicator`, `IconButton`, `CaptureButton`, and the `ListRowProps` and `CardProps` types. From 0.6.0: the `ButtonShape` type. Unreleased: `DropdownMenu` and its parts, `BulkActionBar`, `SwipeableRow` (with `closeSwipeRows`, `swipeActionsAccessibility` and the `SwipeAction` and `SwipeableRowProps` types). From 0.14.0: `formatCompactRelativeTime` (with the `CompactRelativeTimeOptions` type), and `TabsTrigger` `minHeight`. Unreleased: `UpdateChecker`, `UpdatePrompt`, `fetchGitHubUpdate`, `newerGitHubRelease`, `isNewerVersion`, `V_STORE_UPDATES_URL` | `expo-blur`, `expo-haptics` (loaders) |
86
86
  | `@vvedantb/native-ui/search-input` | `SearchInput`, `SearchInputProps` | none |
87
87
  | `@vvedantb/native-ui/password-input` | `PasswordInput`, `PasswordInputProps` (from 0.11.0) | none |
88
88
  | `@vvedantb/native-ui/page-title` | `PageTitle`, `PageHeader`, `PageTitleProps`, `PageHeaderProps` (from 0.3.13), `StackPageHeader`, `StackPageHeaderProps` (from 0.5.0; it brings the Tabler package for its chevron) | none |
@@ -100,7 +100,7 @@ The root entry exports everything. It still imports `BottomSheetContainer` and `
100
100
  | `@vvedantb/native-ui/date-time` | `DateTimeField`, `DateTimeFieldProps` (0.5.0) | `@react-native-community/datetimepicker`, `dayjs` (import) |
101
101
  | `@vvedantb/native-ui/ai` | The AI chat parts (from 0.4.0): `Conversation`, `Message`, `Reasoning`, `AgentTrace`, `ChainOfThought`, `ActivityStep`, `PromptInput`, `Suggestions`, `Sources`, `FileChip`, `Attachments`, `CodeBlock`, `ResponseText`, `Shimmer`, `Collapsible`, `useStreamingDisclosure` and their parts. See [AI chat](#ai-chat-040). Not on the root entry.. From 0.12.0: `ChatThread`, `UIMessage`, `ChatJumpRail` and the `Attachment` props `onPress` and `accessibilityLabel` | none |
102
102
  | `@vvedantb/native-ui/ai-gallery` | `AiChatGallery`, `AiChatSamples` (from 0.4.0) | none |
103
- | `@vvedantb/native-ui/auth` | From 0.7.0: `AuthProviders`, `SignInScreen`, `SignUpScreen`, `GoogleSignInButton`, `useGoogleSignIn`, `AuthScreen`, `OrDivider`, `FieldError`, `authErrorMessage`, `SecondFactorScreen`, `useSecondFactor`, `submitTotpSecondFactor`, `submitSecondFactor`, `prepareSecondFactorIfNeeded`, `prepareFirstFactorIfNeeded`, `submitFirstFactor`, `pickFirstFactorStrategy`, `TOTP_MESSAGES` and their props types. See [Auth](#auth-070). Not on the root entry. | `@clerk/clerk-expo`, `convex`, `expo-auth-session`, `expo-web-browser`, `expo-router` (import) |
103
+ | `@vvedantb/native-ui/auth` | From 0.7.0: `AuthProviders`, `SignInScreen`, `SignUpScreen`, `ChangePasswordScreen`, `DeleteAccountScreen` (0.32.0), `GoogleSignInButton`, `useGoogleSignIn`, `AuthScreen`, `OrDivider`, `FieldError`, `authErrorMessage`, `SecondFactorScreen`, `useSecondFactor`, `submitTotpSecondFactor`, `submitSecondFactor`, `prepareSecondFactorIfNeeded`, `prepareFirstFactorIfNeeded`, `submitFirstFactor`, `pickFirstFactorStrategy`, `TOTP_MESSAGES` and their props types. See [Auth](#auth-070). Not on the root entry. | `@clerk/expo`, `convex`, `expo-auth-session`, `expo-web-browser`, `expo-router` (import) |
104
104
  | `@vvedantb/native-ui/expo-router` | From 0.12.0: `RouterStackPageHeader`, `RouterStackPageHeaderProps`, `goBackOrReplace`. Not on the root, `/layout` or `/page-title` entries. | `expo-router` (import) |
105
105
  | `@vvedantb/native-ui/expo-web-root` | From 0.7.0: `ExpoWebRoot`, `ExpoWebRootProps`, `ExpoWebRootViewport`, `EXPO_WEB_VIEWPORT`, `expoWebBackgroundCss`. Not on the root entry. | `expo-router` (import of `expo-router/html`) |
106
106
  | `@vvedantb/native-ui/tailwind-preset` | From 0.7.0, CommonJS for `tailwind.config.js`: `nativeUiPreset`, `nativeUiContent`, `cssVar`, `hslVar`, `rgbAlpha`, `cssVariables`, `schemeColors` and a default preset. See [Expo / NativeWind](#expo--nativewind). | `nativewind` (`require`, when installed) |
@@ -197,12 +197,12 @@ It renders `<html lang="en">`, the charset, `X-UA-Compatible` and viewport meta
197
197
 
198
198
  ## Auth (0.7.0)
199
199
 
200
- `@vvedantb/native-ui/auth` has the Clerk and Convex providers and a sign-in and sign-up screen. It needs `@clerk/clerk-expo`, `expo-auth-session`, `expo-web-browser` and `expo-router`, and `convex` when you pass a Convex client.
200
+ `@vvedantb/native-ui/auth` has the Clerk and Convex providers and a sign-in and sign-up screen. It needs `@clerk/expo`, `expo-auth-session`, `expo-web-browser` and `expo-router`, and `convex` when you pass a Convex client.
201
201
 
202
202
  ```tsx
203
203
  // app/_layout.tsx
204
- import { useAuth } from "@clerk/clerk-expo";
205
- import { tokenCache } from "@clerk/clerk-expo/token-cache";
204
+ import { useAuth } from "@clerk/expo";
205
+ import { tokenCache } from "@clerk/expo/token-cache";
206
206
  import { AuthProviders } from "@vvedantb/native-ui/auth";
207
207
 
208
208
  <AuthProviders publishableKey={publishableKey} tokenCache={tokenCache} convex={convex} useAuth={useAuth}>
@@ -210,7 +210,7 @@ import { AuthProviders } from "@vvedantb/native-ui/auth";
210
210
  </AuthProviders>
211
211
  ```
212
212
 
213
- `AuthProviders` nests `ClerkProvider`, `ConvexProviderWithClerk` (only with `convex`) and `ClerkLoaded` (with `loaded`, default `true`). Without `convex` the children sit under Clerk only. `clerk={false}` gives a plain `ConvexProvider`, for UI preview builds. The app reads its own key; the component checks nothing.
213
+ `AuthProviders` nests `ClerkProvider`, `ConvexProviderWithClerk` (only with `convex`) and `ClerkLoaded` (with `loaded`, default `true`). Without `convex` the children sit under Clerk only. `clerk={false}` gives a plain `ConvexProvider`, for UI preview builds. The app reads its own key; the component checks nothing. From 0.32.0 the Clerk peer is `@clerk/expo` 4 or later (not `@clerk/clerk-expo`): pass `publishableKey`, because `@clerk/expo` does not read it from the environment.
214
214
 
215
215
  ```tsx
216
216
  // app/(auth)/sign-in.tsx
@@ -256,6 +256,22 @@ export default function SignUp() {
256
256
 
257
257
  ### Second factor (0.10.0)
258
258
 
259
+ Account screens (0.32.0), for a signed-in user. Both use `useUser` from `@clerk/expo` and show errors under the fields.
260
+
261
+ ```tsx
262
+ import { ChangePasswordScreen, DeleteAccountScreen } from "@vvedantb/native-ui/auth";
263
+
264
+ // app/(app)/change-password.tsx
265
+ <ChangePasswordScreen minPasswordLength={8} onCancel={() => router.back()} />
266
+
267
+ // app/(app)/delete-account.tsx
268
+ <DeleteAccountScreen afterDeleteHref="/sign-in" onCancel={() => router.back()} />
269
+ ```
270
+
271
+ - `ChangePasswordScreen` calls `user.updatePassword`: the current password, then the new one twice. An account with no password (Google only) gets no current-password field. `signOutOfOtherSessions` defaults to `true`. After the change it calls `onSuccess`, or `router.back()`.
272
+ - `DeleteAccountScreen` calls `user.delete()`. The user types `confirmWord` (default `DELETE`) first; the button stays off until it matches. Turn on "Allow users to delete their accounts" in the Clerk dashboard, or the call fails. After the delete it calls `onDeleted`, or `router.replace(afterDeleteHref)`.
273
+ - `testID`s: `change-password-current`, `-new`, `-confirm`, `-error`, `-submit`, `-cancel`; `delete-account-confirm`, `-error`, `-submit`, `-cancel`. Change the prefix with `testIDPrefix`.
274
+
259
275
  `SecondFactorScreen` is a one-time code step with no Clerk import. The caller owns the check.
260
276
 
261
277
  | Prop | Default | Use |
@@ -401,6 +417,27 @@ As on the web, `AlertDialogAction` does not close the dialog; `ConfirmDialog` cl
401
417
 
402
418
  From 0.3.7, in a compact window (639 wide or less, or 500 high or less: the web `COMPACT_OVERLAY_QUERY`) `DialogContent`, and so `AlertDialogContent` and `ConfirmDialog`, is the web phone bottom sheet: full width, top corners 16, a handle, the bottom safe-area inset. Its footer stacks the buttons full width and at least 44 high, the last child on top, whatever `fullWidth` says. Pass `viewportAware={false}` to keep the centred dialog at every size.
403
419
 
420
+ ### Update prompt (Unreleased)
421
+
422
+ For an Android app that ships its APK as GitHub releases tagged `<tagPrefix><version>`. Mount `UpdateChecker` once near the app root. It checks once at start and offers a newer version with Later, Download and "Install from V Store".
423
+
424
+ ```tsx
425
+ <UpdateChecker
426
+ appName="My app"
427
+ currentVersion={Constants.expoConfig?.version}
428
+ source={{ repo: "owner/my-app", tagPrefix: "myapp-apk-" }}
429
+ storage={{ getItem: SecureStore.getItemAsync, setItem: SecureStore.setItemAsync }}
430
+ />
431
+ ```
432
+
433
+ - **Download** opens the release's first `.apk` asset, else its release page.
434
+ - **Install from V Store** only opens V Store (`vStoreUrl`, default `V_STORE_UPDATES_URL`, `vstore://updates`). It downloads and installs nothing itself.
435
+ - **V Store not installed:** the link fails to open, so the V Store button is replaced by a notice ("V Store is not installed on this device.") and the prompt stays open with Download and Later. `onVStoreMissing` fires. The button is not hidden up front, because Android 11+ only reports another app's link as openable to an app that declares it in its manifest `<queries>`.
436
+ - `showDownload={false}` or `showVStore={false}` offers only one of the two.
437
+ - **Later** (and Android back) hides that version until a newer one is out, when `storage` is given. Download and V Store close the prompt for this run only.
438
+ - `currentVersion` `null` skips the check (a local build). A failed, offline or rate-limited check shows nothing.
439
+ - Pass `check` instead of `source` for another release source. `UpdatePrompt` is the controlled dialog alone.
440
+
404
441
  From 0.3.8 `UpgradeToProCard` has the web `SidebarUpgradeCard` sizes: a 14 / 600 title, a 32-high pill with a 12 / 500 label (the web `Button` `sm`), `px-3 py-2.5` padding and radius 16. With larger text the title and pill keep their larger sizes.
405
442
 
406
443
  From 0.3.9 `SearchInput` is the web search field: a search icon, and a clear button while there is text. It is controlled with `value` and `onChange(text)`; `onClear` runs whenever the value becomes empty. `size="sm"` (default) is 32 high and `md` 40, border included, as on the web. From 0.3.12 that height is locked, so the line height of the text class cannot grow the field; it still grows with the system font size. The clear button is painted at 24 and reaches 44 with its hit slop. Inside a `ScrollView`, set `keyboardShouldPersistTaps="handled"` so the first tap on it clears while the keyboard is up. The web `shortcut` hint and `toolbar` variant are not ported.
@@ -0,0 +1,424 @@
1
+ import { c as _c } from "react/compiler-runtime";
2
+ import { useEffect, useRef, useState } from "react";
3
+ import { Linking } from "react-native";
4
+ import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle } from "./AlertDialog";
5
+ import { fetchGitHubUpdate } from "./updateCheck";
6
+
7
+ /** Opens the Updates tab of V Store, the Project V Android app store. */
8
+ export const V_STORE_UPDATES_URL = "vstore://updates";
9
+ /**
10
+ * "Update available" with up to three actions: Later, Install from V Store
11
+ * and Download. Download opens the update's link in the browser, which
12
+ * downloads the APK for install. "Install from V Store" only opens V Store
13
+ * (`vStoreUrl`); it downloads and installs nothing itself.
14
+ *
15
+ * V Store not installed: the link fails to open, so the V Store button goes,
16
+ * a notice says so, and the prompt stays open with Download (when shown) and
17
+ * Later. Nothing is downloaded unless the user presses Download. The button is
18
+ * not hidden up front: Android 11+ only reports another app's link as
19
+ * openable to an app that declares it in its manifest `<queries>`.
20
+ *
21
+ * Controlled: it is open while `update` is set. `UpdateChecker` runs the
22
+ * check and holds that state. It adds no motion of its own; the dialog's
23
+ * follows Reduce Motion.
24
+ */
25
+ export function UpdatePrompt(t0) {
26
+ const $ = _c(53);
27
+ const {
28
+ update,
29
+ appName,
30
+ title: t1,
31
+ description,
32
+ laterLabel: t2,
33
+ downloadLabel: t3,
34
+ vStoreLabel: t4,
35
+ vStoreMissingText: t5,
36
+ showDownload: t6,
37
+ showVStore: t7,
38
+ vStoreUrl: t8,
39
+ onLater,
40
+ onDownload,
41
+ onOpenVStore,
42
+ onVStoreMissing,
43
+ openUrl: t9,
44
+ testID
45
+ } = t0;
46
+ const title = t1 === undefined ? "Update available" : t1;
47
+ const laterLabel = t2 === undefined ? "Later" : t2;
48
+ const downloadLabel = t3 === undefined ? "Download" : t3;
49
+ const vStoreLabel = t4 === undefined ? "Install from V Store" : t4;
50
+ const vStoreMissingText = t5 === undefined ? "V Store is not installed on this device." : t5;
51
+ const showDownload = t6 === undefined ? true : t6;
52
+ const showVStore = t7 === undefined ? true : t7;
53
+ const vStoreUrl = t8 === undefined ? V_STORE_UPDATES_URL : t8;
54
+ const openUrl = t9 === undefined ? Linking.openURL : t9;
55
+ const [missingFor, setMissingFor] = useState(null);
56
+ const [shown, setShown] = useState(update);
57
+ if (update && update !== shown) {
58
+ setShown(update);
59
+ }
60
+ const vStoreMissing = shown !== null && missingFor === shown.version;
61
+ let t10;
62
+ if ($[0] !== appName || $[1] !== description || $[2] !== shown) {
63
+ t10 = shown === null ? null : typeof description === "function" ? description(shown) : description ?? `${appName} ${shown.version} is ready to install.`;
64
+ $[0] = appName;
65
+ $[1] = description;
66
+ $[2] = shown;
67
+ $[3] = t10;
68
+ } else {
69
+ t10 = $[3];
70
+ }
71
+ const body = t10;
72
+ const t11 = update !== null;
73
+ let t12;
74
+ if ($[4] !== onLater || $[5] !== update) {
75
+ t12 = next => {
76
+ if (!next && update) {
77
+ onLater?.(update);
78
+ }
79
+ };
80
+ $[4] = onLater;
81
+ $[5] = update;
82
+ $[6] = t12;
83
+ } else {
84
+ t12 = $[6];
85
+ }
86
+ let t13;
87
+ if ($[7] !== title) {
88
+ t13 = <AlertDialogTitle>{title}</AlertDialogTitle>;
89
+ $[7] = title;
90
+ $[8] = t13;
91
+ } else {
92
+ t13 = $[8];
93
+ }
94
+ let t14;
95
+ if ($[9] !== body) {
96
+ t14 = body != null ? <AlertDialogDescription>{body}</AlertDialogDescription> : null;
97
+ $[9] = body;
98
+ $[10] = t14;
99
+ } else {
100
+ t14 = $[10];
101
+ }
102
+ let t15;
103
+ if ($[11] !== showVStore || $[12] !== testID || $[13] !== vStoreMissing || $[14] !== vStoreMissingText) {
104
+ t15 = showVStore && vStoreMissing ? <AlertDialogDescription testID={testID ? `${testID}-vstore-missing` : undefined} accessibilityLiveRegion="polite">{vStoreMissingText}</AlertDialogDescription> : null;
105
+ $[11] = showVStore;
106
+ $[12] = testID;
107
+ $[13] = vStoreMissing;
108
+ $[14] = vStoreMissingText;
109
+ $[15] = t15;
110
+ } else {
111
+ t15 = $[15];
112
+ }
113
+ let t16;
114
+ if ($[16] !== t13 || $[17] !== t14 || $[18] !== t15) {
115
+ t16 = <AlertDialogHeader>{t13}{t14}{t15}</AlertDialogHeader>;
116
+ $[16] = t13;
117
+ $[17] = t14;
118
+ $[18] = t15;
119
+ $[19] = t16;
120
+ } else {
121
+ t16 = $[19];
122
+ }
123
+ const t17 = testID ? `${testID}-later` : undefined;
124
+ let t18;
125
+ if ($[20] !== laterLabel || $[21] !== t17) {
126
+ t18 = <AlertDialogCancel size="lg" testID={t17}>{laterLabel}</AlertDialogCancel>;
127
+ $[20] = laterLabel;
128
+ $[21] = t17;
129
+ $[22] = t18;
130
+ } else {
131
+ t18 = $[22];
132
+ }
133
+ let t19;
134
+ if ($[23] !== onOpenVStore || $[24] !== onVStoreMissing || $[25] !== openUrl || $[26] !== showDownload || $[27] !== showVStore || $[28] !== testID || $[29] !== update || $[30] !== vStoreLabel || $[31] !== vStoreMissing || $[32] !== vStoreUrl) {
135
+ t19 = showVStore && !vStoreMissing ? <AlertDialogAction size="lg" variant={showDownload ? "secondary" : "default"} testID={testID ? `${testID}-vstore` : undefined} onPress={() => {
136
+ if (!update) {
137
+ return;
138
+ }
139
+ openUrl(vStoreUrl).then(() => onOpenVStore?.(update), () => {
140
+ setMissingFor(update.version);
141
+ onVStoreMissing?.(update);
142
+ });
143
+ }}>{vStoreLabel}</AlertDialogAction> : null;
144
+ $[23] = onOpenVStore;
145
+ $[24] = onVStoreMissing;
146
+ $[25] = openUrl;
147
+ $[26] = showDownload;
148
+ $[27] = showVStore;
149
+ $[28] = testID;
150
+ $[29] = update;
151
+ $[30] = vStoreLabel;
152
+ $[31] = vStoreMissing;
153
+ $[32] = vStoreUrl;
154
+ $[33] = t19;
155
+ } else {
156
+ t19 = $[33];
157
+ }
158
+ let t20;
159
+ if ($[34] !== downloadLabel || $[35] !== onDownload || $[36] !== openUrl || $[37] !== showDownload || $[38] !== testID || $[39] !== update) {
160
+ t20 = showDownload ? <AlertDialogAction size="lg" testID={testID ? `${testID}-download` : undefined} onPress={() => {
161
+ if (!update) {
162
+ return;
163
+ }
164
+ openUrl(update.url).catch(_temp);
165
+ onDownload?.(update);
166
+ }}>{downloadLabel}</AlertDialogAction> : null;
167
+ $[34] = downloadLabel;
168
+ $[35] = onDownload;
169
+ $[36] = openUrl;
170
+ $[37] = showDownload;
171
+ $[38] = testID;
172
+ $[39] = update;
173
+ $[40] = t20;
174
+ } else {
175
+ t20 = $[40];
176
+ }
177
+ let t21;
178
+ if ($[41] !== t18 || $[42] !== t19 || $[43] !== t20) {
179
+ t21 = <AlertDialogFooter>{t18}{t19}{t20}</AlertDialogFooter>;
180
+ $[41] = t18;
181
+ $[42] = t19;
182
+ $[43] = t20;
183
+ $[44] = t21;
184
+ } else {
185
+ t21 = $[44];
186
+ }
187
+ let t22;
188
+ if ($[45] !== t16 || $[46] !== t21 || $[47] !== testID) {
189
+ t22 = <AlertDialogContent testID={testID}>{t16}{t21}</AlertDialogContent>;
190
+ $[45] = t16;
191
+ $[46] = t21;
192
+ $[47] = testID;
193
+ $[48] = t22;
194
+ } else {
195
+ t22 = $[48];
196
+ }
197
+ let t23;
198
+ if ($[49] !== t11 || $[50] !== t12 || $[51] !== t22) {
199
+ t23 = <AlertDialog open={t11} onOpenChange={t12}>{t22}</AlertDialog>;
200
+ $[49] = t11;
201
+ $[50] = t12;
202
+ $[51] = t22;
203
+ $[52] = t23;
204
+ } else {
205
+ t23 = $[52];
206
+ }
207
+ return t23;
208
+ }
209
+
210
+ /** Where "Later" is remembered, for example `expo-secure-store` or AsyncStorage. */
211
+ function _temp() {}
212
+ /** The version Later hid. An unreadable store means nothing was dismissed. */
213
+ async function readDismissed(storage, key) {
214
+ try {
215
+ return await storage.getItem(key);
216
+ } catch {
217
+ return null;
218
+ }
219
+ }
220
+ /**
221
+ * Looks for a newer version once when it mounts and offers it in an
222
+ * `UpdatePrompt`. Mount it once, near the app root.
223
+ *
224
+ * - The check reads the GitHub releases of `source`, or calls `check`.
225
+ * Offline, rate limited, a failed check or no `currentVersion`: nothing is
226
+ * offered, and nothing is shown.
227
+ * - Later (and Android back) hides that version until a newer one is out,
228
+ * when `storage` is given.
229
+ * - Download and "Install from V Store" close the prompt for this run only,
230
+ * so it asks again at the next start if the update was not installed.
231
+ */
232
+ export function UpdateChecker(t0) {
233
+ const $ = _c(42);
234
+ let check;
235
+ let currentVersion;
236
+ let onDownload;
237
+ let onLater;
238
+ let onOpenVStore;
239
+ let prompt;
240
+ let source;
241
+ let storage;
242
+ let t1;
243
+ let t2;
244
+ if ($[0] !== t0) {
245
+ ({
246
+ currentVersion,
247
+ source,
248
+ check,
249
+ enabled: t1,
250
+ storage,
251
+ storageKey: t2,
252
+ onLater,
253
+ onDownload,
254
+ onOpenVStore,
255
+ ...prompt
256
+ } = t0);
257
+ $[0] = t0;
258
+ $[1] = check;
259
+ $[2] = currentVersion;
260
+ $[3] = onDownload;
261
+ $[4] = onLater;
262
+ $[5] = onOpenVStore;
263
+ $[6] = prompt;
264
+ $[7] = source;
265
+ $[8] = storage;
266
+ $[9] = t1;
267
+ $[10] = t2;
268
+ } else {
269
+ check = $[1];
270
+ currentVersion = $[2];
271
+ onDownload = $[3];
272
+ onLater = $[4];
273
+ onOpenVStore = $[5];
274
+ prompt = $[6];
275
+ source = $[7];
276
+ storage = $[8];
277
+ t1 = $[9];
278
+ t2 = $[10];
279
+ }
280
+ const enabled = t1 === undefined ? true : t1;
281
+ const storageKey = t2 === undefined ? "updateDismissed" : t2;
282
+ const [update, setUpdate] = useState(null);
283
+ let t3;
284
+ if ($[11] !== check || $[12] !== storage || $[13] !== storageKey) {
285
+ t3 = {
286
+ check,
287
+ storage,
288
+ storageKey
289
+ };
290
+ $[11] = check;
291
+ $[12] = storage;
292
+ $[13] = storageKey;
293
+ $[14] = t3;
294
+ } else {
295
+ t3 = $[14];
296
+ }
297
+ const latest = useRef(t3);
298
+ let t4;
299
+ if ($[15] !== check || $[16] !== storage || $[17] !== storageKey) {
300
+ t4 = () => {
301
+ latest.current = {
302
+ check,
303
+ storage,
304
+ storageKey
305
+ };
306
+ };
307
+ $[15] = check;
308
+ $[16] = storage;
309
+ $[17] = storageKey;
310
+ $[18] = t4;
311
+ } else {
312
+ t4 = $[18];
313
+ }
314
+ useEffect(t4);
315
+ const repo = source?.repo;
316
+ const tagPrefix = source?.tagPrefix;
317
+ const hasCheck = check !== undefined;
318
+ let t5;
319
+ if ($[19] !== currentVersion || $[20] !== enabled || $[21] !== repo || $[22] !== tagPrefix) {
320
+ t5 = () => {
321
+ if (!enabled || !currentVersion) {
322
+ return;
323
+ }
324
+ let cancelled = false;
325
+ const run = async () => {
326
+ const {
327
+ check: custom,
328
+ storage: store,
329
+ storageKey: key
330
+ } = latest.current;
331
+ const found = custom ? await custom(currentVersion) : repo !== undefined && tagPrefix !== undefined ? await fetchGitHubUpdate({
332
+ repo,
333
+ tagPrefix
334
+ }, currentVersion) : null;
335
+ if (!found) {
336
+ return;
337
+ }
338
+ const dismissed = store ? await readDismissed(store, key) : null;
339
+ if (!cancelled && dismissed !== found.version) {
340
+ setUpdate(found);
341
+ }
342
+ };
343
+ run().catch(_temp2);
344
+ return () => {
345
+ cancelled = true;
346
+ };
347
+ };
348
+ $[19] = currentVersion;
349
+ $[20] = enabled;
350
+ $[21] = repo;
351
+ $[22] = tagPrefix;
352
+ $[23] = t5;
353
+ } else {
354
+ t5 = $[23];
355
+ }
356
+ let t6;
357
+ if ($[24] !== currentVersion || $[25] !== enabled || $[26] !== hasCheck || $[27] !== repo || $[28] !== tagPrefix) {
358
+ t6 = [enabled, currentVersion, repo, tagPrefix, hasCheck];
359
+ $[24] = currentVersion;
360
+ $[25] = enabled;
361
+ $[26] = hasCheck;
362
+ $[27] = repo;
363
+ $[28] = tagPrefix;
364
+ $[29] = t6;
365
+ } else {
366
+ t6 = $[29];
367
+ }
368
+ useEffect(t5, t6);
369
+ let t7;
370
+ if ($[30] !== onLater) {
371
+ t7 = current => {
372
+ setUpdate(null);
373
+ const {
374
+ storage: store_0,
375
+ storageKey: key_0
376
+ } = latest.current;
377
+ if (store_0) {
378
+ Promise.resolve().then(() => store_0.setItem(key_0, current.version)).catch(_temp3);
379
+ }
380
+ onLater?.(current);
381
+ };
382
+ $[30] = onLater;
383
+ $[31] = t7;
384
+ } else {
385
+ t7 = $[31];
386
+ }
387
+ let t8;
388
+ if ($[32] !== onDownload) {
389
+ t8 = current_0 => {
390
+ setUpdate(null);
391
+ onDownload?.(current_0);
392
+ };
393
+ $[32] = onDownload;
394
+ $[33] = t8;
395
+ } else {
396
+ t8 = $[33];
397
+ }
398
+ let t9;
399
+ if ($[34] !== onOpenVStore) {
400
+ t9 = current_1 => {
401
+ setUpdate(null);
402
+ onOpenVStore?.(current_1);
403
+ };
404
+ $[34] = onOpenVStore;
405
+ $[35] = t9;
406
+ } else {
407
+ t9 = $[35];
408
+ }
409
+ let t10;
410
+ if ($[36] !== prompt || $[37] !== t7 || $[38] !== t8 || $[39] !== t9 || $[40] !== update) {
411
+ t10 = <UpdatePrompt {...prompt} update={update} onLater={t7} onDownload={t8} onOpenVStore={t9} />;
412
+ $[36] = prompt;
413
+ $[37] = t7;
414
+ $[38] = t8;
415
+ $[39] = t9;
416
+ $[40] = update;
417
+ $[41] = t10;
418
+ } else {
419
+ t10 = $[41];
420
+ }
421
+ return t10;
422
+ }
423
+ function _temp3() {}
424
+ function _temp2() {}