From 6e052e487ee51d7d24f8ac10e4c14af746faabfb Mon Sep 17 00:00:00 2001 From: DIYgod Date: Thu, 30 Apr 2026 16:56:23 +0800 Subject: [PATCH] feat(mobile): show OTA version in about --- .../src/modules/settings/routes/About.tsx | 32 +++++++++++++++++-- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/apps/mobile/src/modules/settings/routes/About.tsx b/apps/mobile/src/modules/settings/routes/About.tsx index c98150bb6..0cd56c39b 100644 --- a/apps/mobile/src/modules/settings/routes/About.tsx +++ b/apps/mobile/src/modules/settings/routes/About.tsx @@ -1,4 +1,6 @@ import { nativeApplicationVersion, nativeBuildVersion } from "expo-application" +import type { Manifest } from "expo-updates" +import * as Updates from "expo-updates" import { Trans, useTranslation } from "react-i18next" import { Linking, View } from "react-native" @@ -53,10 +55,36 @@ const links = [ iconColor: "#FFFFFF", }, ] + +const normalizeOtaVersion = (version: string | null | undefined) => { + const normalizedVersion = version?.trim() + return normalizedVersion || null +} + +const resolveOtaReleaseVersion = (manifest: Partial | undefined) => { + if (!manifest || !("metadata" in manifest)) { + return null + } + + const { metadata } = manifest + if (!metadata || typeof metadata !== "object") { + return null + } + + const releaseVersion = Reflect.get(metadata, "releaseVersion") + return typeof releaseVersion === "string" ? normalizeOtaVersion(releaseVersion) : null +} + export const AboutScreen = () => { const { t } = useTranslation("settings") const buildId = nativeBuildVersion const appVersion = nativeApplicationVersion + const { currentlyRunning } = Updates.useUpdates() + const otaVersion = + resolveOtaReleaseVersion(currentlyRunning.manifest) ?? + normalizeOtaVersion(currentlyRunning.runtimeVersion) ?? + normalizeOtaVersion(Updates.runtimeVersion) + const appVersionLabel = `${appVersion} (${buildId})${otaVersion ? ` ยท OTA ${otaVersion}` : ""}` const { distribution, platform, rateTarget, storageKey, userId } = useMobileReviewPromptState() const handleRateFolo = async () => { @@ -109,9 +137,7 @@ export const AboutScreen = () => { Folo - - {appVersion} ({buildId}) - + {appVersionLabel}