Skip to content

Commit 21a3669

Browse files
fix(mobile): prevent OTA update restart crashes (#6324)
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
1 parent b3b4b57 commit 21a3669

13 files changed

Lines changed: 959 additions & 34 deletions

apps/mobile/src/features/home/HomeRouteScreen.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { useSavedRemoteConnections } from "../../state/use-remote-environment-re
1111
import { useAdaptiveWorkspaceLayout } from "../layout/AdaptiveWorkspaceLayout";
1212
import { WorkspaceEmptyDetail } from "../layout/WorkspaceEmptyDetail";
1313
import { WorkspaceSidebarToolbar } from "../layout/workspace-sidebar-toolbar";
14-
import { checkForAppUpdateOnLaunch } from "../updates/app-updates";
14+
import { checkForAppUpdateOnLaunch, startAppUpdateForegroundRecheck } from "../updates/app-updates";
1515
import { AndroidHomeFabLayout } from "./AndroidHomeFab";
1616
import { HomeScreen } from "./HomeScreen";
1717
import { HomeHeader } from "./HomeHeader";
@@ -34,6 +34,7 @@ export function HomeRouteScreen() {
3434

3535
useEffect(() => {
3636
void checkForAppUpdateOnLaunch();
37+
startAppUpdateForegroundRecheck();
3738
}, []);
3839

3940
const {

apps/mobile/src/features/settings/SettingsRouteScreen.tsx

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -608,7 +608,10 @@ function AppSettingsSection() {
608608
if (updateInFlight.current) return;
609609
updateInFlight.current = true;
610610
try {
611+
// The user asked for this restart by tapping the version row, so it may
612+
// apply immediately instead of prompting.
611613
await runAppUpdateCheck({
614+
applyMode: "immediate",
612615
onFailure: (message) => Alert.alert("Update failed", message),
613616
onStateChange: setUpdateState,
614617
});
@@ -631,11 +634,15 @@ function AppSettingsSection() {
631634
? "Checking…"
632635
: updateState === "downloading"
633636
? "Downloading…"
634-
: updateState === "restarting"
635-
? "Restarting…"
636-
: updateState === "current"
637-
? "Up to date"
638-
: null;
637+
: // "ready" appears only when this check joined an in-flight background-mode
638+
// check; that download installs at the next backgrounding.
639+
updateState === "ready"
640+
? "Update ready"
641+
: updateState === "restarting"
642+
? "Restarting…"
643+
: updateState === "current"
644+
? "Up to date"
645+
: null;
639646

640647
const versionRow = (
641648
<View className="flex-row items-center gap-4 p-4">

0 commit comments

Comments
 (0)