Files
faceclaw/app/phone-ui/main-view-model.ts
T
James Babcock 97fad7ae2b Add Permissions screen to the onboarding flow, replacing scattered permissions prompts happening later
<details>
<summary>Prompts Used</summary>
Let's add a Permissions screen, to concentrate the various Android permissions requests. This will be shown during onboarding, in between the "Before You Continue" screen and the "Custom Firmware Required" screen. There will also be a "Permissions" menu item in the main screen menu.

Each permission will be a card, styled similarly to the device-selection cards on the Pair Your Glasses screen. Each card will have the title for the permission, some text explaining what the permission is used for, and a checkmark if the permission is already present. The permissions needed are:

Nearby Devices: Needed to communicate with your smart glasses over bluetooth
Send Notifications: A notification will be pinned, to keep Faceclaw running while your phone screen is off.
Battery Optimization: Needed to keep running while your phone screen is off.
Read Notifications: (Optional) Needed to display your Android notification on the glasses.
Microphone: (Optional) Needed to use voice input.
Location: (Optional) Needed to use location-based features like navigation inside glasses apps.
Calendar: (Optional) Needed to display your calendar on the glasses.

> Done — the Permissions screen is in place, builds cleanly, and all the permissions it requests were already declared in the manifest.
>
> **What was added:**
>
> - **New screen** (`app/phone-ui/permissions-page.{xml,ts}` + `permissions-view-model.ts`): one card per permission, reusing the pairing page's card styling (`pairing-row`, `pairing-title`, `pairing-badge`) so they match the device-selection cards. Each card shows the title, the explanation text you specified, and a green ✓ when granted. Tapping an ungranted card launches its grant flow; granted cards ignore taps. The four optional permissions get an "Optional" badge (matching the pairing page's badge style) instead of a "(Optional)" text prefix.
> - **Onboarding wiring**: "Agree" on Before You Continue now navigates to the permissions page, and its "Next" button navigates forward to a fresh onboarding page starting at the Custom Firmware Required step (`onboarding-page.ts` now accepts a `step` context; `OnboardingViewModel` takes an initial step). "Back" returns to the disclaimer.
> - **Main menu**: a "Permissions" popup item on the main page opens the same screen in standalone mode — action bar shown, single "Done" button.
> - **Permission plumbing** (`app/g2/android-permissions.ts`): new granular helpers — `hasBlePermissions`/`requestBlePermissions` (BLE only, split out of the old combined BLE+notifications request), `hasPostNotificationsPermission`/`requestPostNotificationsPermission` (reports granted pre-Android 13, where no runtime permission exists), and `hasMicrophonePermission`/`requestMicrophonePermission`. Existing `ensureBlePermissions` behavior is unchanged for its current callers.
>
> Two of the cards — Battery Optimization and Read Notifications — aren't runtime permissions; they open system screens (the existing `battery-optimization.ts` and `notification-access.ts` natives). Since Android reports their state only on return, the page re-checks all statuses on `Application.resume` (listener attached on page load, detached on unload) so checkmarks appear when you come back.
>
> Two judgment calls worth flagging: the Location checkmark tracks **fine** location (navigation needs precise fixes — "approximate only" leaves it unchecked and re-tappable), and I wrote "your Android notifications" (plural) in the Read Notifications card. This is all hardware-test pending, as usual — the flows to exercise are onboarding step 2 → Permissions → step 3, each card's grant dialog, and the resume-refresh after the battery/notification-access settings detours.
<hr>
Thanks. Let's make it so that the Continue button looks grayed out if you haven't selected all of the required permissions. It will still be active in this case, but will open a "You haven't enabled all of the necessary permissions. Are you sure you want to continue?" prompt. Also, let's add 8px of extra margin between the permission titles and the Optional badge.

> Both changes are in and the build passes.
>
> - **Grayed-out Continue**: the onboarding primary button now binds a `primaryClass` — while any of the three required permissions (Nearby Devices, Send Notifications, Battery Optimization) is missing, it gets a `permissions-primary-dimmed` class (opacity 0.45) so it looks disabled while staying tappable. Tapping it in that state shows a confirm dialog — "You haven't enabled all of the necessary permissions. Are you sure you want to continue?" with Continue/Go Back buttons — and only proceeds to the firmware step on Continue. The class re-evaluates on every refresh, so granting the last required permission un-dims the button immediately. I also renamed the onboarding label from "Next" to "Continue" to match how you referred to it (and the pairing page's onboarding button). Menu mode's "Done" never dims, since there's nothing to warn about when just closing the screen.
> - **Badge spacing**: the "Optional" badge's left margin went from the `m-l-6` class to an explicit `marginLeft="14"` (+8), set inline since the theme doesn't generate an `m-l-14` class.
</details>
2026-08-25 11:28:53 -07:00

614 lines
21 KiB
TypeScript

import { Application, Frame, ImageSource, Observable, Screen } from "@nativescript/core";
import { dashboardController } from "../g2/dashboard-controller";
import { isValidMacAddress, loadDeviceAddresses } from "../g2/device-addresses";
import { isAutoReconnectSuppressed, resumeAutoReconnect } from "../g2/reconnect-policy";
import { formatErrorMessage } from "../util/format-error";
import { G2_LENS_HEIGHT, G2_LENS_WIDTH } from "../graphics/image";
const LENS_ASPECT_RATIO = G2_LENS_WIDTH / G2_LENS_HEIGHT;
type LayoutOrientation = "portrait" | "landscape";
export class MainViewModel extends Observable {
private _status = "Disconnected.";
private _displayPreview: ImageSource | null = null;
private _displayPreviewMessage = "";
private _layoutOrientation: LayoutOrientation = this.readLayoutOrientation();
private _activeTextSettingId: string | null = null;
private _activeTextEditorTitle = "";
private _activeTextSettingTitle = "";
private _activeTextSettingValue = "";
private _activeTextSettingInputKind: "text" | "email" | "password" = "text";
private _secondaryTextSettingId: string | null = null;
private _secondaryTextSettingTitle = "";
private _secondaryTextSettingValue = "";
private _secondaryTextSettingInputKind: "text" | "email" | "password" = "text";
private _evenAppConflictMessage = "";
private _evenAppConflictWarningVisible = false;
private _firmwareWarningMessage = "";
private _firmwareWarningVisible = false;
private _screenRecordingActive = false;
private _batteryOptimizationWarningVisible = false;
private _phase: "disconnected" | "connecting" | "connected" | "charging" | "disconnecting" = "disconnected";
constructor() {
super();
dashboardController.subscribe((snapshot) => {
this.status = snapshot.status;
this.displayPreview = snapshot.displayPreview;
this.displayPreviewMessage = snapshot.displayPreviewMessage;
this.phase = snapshot.phase;
this.activeTextSettingId = snapshot.activeTextSettingId;
this.activeTextEditorTitle = snapshot.activeTextEditorTitle;
this.activeTextSettingTitle = snapshot.activeTextSettingTitle;
this.activeTextSettingValue = snapshot.activeTextSettingValue;
this.activeTextSettingInputKind = snapshot.activeTextSettingInputKind;
this.secondaryTextSettingId = snapshot.secondaryTextSettingId;
this.secondaryTextSettingTitle = snapshot.secondaryTextSettingTitle;
this.secondaryTextSettingValue = snapshot.secondaryTextSettingValue;
this.secondaryTextSettingInputKind = snapshot.secondaryTextSettingInputKind;
this.evenAppConflictMessage = snapshot.evenAppConflictMessage;
this.evenAppConflictWarningVisible = snapshot.evenAppConflictWarningVisible;
this.firmwareWarningMessage = snapshot.firmwareWarningMessage;
this.firmwareWarningVisible = snapshot.firmwareWarningVisible;
this.screenRecordingActive = snapshot.screenRecordingActive;
this.batteryOptimizationWarningVisible = snapshot.batteryOptimizationWarningVisible;
});
}
get status(): string {
return this._status;
}
set status(value: string) {
if (this._status !== value) {
this._status = value;
this.notifyPropertyChange("status", value);
}
}
get displayPreview(): ImageSource | null {
return this._displayPreview;
}
set displayPreview(value: ImageSource | null) {
if (this._displayPreview !== value) {
this._displayPreview = value;
this.notifyPropertyChange("displayPreview", value);
this.notifyPropertyChange("hasDisplayPreview", this.hasDisplayPreview);
this.notifyPropertyChange("displayPreviewVisibility", this.displayPreviewVisibility);
}
}
get displayPreviewMessage(): string {
return this._displayPreviewMessage;
}
set displayPreviewMessage(value: string) {
if (this._displayPreviewMessage !== value) {
this._displayPreviewMessage = value;
this.notifyPropertyChange("displayPreviewMessage", value);
this.notifyPropertyChange("displayPreviewMessageVisibility", this.displayPreviewMessageVisibility);
this.notifyPropertyChange("displayPreviewVisibility", this.displayPreviewVisibility);
}
}
get hasDisplayPreview(): boolean {
return this._displayPreview !== null;
}
/**
* The preview and its stand-in message are mutually exclusive and occupy the
* same box, so the form doesn't reflow when one replaces the other.
*/
get displayPreviewVisibility(): "visible" | "collapse" {
return this.hasDisplayPreview && !this._displayPreviewMessage ? "visible" : "collapse";
}
get displayPreviewMessageVisibility(): "visible" | "collapse" {
return this._displayPreviewMessage ? "visible" : "collapse";
}
get displayPreviewHeight(): number {
return Screen.mainScreen.widthDIPs / LENS_ASPECT_RATIO;
}
get landscapeDisplayPreviewWidth(): number {
return Math.floor(this.landscapeDisplayPreviewHeight * LENS_ASPECT_RATIO);
}
get landscapeDisplayPreviewHeight(): number {
// Height keeps the vertical footprint the preview had at the old 2:1
// aspect; the width is derived from it, so a wider lens aspect can't
// grow the preview past the side panel.
const screenWidth = Screen.mainScreen.widthDIPs;
const sidePanelWidth = 260;
const availableWidth = Math.max(240, Math.floor(screenWidth - sidePanelWidth - 56));
return Math.floor(availableWidth / 2);
}
get portraitLayoutVisibility(): "visible" | "collapse" {
return this._layoutOrientation === "portrait" ? "visible" : "collapse";
}
get landscapeLayoutVisibility(): "visible" | "collapse" {
return this._layoutOrientation === "landscape" ? "visible" : "collapse";
}
refreshLayoutMetrics(): void {
const nextOrientation = this.readLayoutOrientation();
if (this._layoutOrientation !== nextOrientation) {
this._layoutOrientation = nextOrientation;
this.notifyPropertyChange("portraitLayoutVisibility", this.portraitLayoutVisibility);
this.notifyPropertyChange("landscapeLayoutVisibility", this.landscapeLayoutVisibility);
}
this.notifyPropertyChange("displayPreviewHeight", this.displayPreviewHeight);
this.notifyPropertyChange("landscapeDisplayPreviewWidth", this.landscapeDisplayPreviewWidth);
this.notifyPropertyChange("landscapeDisplayPreviewHeight", this.landscapeDisplayPreviewHeight);
}
get activeTextSettingId(): string | null {
return this._activeTextSettingId;
}
set activeTextSettingId(value: string | null) {
if (this._activeTextSettingId !== value) {
this._activeTextSettingId = value;
this.notifyPropertyChange("activeTextSettingId", value);
this.notifyPropertyChange("textSettingEditorVisibility", this.textSettingEditorVisibility);
this.notifyPropertyChange("isTextSettingEditorActive", this.isTextSettingEditorActive);
}
}
get activeTextSettingTitle(): string {
return this._activeTextSettingTitle;
}
get activeTextEditorTitle(): string {
return this._activeTextEditorTitle;
}
set activeTextEditorTitle(value: string) {
if (this._activeTextEditorTitle !== value) {
this._activeTextEditorTitle = value;
this.notifyPropertyChange("activeTextEditorTitle", value);
}
}
set activeTextSettingTitle(value: string) {
if (this._activeTextSettingTitle !== value) {
this._activeTextSettingTitle = value;
this.notifyPropertyChange("activeTextSettingTitle", value);
}
}
get activeTextSettingValue(): string {
return this._activeTextSettingValue;
}
set activeTextSettingValue(value: string) {
if (this._activeTextSettingValue !== value) {
this._activeTextSettingValue = value;
this.notifyPropertyChange("activeTextSettingValue", value);
}
}
get activeTextSettingInputKind(): "text" | "email" | "password" {
return this._activeTextSettingInputKind;
}
set activeTextSettingInputKind(value: "text" | "email" | "password") {
if (this._activeTextSettingInputKind !== value) {
this._activeTextSettingInputKind = value;
this.notifyPropertyChange("activeTextSettingKeyboardType", this.activeTextSettingKeyboardType);
this.notifyPropertyChange("activeTextSettingSecure", this.activeTextSettingSecure);
}
}
get activeTextSettingKeyboardType(): "email" | "text" {
return this._activeTextSettingInputKind === "email" ? "email" : "text";
}
get activeTextSettingSecure(): boolean {
return this._activeTextSettingInputKind === "password";
}
get secondaryTextSettingId(): string | null {
return this._secondaryTextSettingId;
}
set secondaryTextSettingId(value: string | null) {
if (this._secondaryTextSettingId !== value) {
this._secondaryTextSettingId = value;
this.notifyPropertyChange("secondaryTextSettingId", value);
this.notifyPropertyChange("secondaryTextSettingVisibility", this.secondaryTextSettingVisibility);
this.notifyPropertyChange("hasSecondaryTextSetting", this.hasSecondaryTextSetting);
this.notifyPropertyChange("primaryTextSettingReturnKeyType", this.primaryTextSettingReturnKeyType);
}
}
get secondaryTextSettingTitle(): string {
return this._secondaryTextSettingTitle;
}
set secondaryTextSettingTitle(value: string) {
if (this._secondaryTextSettingTitle !== value) {
this._secondaryTextSettingTitle = value;
this.notifyPropertyChange("secondaryTextSettingTitle", value);
}
}
get secondaryTextSettingValue(): string {
return this._secondaryTextSettingValue;
}
set secondaryTextSettingValue(value: string) {
if (this._secondaryTextSettingValue !== value) {
this._secondaryTextSettingValue = value;
this.notifyPropertyChange("secondaryTextSettingValue", value);
}
}
get secondaryTextSettingInputKind(): "text" | "email" | "password" {
return this._secondaryTextSettingInputKind;
}
set secondaryTextSettingInputKind(value: "text" | "email" | "password") {
if (this._secondaryTextSettingInputKind !== value) {
this._secondaryTextSettingInputKind = value;
this.notifyPropertyChange("secondaryTextSettingKeyboardType", this.secondaryTextSettingKeyboardType);
this.notifyPropertyChange("secondaryTextSettingSecure", this.secondaryTextSettingSecure);
}
}
get secondaryTextSettingKeyboardType(): "email" | "text" {
return this._secondaryTextSettingInputKind === "email" ? "email" : "text";
}
get secondaryTextSettingSecure(): boolean {
return this._secondaryTextSettingInputKind === "password";
}
get hasSecondaryTextSetting(): boolean {
return this._secondaryTextSettingId !== null;
}
get secondaryTextSettingVisibility(): "visible" | "collapse" {
return this.hasSecondaryTextSetting ? "visible" : "collapse";
}
get primaryTextSettingReturnKeyType(): "next" | "done" {
return this.hasSecondaryTextSetting ? "next" : "done";
}
get isTextSettingEditorActive(): boolean {
return this._activeTextSettingId !== null;
}
get textSettingEditorVisibility(): "visible" | "collapse" {
return this.isTextSettingEditorActive ? "visible" : "collapse";
}
get evenAppConflictMessage(): string {
return this._evenAppConflictMessage;
}
set evenAppConflictMessage(value: string) {
if (this._evenAppConflictMessage !== value) {
this._evenAppConflictMessage = value;
this.notifyPropertyChange("evenAppConflictMessage", value);
}
}
get evenAppConflictWarningVisible(): boolean {
return this._evenAppConflictWarningVisible;
}
set evenAppConflictWarningVisible(value: boolean) {
if (this._evenAppConflictWarningVisible !== value) {
this._evenAppConflictWarningVisible = value;
this.notifyPropertyChange("evenAppConflictWarningVisible", value);
this.notifyPropertyChange("evenAppConflictWarningVisibility", this.evenAppConflictWarningVisibility);
}
}
get evenAppConflictWarningVisibility(): "visible" | "collapse" {
return this._evenAppConflictWarningVisible ? "visible" : "collapse";
}
get firmwareWarningMessage(): string {
return this._firmwareWarningMessage;
}
set firmwareWarningMessage(value: string) {
if (this._firmwareWarningMessage !== value) {
this._firmwareWarningMessage = value;
this.notifyPropertyChange("firmwareWarningMessage", value);
}
}
get firmwareWarningVisible(): boolean {
return this._firmwareWarningVisible;
}
set firmwareWarningVisible(value: boolean) {
if (this._firmwareWarningVisible !== value) {
this._firmwareWarningVisible = value;
this.notifyPropertyChange("firmwareWarningVisible", value);
this.notifyPropertyChange("firmwareWarningVisibility", this.firmwareWarningVisibility);
}
}
get firmwareWarningVisibility(): "visible" | "collapse" {
return this._firmwareWarningVisible ? "visible" : "collapse";
}
get screenRecordingActive(): boolean {
return this._screenRecordingActive;
}
set screenRecordingActive(value: boolean) {
if (this._screenRecordingActive !== value) {
this._screenRecordingActive = value;
this.notifyPropertyChange("screenRecordingActive", value);
this.notifyPropertyChange("stopRecordingButtonVisibility", this.stopRecordingButtonVisibility);
}
}
get stopRecordingButtonVisibility(): "visible" | "collapse" {
return this._screenRecordingActive ? "visible" : "collapse";
}
onTakeScreenshotTap(): void {
try {
dashboardController.saveScreenshot();
} catch (error) {
console.error("screenshot failed", error);
}
}
onRecordScreenTap(): void {
try {
dashboardController.startScreenRecording();
} catch (error) {
console.error("screen recording start failed", error);
}
}
onStopRecordingTap(): void {
try {
dashboardController.stopScreenRecording();
} catch (error) {
console.error("screen recording stop failed", error);
}
}
get batteryOptimizationWarningVisible(): boolean {
return this._batteryOptimizationWarningVisible;
}
set batteryOptimizationWarningVisible(value: boolean) {
if (this._batteryOptimizationWarningVisible !== value) {
this._batteryOptimizationWarningVisible = value;
this.notifyPropertyChange("batteryOptimizationWarningVisible", value);
this.notifyPropertyChange("batteryOptimizationWarningVisibility", this.batteryOptimizationWarningVisibility);
}
}
get batteryOptimizationWarningVisibility(): "visible" | "collapse" {
return this._batteryOptimizationWarningVisible ? "visible" : "collapse";
}
onAllowBackgroundUsageTap(): void {
dashboardController.requestBatteryOptimizationExemption();
}
get phase(): "disconnected" | "connecting" | "connected" | "charging" | "disconnecting" {
return this._phase;
}
set phase(value: "disconnected" | "connecting" | "connected" | "charging" | "disconnecting") {
if (this._phase !== value) {
this._phase = value;
this.notifyPropertyChange("phase", value);
this.notifyPropertyChange("buttonLabel", this.buttonLabel);
this.notifyPropertyChange("canRun", this.canRun);
this.notifyPropertyChange("connectItemEnabled", this.connectItemEnabled);
}
}
get buttonLabel(): string {
switch (this.phase) {
case "connecting":
case "connected":
case "charging":
return "Disconnect";
case "disconnecting":
return "Disconnecting...";
default:
return "Connect";
}
}
get canRun(): boolean {
return this.phase !== "connecting" && this.phase !== "disconnecting";
}
/**
* Unlike the other canRun-gated menu items, Connect/Disconnect stays live
* while connecting: Disconnect is the only way out of a reconnection-attempt
* loop short of force-stopping the app.
*/
get connectItemEnabled(): boolean {
return this.phase !== "disconnecting";
}
async onTap(): Promise<void> {
if (!this.connectItemEnabled) return;
try {
if (this.phase === "disconnected") {
await dashboardController.connect();
} else {
await dashboardController.disconnect();
}
} catch (error) {
const message = this.formatError(error);
if (!this.status.startsWith("Failed:")) {
this.status = `Failed: ${message}`;
}
}
}
/**
* Try to connect automatically on reaching the main page. No-op if already
* connecting/connected, if the app is in the manual-disconnected state
* (the user picked Disconnect, the flash flow owns the glasses, or the
* firmware was found incompatible), or if no glasses are configured
* (e.g. preview-only users, who have nothing to connect to).
*/
async autoConnect(): Promise<void> {
if (this.phase !== "disconnected") return;
if (isAutoReconnectSuppressed()) return;
const addresses = loadDeviceAddresses();
if (!isValidMacAddress(addresses.right) || !isValidMacAddress(addresses.left)) return;
try {
await dashboardController.connect();
} catch {
// The controller surfaces failures via status/log; nothing to add here.
}
}
onConfigureTap(): void {
if (!this.canRun) return;
Frame.topmost()?.navigate("phone-ui/config-page");
}
onPermissionsTap(): void {
Frame.topmost()?.navigate({
moduleName: "phone-ui/permissions-page",
context: { onboarding: false },
});
}
/**
* Live scan that names each nearby pair by model, colour, and serial and
* checks both arms belong together. A connected arm stops advertising, so
* drop the current link first. disconnect() enters the manual-disconnected
* state; pairing is a detour, not a Disconnect, so lift the suppression
* right away — nothing dials the glasses until the main page's autoConnect
* runs again on the way back.
*/
async onPairGlassesTap(): Promise<void> {
if (!this.canRun) return;
if (this.phase === "connected" || this.phase === "charging" || this.phase === "connecting") {
try {
await dashboardController.disconnect();
} catch {
// proceed anyway; the pairing page reports what it hears
}
resumeAutoReconnect();
}
Frame.topmost()?.navigate({ moduleName: "phone-ui/pairing-page", context: { onboarding: false } });
}
async onInstallFirmwareTap(): Promise<void> {
await this.openFlashPage("install");
}
async onUninstallFirmwareTap(): Promise<void> {
await this.openFlashPage("uninstall");
}
private async openFlashPage(mode: "install" | "uninstall"): Promise<void> {
// The flasher needs the glasses to itself, so drop the main connection first.
if (this.phase === "connected" || this.phase === "charging") {
try {
await dashboardController.disconnect();
} catch {
// proceed anyway; the flash page surfaces any connection trouble
}
}
Frame.topmost()?.navigate({
moduleName: "phone-ui/onboarding-flash-page",
context: { mode, fromOnboarding: false },
});
}
onTextSettingTextChange(args: { value?: string; object?: { text?: string } }): void {
dashboardController.setActiveTextSettingValue(
args.object?.text ?? args.value ?? "",
this.activeTextSettingId ?? undefined,
);
}
onPrimaryTextSettingReturnPress(args: { object?: { text?: string; page?: { getViewById?: (id: string) => { focus?: () => void } | null } } }): void {
// Commit the field's actual text at done-time, in case the final
// keystroke's textChange hadn't landed yet.
const text = args?.object?.text;
if (typeof text === "string") {
dashboardController.setActiveTextSettingValue(text, this.activeTextSettingId ?? undefined);
}
if (this.hasSecondaryTextSetting) {
args.object?.page?.getViewById?.("secondarySettingsTextField")?.focus?.();
return;
}
dashboardController.finishActiveTextSettingEdit();
}
onSecondaryTextSettingTextChange(args: { value?: string; object?: { text?: string } }): void {
dashboardController.setActiveTextSettingValue(
args.object?.text ?? args.value ?? "",
this.secondaryTextSettingId ?? undefined,
);
}
onSecondaryTextSettingReturnPress(args: { object?: { text?: string } }): void {
const text = args?.object?.text;
if (typeof text === "string") {
dashboardController.setActiveTextSettingValue(text, this.secondaryTextSettingId ?? undefined);
}
dashboardController.finishActiveTextSettingEdit();
}
onOpenEvenAppSettingsTap(): void {
dashboardController.openEvenAppSettings();
}
async onSyntheticUpTap(): Promise<void> {
await dashboardController.injectSyntheticRingInput("scroll-up");
}
async onSyntheticDownTap(): Promise<void> {
await dashboardController.injectSyntheticRingInput("scroll-down");
}
async onSyntheticLeftTap(): Promise<void> {
await dashboardController.injectSyntheticRingInput("double-click");
}
async onSyntheticRightTap(): Promise<void> {
await dashboardController.injectSyntheticRingInput("click");
}
async onSyntheticLongPressTap(): Promise<void> {
await dashboardController.injectSyntheticRingInput("long-press");
}
async onSyntheticMicTap(): Promise<void> {
await dashboardController.injectSyntheticRingInput("wakeword");
}
private readLayoutOrientation(): LayoutOrientation {
const applicationOrientation = Application.orientation();
if (applicationOrientation === "landscape" || applicationOrientation === "portrait") {
return applicationOrientation;
}
return Screen.mainScreen.widthDIPs > Screen.mainScreen.heightDIPs ? "landscape" : "portrait";
}
private formatError(error: unknown): string {
return formatErrorMessage(error, 240);
}
}