From 512584b4f165c2b1b69adc58a005cfda4fb75d3f Mon Sep 17 00:00:00 2001 From: Maurice Date: Fri, 27 Nov 2026 21:48:56 +0100 Subject: [PATCH] fix(native): catch the status bar style call where the app has no status bar plugin An unanswered rejection from StatusBar.setStyle surfaced in the sign-in screen's tests, where the web build has no such plugin. Unimplemented is no failure; anything else is reported as the other native calls are. --- client/src/native/appBoot.ts | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/client/src/native/appBoot.ts b/client/src/native/appBoot.ts index a9e17f851..0dc8cdaf9 100644 --- a/client/src/native/appBoot.ts +++ b/client/src/native/appBoot.ts @@ -1,5 +1,7 @@ import { StatusBar, Style } from '@capacitor/status-bar'; import { isNativeAndroid, isNativeApp } from './platform'; +import { reportNativeFailure } from './reportFailure'; +import { isUnimplemented } from './trekShell'; /** * The handover from the app's address screen to this server's UI. @@ -98,9 +100,16 @@ const ANDROID_WEBVIEW_UNDER_BARS = 140; */ export function lightStatusBarIcons(): () => void { if (!isNativeApp() || !pageUnderStatusBar()) return () => undefined; - void StatusBar.setStyle({ style: Style.Dark }); + setStatusBarStyle(Style.Dark); return () => { const dark = document.documentElement.classList.contains('dark'); - void StatusBar.setStyle({ style: dark ? Style.Dark : Style.Light }); + setStatusBarStyle(dark ? Style.Dark : Style.Light); }; } + +/** Where there is no status bar to style (a build without the plugin) nothing is wrong. */ +function setStatusBarStyle(style: Style): void { + StatusBar.setStyle({ style }).catch((err: unknown) => { + if (!isUnimplemented(err)) reportNativeFailure(err); + }); +}