AI-native knowledge base & Evernote/Obsidian alternative with instant sync & native MCP. Free on Cloudflare or self-hosted via Docker.
HTML ai-agentcloudflarecloudflare-d1cloudflare-r2cloudflare-workersdockerelectronevernoteevernote-alternativeknowledge-basemcpnote-takingobsidian-alternativeoffline-firstpersonal-knowledge-basepwaself-hostedsqlitetiptapweb-clipper
feat(mobile): surface app updates with a quiet toast and settings entry
tianma-iff1f58043401a
diff --git a/apps/mobile/app/_layout.tsx b/apps/mobile/app/_layout.tsxindex 8902d986..681e827a 100644--- a/apps/mobile/app/_layout.tsx+++ b/apps/mobile/app/_layout.tsx@@ -14,6 +14,7 @@ import { SessionProvider } from "../src/lib/session";import { MobileThemeProvider, useMobileTheme } from "../src/lib/mobile-theme";import { MobileLocaleProvider } from "../src/lib/mobile-locale";import { AppDialogProvider } from "../src/components/AppDialogProvider";+import { MobileUpdateToast } from "../src/components/MobileUpdateToast";import { MobileUpdateProvider } from "../src/lib/mobile-update";void SplashScreen.preventAutoHideAsync();@@ -93,6 +94,7 @@ export default function RootLayout() {><SessionProvider><Stack screenOptions={{ headerShown: false }} />+ <MobileUpdateToast /></SessionProvider></PersistQueryClientProvider></MobileUpdateProvider>diff --git a/apps/mobile/src/components/MobileUpdateCard.tsx b/apps/mobile/src/components/MobileUpdateCard.tsxindex 554203b5..1ff5173e 100644--- a/apps/mobile/src/components/MobileUpdateCard.tsx+++ b/apps/mobile/src/components/MobileUpdateCard.tsx@@ -10,17 +10,20 @@ import { useMobileTheme, resolveMobileThemeStyles } from "../lib/mobile-theme";export const MobileUpdateCard = () => {const { resolvedLocale } = useMobileLocale();const { resolvedTheme } = useMobileTheme();- const { checkForUpdate, isSupported, status } = useMobileUpdate();+ const { checkForUpdate, hasUpdate, isSupported, openUpdate, status, updateKind } = useMobileUpdate();const english = resolvedLocale === "en-US";const busy = status === "checking" || status === "downloading";const styles = resolveMobileThemeStyles(baseStyles, resolvedTheme);- const statusLabel = status === "checking"+ const checkLabel = status === "checking"? (english ? "Checking…" : "正在检查…")- : status === "downloading"- ? (english ? "Downloading…" : "正在下载…")- : status === "ready"- ? (english ? "Downloaded; restart to apply" : "已下载,重启后应用")- : (english ? "Check for updates" : "检查更新");+ : (english ? "Check for updates" : "检查更新");+ const openLabel = status === "downloading"+ ? (english ? "Downloading…" : "正在下载…")+ : status === "ready"+ ? (english ? "Restart to apply" : "重启以应用")+ : updateKind === "ota"+ ? (english ? "Download update" : "下载更新")+ : (english ? "Get update" : "前往更新");return (<View style={styles.card}>@@ -35,6 +38,18 @@ export const MobileUpdateCard = () => {{english ? "Current version" : "当前版本"}: v{Updates.runtimeVersion ?? Constants.expoConfig?.version ?? "unknown"}</Text></View>+ {hasUpdate ? (+ <Pressable+ accessibilityRole="button"+ accessibilityState={{ busy: status === "downloading", disabled: status === "downloading" }}+ disabled={status === "downloading"}+ onPress={() => void openUpdate()}+ style={[styles.button, status === "downloading" && styles.buttonDisabled]}+ >+ {status === "downloading" ? <ActivityIndicator color="#047857" size="small" /> : <RefreshCw color="#047857" size={16} />}+ <Text style={styles.buttonText}>{openLabel}</Text>+ </Pressable>+ ) : null}<PressableaccessibilityRole="button"accessibilityState={{ busy, disabled: busy }}@@ -42,8 +57,8 @@ export const MobileUpdateCard = () => {onPress={() => void checkForUpdate()}style={[styles.button, busy && styles.buttonDisabled]}>- {busy ? <ActivityIndicator color="#047857" size="small" /> : <RefreshCw color="#047857" size={16} />}- <Text style={styles.buttonText}>{statusLabel}</Text>+ {status === "checking" ? <ActivityIndicator color="#047857" size="small" /> : <RefreshCw color="#047857" size={16} />}+ <Text style={styles.buttonText}>{checkLabel}</Text></Pressable>{!isSupported ? (<Text style={styles.hint}>diff --git a/apps/mobile/src/components/MobileUpdateToast.tsx b/apps/mobile/src/components/MobileUpdateToast.tsxnew file mode 100644index 00000000..21140f1e--- /dev/null+++ b/apps/mobile/src/components/MobileUpdateToast.tsx@@ -0,0 +1,221 @@+import { useEffect, useRef, useState } from "react";+import { Animated, Pressable, StyleSheet, View } from "react-native";+import { useSafeAreaInsets } from "react-native-safe-area-context";+import { ArrowUpCircle, X } from "./icons";+import { Text } from "./LocalizedText";+import { useMobileLocale } from "../lib/mobile-locale";+import {+ readMobileUpdateToastDismissedVersion,+ shouldShowMobileUpdateToastForVersion,+ writeMobileUpdateToastDismissedVersion,+} from "../lib/preferences";+import { resolveMobileThemeStyles, useMobileTheme } from "../lib/mobile-theme";+import { useMobileUpdate } from "../lib/mobile-update";++const AUTO_DISMISS_MS = 3_000;+const FADE_MS = 180;++/**+ * Subtle one-shot toast when an app update is detected.+ * Auto-hides after 3s, and is remembered per installed version until the user upgrades.+ */+export const MobileUpdateToast = () => {+ const insets = useSafeAreaInsets();+ const { resolvedLocale } = useMobileLocale();+ const { resolvedTheme } = useMobileTheme();+ const { hasUpdate, installedVersion, openUpdate, status, updateKind } = useMobileUpdate();+ const english = resolvedLocale === "en-US";+ const styles = resolveMobileThemeStyles(baseStyles, resolvedTheme);+ const [storageReady, setStorageReady] = useState(false);+ const [visible, setVisible] = useState(false);+ const dismissedForVersionRef = useRef<string | null>(null);+ const showingRef = useRef(false);+ const opacity = useRef(new Animated.Value(0)).current;++ useEffect(() => {+ let active = true;+ void readMobileUpdateToastDismissedVersion().then((value) => {+ if (!active) return;+ dismissedForVersionRef.current = value;+ setStorageReady(true);+ });+ return () => {+ active = false;+ };+ }, []);++ useEffect(() => {+ if (!storageReady || !hasUpdate || status === "downloading") {+ return;+ }+ if (!shouldShowMobileUpdateToastForVersion(installedVersion, dismissedForVersionRef.current)) {+ return;+ }+ if (!installedVersion || showingRef.current) {+ return;+ }++ showingRef.current = true;+ dismissedForVersionRef.current = installedVersion;+ void writeMobileUpdateToastDismissedVersion(installedVersion);++ setVisible(true);+ Animated.timing(opacity, {+ duration: FADE_MS,+ toValue: 1,+ useNativeDriver: true,+ }).start();++ const hideTimer = setTimeout(() => {+ Animated.timing(opacity, {+ duration: FADE_MS,+ toValue: 0,+ useNativeDriver: true,+ }).start(({ finished }) => {+ if (finished) {+ setVisible(false);+ showingRef.current = false;+ }+ });+ }, AUTO_DISMISS_MS);++ return () => clearTimeout(hideTimer);+ }, [hasUpdate, installedVersion, opacity, status, storageReady]);++ if (!visible || !hasUpdate) {+ return null;+ }++ const title = english ? "Update available" : "发现新版本";+ const detail = status === "ready"+ ? (english ? "Restart in System info" : "可在系统信息中重启")+ : updateKind === "ota"+ ? (english ? "Optional in-app update" : "可选的应用内更新")+ : (english ? "See System info to update" : "可在系统信息中更新");++ const dismiss = () => {+ Animated.timing(opacity, {+ duration: FADE_MS,+ toValue: 0,+ useNativeDriver: true,+ }).start(({ finished }) => {+ if (finished) {+ setVisible(false);+ showingRef.current = false;+ }+ });+ };++ return (+ <Animated.View+ accessibilityLiveRegion="polite"+ pointerEvents="box-none"+ style={[+ styles.anchor,+ {+ bottom: Math.max(insets.bottom, 12) + 12,+ opacity,+ },+ ]}+ >+ <View style={styles.toast}>+ <Pressable+ accessibilityHint={english ? "Opens the update action" : "打开更新操作"}+ accessibilityLabel={`${title}. ${detail}`}+ accessibilityRole="button"+ onPress={() => {+ dismiss();+ void openUpdate();+ }}+ style={styles.toastBody}+ >+ <View style={styles.iconWrap}>+ <ArrowUpCircle color="#059669" size={14} />+ </View>+ <View style={styles.copy}>+ <Text numberOfLines={1} style={styles.title}>{title}</Text>+ <Text numberOfLines={1} style={styles.detail}>{detail}</Text>+ </View>+ </Pressable>+ <Pressable+ accessibilityLabel={english ? "Dismiss" : "关闭"}+ accessibilityRole="button"+ hitSlop={8}+ onPress={dismiss}+ style={styles.close}+ >+ <X color="#94a3b8" size={14} />+ </Pressable>+ </View>+ </Animated.View>+ );+};++const baseStyles = StyleSheet.create({+ anchor: {+ alignItems: "center",+ left: 16,+ position: "absolute",+ right: 16,+ zIndex: 40,+ },+ toast: {+ alignItems: "center",+ alignSelf: "center",+ backgroundColor: "#ffffff",+ borderColor: "#d1fae5",+ borderRadius: 999,+ borderWidth: StyleSheet.hairlineWidth,+ elevation: 2,+ flexDirection: "row",+ gap: 2,+ maxWidth: 320,+ minHeight: 40,+ paddingLeft: 8,+ paddingRight: 4,+ paddingVertical: 6,+ shadowColor: "#0f172a",+ shadowOffset: { width: 0, height: 2 },+ shadowOpacity: 0.06,+ shadowRadius: 8,+ },+ toastBody: {+ alignItems: "center",+ flexDirection: "row",+ flexShrink: 1,+ gap: 8,+ minWidth: 0,+ paddingVertical: 2,+ },+ iconWrap: {+ alignItems: "center",+ backgroundColor: "#ecfdf5",+ borderRadius: 999,+ height: 22,+ justifyContent: "center",+ width: 22,+ },+ copy: {+ flexShrink: 1,+ gap: 0,+ minWidth: 0,+ paddingRight: 2,+ },+ title: {+ color: "#0f172a",+ fontSize: 12,+ fontWeight: "700",+ lineHeight: 15,+ },+ detail: {+ color: "#64748b",+ fontSize: 11,+ lineHeight: 14,+ },+ close: {+ alignItems: "center",+ height: 28,+ justifyContent: "center",+ width: 28,+ },+});diff --git a/apps/mobile/src/components/icons.tsx b/apps/mobile/src/components/icons.tsxindex 7abde1b6..dd05c56c 100644--- a/apps/mobile/src/components/icons.tsx+++ b/apps/mobile/src/components/icons.tsx@@ -16,6 +16,7 @@ const createIcon = (name: FeatherName) => {export const Archive = createIcon("archive");export const AlertTriangle = createIcon("alert-triangle");+export const ArrowUpCircle = createIcon("arrow-up-circle");export const BookOpen = createIcon("book-open");export const Bold = createIcon("bold");export const Check = createIcon("check");diff --git a/apps/mobile/src/lib/mobile-release.test.ts b/apps/mobile/src/lib/mobile-release.test.tsindex 950bc13e..4eee4ca9 100644--- a/apps/mobile/src/lib/mobile-release.test.ts+++ b/apps/mobile/src/lib/mobile-release.test.ts@@ -1,5 +1,11 @@import { expect, test } from "bun:test";-import { findNewerMobileRelease } from "./mobile-release";+import {+ ANDROID_INSTALL_UPDATE_SOURCES,+ findNewerMobileRelease,+ getDefaultMobileInstallUpdateUrl,+ GITHUB_LATEST_RELEASE_URL,+ GOOGLE_PLAY_URL,+} from "./mobile-release";const responseWithTag = (tagName: string, androidVersion = tagName.replace(/^v/, "")) => new Response(JSON.stringify({assets: [{ name: `edgeever-android-v${androidVersion}-arm64-v8a.apk` }],@@ -39,3 +45,12 @@ test("rejects invalid release responses instead of claiming the app is current",tag_name: "v0.4.15",})))).rejects.toThrow("exactly one Android APK");});++test("resolves install update destinations for Android dual distribution", () => {+ expect(getDefaultMobileInstallUpdateUrl("android")).toBe(GOOGLE_PLAY_URL);+ expect(getDefaultMobileInstallUpdateUrl("ios")).toBe(GITHUB_LATEST_RELEASE_URL);+ expect(ANDROID_INSTALL_UPDATE_SOURCES.map((source) => source.url)).toEqual([+ GOOGLE_PLAY_URL,+ GITHUB_LATEST_RELEASE_URL,+ ]);+});diff --git a/apps/mobile/src/lib/mobile-release.ts b/apps/mobile/src/lib/mobile-release.tsindex 73e0703f..a53eac8b 100644--- a/apps/mobile/src/lib/mobile-release.ts+++ b/apps/mobile/src/lib/mobile-release.ts@@ -5,6 +5,34 @@ const LATEST_RELEASE_API_URL = "https://api.github.com/repos/tianma-if/edgeever/export const GITHUB_LATEST_RELEASE_URL = "https://github.com/tianma-if/edgeever/releases/latest";export const GOOGLE_PLAY_URL = "https://play.google.com/store/apps/details?id=org.edgeever.mobile";+export type MobileInstallUpdateSource = {+ id: "play" | "github";+ labelEn: string;+ labelZh: string;+ url: string;+};++/** Android installable builds ship via Play and GitHub; both are offered when opening an update. */+export const ANDROID_INSTALL_UPDATE_SOURCES: readonly MobileInstallUpdateSource[] = [+ {+ id: "play",+ labelEn: "Google Play",+ labelZh: "Google Play",+ url: GOOGLE_PLAY_URL,+ },+ {+ id: "github",+ labelEn: "GitHub Releases",+ labelZh: "GitHub Releases",+ url: GITHUB_LATEST_RELEASE_URL,+ },+];++export const getDefaultMobileInstallUpdateUrl = (platform: "android" | "ios" | "web" | "windows" | "macos") => {+ if (platform === "android") return GOOGLE_PLAY_URL;+ return GITHUB_LATEST_RELEASE_URL;+};+type LatestReleaseResponse = {assets?: unknown;tag_name?: unknown;diff --git a/apps/mobile/src/lib/mobile-update.tsx b/apps/mobile/src/lib/mobile-update.tsxindex 2594121b..b6966ca1 100644--- a/apps/mobile/src/lib/mobile-update.tsx+++ b/apps/mobile/src/lib/mobile-update.tsx@@ -1,32 +1,44 @@import { createContext, useCallback, useContext, useEffect, useMemo, useRef, useState, type ReactNode } from "react";import Constants from "expo-constants";-import { AppState, Platform, type AppStateStatus } from "react-native";+import { AppState, Linking, Platform, type AppStateStatus } from "react-native";import * as Updates from "expo-updates";import { Alert } from "../components/LocalizedText";import { useMobileLocale } from "./mobile-locale";-import { findNewerMobileRelease } from "./mobile-release";+import {+ ANDROID_INSTALL_UPDATE_SOURCES,+ findNewerMobileRelease,+ getDefaultMobileInstallUpdateUrl,+} from "./mobile-release";const FOREGROUND_CHECK_INTERVAL_MS = 6 * 60 * 60 * 1000;type MobileUpdateStatus = "idle" | "checking" | "available" | "downloading" | "ready";+export type MobileUpdateKind = "install" | "ota";type MobileUpdateContextValue = {checkForUpdate: () => Promise<void>;hasUpdate: boolean;+ installedVersion: string | null;isSupported: boolean;+ openUpdate: () => Promise<void>;status: MobileUpdateStatus;+ updateKind: MobileUpdateKind | null;};const MobileUpdateContext = createContext<MobileUpdateContextValue>({checkForUpdate: async () => undefined,hasUpdate: false,+ installedVersion: null,isSupported: false,+ openUpdate: async () => undefined,status: "idle",+ updateKind: null,});export const MobileUpdateProvider = ({ children }: { children: ReactNode }) => {const { resolvedLocale } = useMobileLocale();const [status, setStatus] = useState<MobileUpdateStatus>("idle");+ const [updateKind, setUpdateKind] = useState<MobileUpdateKind | null>(null);const activeCheckRef = useRef<Promise<void> | null>(null);const lastAutomaticCheckRef = useRef(0);const isSupported = !__DEV__ && Updates.isEnabled;@@ -61,6 +73,7 @@ export const MobileUpdateProvider = ({ children }: { children: ReactNode }) => {}const release = await findNewerMobileRelease(installedVersion);if (release) {+ setUpdateKind("install");setStatus("available");return;}@@ -72,12 +85,15 @@ export const MobileUpdateProvider = ({ children }: { children: ReactNode }) => {const result = await Updates.checkForUpdateAsync();if (!result.isAvailable) {+ setUpdateKind(null);setStatus("idle");return;}+ setUpdateKind("ota");setStatus("available");} catch {+ setUpdateKind(null);setStatus("idle");}})();@@ -110,16 +126,99 @@ export const MobileUpdateProvider = ({ children }: { children: ReactNode }) => {};}, [runCheck]);+ const openUpdate = useCallback(async () => {+ if (updateKind === "install") {+ if (Platform.OS === "android") {+ Alert.alert(+ english ? "Update available" : "发现新版本",+ english+ ? "Get the latest version from Google Play or GitHub Releases."+ : "可从 Google Play 或 GitHub Releases 获取最新版本。",+ [+ ...ANDROID_INSTALL_UPDATE_SOURCES.map((source) => ({+ text: english ? source.labelEn : source.labelZh,+ onPress: () => {+ void Linking.openURL(source.url);+ },+ })),+ {+ text: english ? "Cancel" : "取消",+ style: "cancel" as const,+ },+ ]+ );+ return;+ }++ const url = getDefaultMobileInstallUpdateUrl(Platform.OS);+ await Linking.openURL(url);+ return;+ }++ if (updateKind !== "ota" || !isSupported) {+ return;+ }++ try {+ if (status === "ready") {+ await Updates.reloadAsync();+ return;+ }++ setStatus("downloading");+ const result = await Updates.fetchUpdateAsync();+ if (!result.isNew) {+ setUpdateKind(null);+ setStatus("idle");+ if (english) {+ Alert.alert("No update", "No downloadable in-app update was found.");+ } else {+ Alert.alert("暂无更新", "没有可下载的应用内更新。");+ }+ return;+ }++ setStatus("ready");+ Alert.alert(+ english ? "Update ready" : "更新已就绪",+ english ? "Restart now to apply the update." : "重启后即可应用更新。",+ [+ {+ text: english ? "Later" : "稍后",+ style: "cancel",+ },+ {+ text: english ? "Restart" : "立即重启",+ onPress: () => {+ void Updates.reloadAsync();+ },+ },+ ]+ );+ } catch {+ setStatus("available");+ Alert.alert(+ english ? "Update failed" : "更新失败",+ english+ ? "Could not download the in-app update. Try again later."+ : "无法下载应用内更新,请稍后再试。"+ );+ }+ }, [english, isSupported, status, updateKind]);+const value = useMemo<MobileUpdateContextValue>(() => ({checkForUpdate: () => {return runCheck(true);},- hasUpdate: status === "available" || status === "ready",+ hasUpdate: status === "available" || status === "ready" || status === "downloading",+ installedVersion,isSupported,+ openUpdate,status,+ updateKind,}),- [isSupported, runCheck, status]+ [installedVersion, isSupported, openUpdate, runCheck, status, updateKind]);return <MobileUpdateContext.Provider value={value}>{children}</MobileUpdateContext.Provider>;diff --git a/apps/mobile/src/lib/preferences-update-toast.test.ts b/apps/mobile/src/lib/preferences-update-toast.test.tsnew file mode 100644index 00000000..6ed083c7--- /dev/null+++ b/apps/mobile/src/lib/preferences-update-toast.test.ts@@ -0,0 +1,16 @@+import { expect, test } from "bun:test";+import { shouldShowMobileUpdateToastForVersion } from "./preferences";++test("shows the update toast only once per installed version", () => {+ expect(shouldShowMobileUpdateToastForVersion("1.12.2", null)).toBe(true);+ expect(shouldShowMobileUpdateToastForVersion("1.12.2", "1.12.2")).toBe(false);+});++test("allows a new toast after the installed package version changes", () => {+ expect(shouldShowMobileUpdateToastForVersion("1.13.0", "1.12.2")).toBe(true);+});++test("does not show when the installed version is unknown", () => {+ expect(shouldShowMobileUpdateToastForVersion(null, null)).toBe(false);+ expect(shouldShowMobileUpdateToastForVersion(undefined, "1.12.2")).toBe(false);+});diff --git a/apps/mobile/src/lib/preferences.ts b/apps/mobile/src/lib/preferences.tsindex d25ebc8f..dc71d593 100644--- a/apps/mobile/src/lib/preferences.ts+++ b/apps/mobile/src/lib/preferences.ts@@ -4,6 +4,7 @@ const MEMO_LIST_DENSITY_KEY = "edgeever.mobile.memoListDensity";const IMAGE_COMPRESSION_KEY = "edgeever.mobile.imageCompressionEnabled";const LOCALE_PREFERENCE_KEY = "edgeever.mobile.localePreference";const THEME_PREFERENCE_KEY = "edgeever.mobile.themePreference";+const UPDATE_TOAST_DISMISSED_VERSION_KEY = "edgeever.mobile.updateToastDismissedVersion";export type MobileMemoListDensity = "preview" | "compact";export type MobileLocalePreference = "system" | "zh-CN" | "en-US";@@ -37,4 +38,16 @@ export const readMobileThemePreference = async (): Promise<MobileThemePreferenceexport const writeMobileThemePreference = (theme: MobileThemePreference) => AsyncStorage.setItem(THEME_PREFERENCE_KEY, theme);+/** Installed app version for which the update toast was already shown (until the user upgrades). */+export const readMobileUpdateToastDismissedVersion = async () => AsyncStorage.getItem(UPDATE_TOAST_DISMISSED_VERSION_KEY);++export const writeMobileUpdateToastDismissedVersion = (installedVersion: string) =>+ AsyncStorage.setItem(UPDATE_TOAST_DISMISSED_VERSION_KEY, installedVersion);++/** Show the toast only once per installed version while a newer package is available. */+export const shouldShowMobileUpdateToastForVersion = (+ installedVersion: string | null | undefined,+ dismissedForVersion: string | null | undefined+) => Boolean(installedVersion) && dismissedForVersion !== installedVersion;+const isMobileLocalePreference = (value: unknown): value is MobileLocalePreference => value === "system" || value === "zh-CN" || value === "en-US";diff --git a/apps/mobile/src/screens/WorkspaceSettingsView.tsx b/apps/mobile/src/screens/WorkspaceSettingsView.tsxindex 9dcf00d9..12059ae0 100644--- a/apps/mobile/src/screens/WorkspaceSettingsView.tsx+++ b/apps/mobile/src/screens/WorkspaceSettingsView.tsx@@ -58,6 +58,7 @@ export const SettingsView = ({}) => {const { resolvedTheme, toggleTheme } = useMobileTheme();const { translate } = useMobileLocale();+ const { hasUpdate } = useMobileUpdate();const [activeTab, setActiveTab] = useState<SettingsTab | null>(null);const [localePickerOpen, setLocalePickerOpen] = useState(false);const [localePickerAnchor, setLocalePickerAnchor] = useState<{ left: number; top: number; width: number } | null>(null);@@ -67,6 +68,7 @@ export const SettingsView = ({{ key: "account", label: "登录设置", icon: <ShieldCheck color="#059669" size={17} /> },];const systemInfoCopy = getMobileSystemInfoText(localePreference);+ const systemInfoDescription = hasUpdate ? systemInfoCopy.updateAvailableDescription : systemInfoCopy.description;const activeTabItem = activeTab === "system"? { label: systemInfoCopy.title, icon: <Info color="#059669" size={17} /> }: tabs.find((tab) => tab.key === activeTab);@@ -196,12 +198,23 @@ export const SettingsView = ({))}</View><View style={styles.settingsMenu}>- <Pressable accessibilityRole="button" onPress={() => setActiveTab("system")} style={styles.settingsMenuRow}>+ <Pressable+ accessibilityHint={hasUpdate ? systemInfoCopy.updateAvailableDescription : undefined}+ accessibilityLabel={hasUpdate ? `${systemInfoCopy.title},${systemInfoCopy.updateAvailableTitle}` : systemInfoCopy.title}+ accessibilityRole="button"+ onPress={() => setActiveTab("system")}+ style={styles.settingsMenuRow}+ ><View style={styles.settingsMenuLabel}><View style={styles.settingsMenuIcon}><Info color="#059669" size={17} /></View><View style={styles.settingsFeedbackCopy}>- <Text style={styles.settingsMenuText}>{systemInfoCopy.title}</Text>- <Text style={styles.settingsFeedbackDescription}>{systemInfoCopy.description}</Text>+ <View style={styles.settingsMenuTitleRow}>+ <Text style={styles.settingsMenuText}>{systemInfoCopy.title}</Text>+ {hasUpdate ? <View accessibilityElementsHidden importantForAccessibility="no-hide-descendants" style={styles.updateDot} /> : null}+ </View>+ <Text style={[styles.settingsFeedbackDescription, hasUpdate && styles.settingsUpdateDescription]}>+ {systemInfoDescription}+ </Text></View></View><ChevronRight color="#94a3b8" size={17} />@@ -278,10 +291,24 @@ const SettingsActionButton = ({const SystemInfoCard = ({ defaultExpanded = false }: { defaultExpanded?: boolean }) => {const [copied, setCopied] = useState(false);const [expanded, setExpanded] = useState(defaultExpanded);- const { checkForUpdate, hasUpdate, status } = useMobileUpdate();+ const { checkForUpdate, hasUpdate, openUpdate, status, updateKind } = useMobileUpdate();const localePreference = useMobileLocalePreference();+ const english = isEnglishMobileLocale(localePreference);const copy = getMobileSystemInfoText(localePreference);const infoItems = getMobileSystemInfoItems(localePreference);+ const description = hasUpdate ? copy.updateAvailableDescription : copy.description;+ const checking = status === "checking";+ const downloading = status === "downloading";+ const checkLabel = checking+ ? (english ? "Checking…" : "正在检查…")+ : (english ? "Check for updates" : "检查更新");+ const openUpdateLabel = downloading+ ? (english ? "Downloading…" : "正在下载…")+ : status === "ready"+ ? (english ? "Restart to apply" : "重启以应用")+ : updateKind === "ota"+ ? (english ? "Download update" : "下载更新")+ : copy.openUpdate;const copySystemInfo = async () => {await Clipboard.setStringAsync(infoItems.map((item) => `${item.label}: ${item.value}`).join("\n"));@@ -296,23 +323,36 @@ const SystemInfoCard = ({ defaultExpanded = false }: { defaultExpanded?: boolean<View style={styles.settingsGroupHeader}><Info color="#047857" size={16} /><Text style={styles.settingsGroupTitle}>{copy.title}</Text>- {hasUpdate ? <View accessibilityLabel="有新版本" style={styles.updateDot} /> : null}+ {hasUpdate ? <View accessibilityElementsHidden importantForAccessibility="no-hide-descendants" style={styles.updateDot} /> : null}</View>- <Text style={styles.settingsLinkDescription}>{copy.description}</Text>+ <Text style={[styles.settingsLinkDescription, hasUpdate && styles.settingsUpdateDescription]}>{description}</Text></View>{expanded ? <ChevronDown color="#94a3b8" size={17} /> : <ChevronRight color="#94a3b8" size={17} />}</Pressable>{expanded ? (<View style={styles.settingsAccordionContent}>- <SettingsActionButton label={copied ? "已复制" : "复制信息"} onPress={copySystemInfo}>+ <SettingsActionButton label={copied ? (english ? "Copied" : "已复制") : (english ? "Copy info" : "复制信息")} onPress={copySystemInfo}>{copied ? <ShieldCheck color="#047857" size={16} /> : <Copy color="#0f172a" size={16} />}</SettingsActionButton>+ {hasUpdate ? (+ <SettingsActionButton+ disabled={downloading}+ label={openUpdateLabel}+ onPress={() => void openUpdate()}+ >+ {downloading+ ? <ActivityIndicator color="#047857" size="small" />+ : updateKind === "install"+ ? <ExternalLink color="#047857" size={16} />+ : <RefreshCw color="#047857" size={16} />}+ </SettingsActionButton>+ ) : null}<SettingsActionButton- disabled={status === "checking"}- label={status === "checking" ? "正在检查…" : hasUpdate ? "发现新版本" : "检查更新"}+ disabled={checking || downloading}+ label={checkLabel}onPress={() => void checkForUpdate()}>- {status === "checking" ? <ActivityIndicator color="#047857" size="small" /> : <RefreshCw color="#047857" size={16} />}+ {checking ? <ActivityIndicator color="#047857" size="small" /> : <RefreshCw color="#047857" size={16} />}</SettingsActionButton><View style={styles.systemInfoRows}>{Array.from({ length: Math.ceil(infoItems.length / 3) }, (_, rowIndex) => {@@ -364,8 +404,11 @@ const getMobileSystemInfoText = (localePreference: MobileLocaleMode) =>mobileApp: "Mobile app",platformVersion: "System version",timeZone: "Time zone",+ openUpdate: "Get update",title: "System info",unknown: "Unknown",+ updateAvailableDescription: "A new version is available. Tap for details.",+ updateAvailableTitle: "Update available",version: "Version",}: {@@ -385,8 +428,11 @@ const getMobileSystemInfoText = (localePreference: MobileLocaleMode) =>mobileApp: "移动应用",platformVersion: "系统版本",timeZone: "时区",+ openUpdate: "前往更新",title: "系统信息",unknown: "未知",+ updateAvailableDescription: "发现新版本,点按查看详情。",+ updateAvailableTitle: "发现新版本",version: "版本",};diff --git a/apps/mobile/src/screens/workspace-styles.ts b/apps/mobile/src/screens/workspace-styles.tsindex 9c2bf34f..f332e707 100644--- a/apps/mobile/src/screens/workspace-styles.ts+++ b/apps/mobile/src/screens/workspace-styles.ts@@ -111,6 +111,11 @@ const baseWorkspaceStyles = StyleSheet.create({fontSize: 14,fontWeight: "700",},+ settingsMenuTitleRow: {+ alignItems: "center",+ flexDirection: "row",+ gap: 6,+ },settingsFeedbackCopy: {flex: 1,gap: 1,@@ -121,6 +126,10 @@ const baseWorkspaceStyles = StyleSheet.create({fontSize: 12,lineHeight: 17,},+ settingsUpdateDescription: {+ color: "#047857",+ fontWeight: "600",+ },settingsFeedbackIcon: {backgroundColor: "#f1f5f9",},