From deac81f98f72d9b9d7046b63ddeccfb92d0d69ed Mon Sep 17 00:00:00 2001 From: James Babcock Date: Wed, 19 Aug 2026 00:49:18 -0700 Subject: [PATCH] EvenHub app uses logo; move login from the Settings app into the EvenHub app --- app/apps/app-definition.ts | 3 + app/apps/evenhub/credentials.ts | 36 +++++++ app/apps/evenhub/even-api.ts | 38 +++++--- app/apps/evenhub/index.ts | 10 +- app/apps/evenhub/store-layer.ts | 119 ++++++++++++++++++++---- app/apps/launcher/index.ts | 7 +- app/g2/dashboard-controller.ts | 62 ++++++++++--- app/graphics/even-realities-logo.ts | 45 +++++++++ app/images/EvenRealitiesLogo.png | Bin 0 -> 483 bytes app/phone-ui/main-page.ts | 10 +- app/phone-ui/main-page.xml | 20 +++- app/phone-ui/main-view-model.ts | 139 +++++++++++++++++++++++++++- app/ui/dashboard-settings.ts | 28 +----- app/ui/dashboard/settings-menus.ts | 9 -- app/ui/layers.ts | 7 ++ 15 files changed, 443 insertions(+), 90 deletions(-) create mode 100644 app/apps/evenhub/credentials.ts create mode 100644 app/graphics/even-realities-logo.ts create mode 100644 app/images/EvenRealitiesLogo.png diff --git a/app/apps/app-definition.ts b/app/apps/app-definition.ts index 169f1553..eadf3f06 100644 --- a/app/apps/app-definition.ts +++ b/app/apps/app-definition.ts @@ -1,3 +1,4 @@ +import { type GrayImage } from "../graphics/image"; import { type Plane } from "../graphics/plane"; import { type IconName } from "../graphics/icons"; import { type LayerActions } from "../ui/layers"; @@ -18,6 +19,8 @@ export type AppDefinition = { title: string; /** Launcher-grid icon. */ icon: IconName; + /** App-supplied launcher icon renderer; icon remains the fallback. */ + renderIcon?: (size: number) => GrayImage | null; /** Open the app's window (or focus it if already open). */ launch: (ctx: AppContext, params?: AppLaunchParams) => Promise; /** diff --git a/app/apps/evenhub/credentials.ts b/app/apps/evenhub/credentials.ts new file mode 100644 index 00000000..2273c750 --- /dev/null +++ b/app/apps/evenhub/credentials.ts @@ -0,0 +1,36 @@ +import { ConfigSettingString } from "../../ui/dashboard-settings"; + +/** + * EvenHub owns its account configuration. The storage keys intentionally + * match the former Settings-app entries so existing users stay signed in. + */ +export const evenHubEmailSetting = new ConfigSettingString({ + id: "evenhub-email", + label: "Email", + storageKey: "integrations.evenhub.email", + defaultValue: "", + editorTitle: "Email", + glassesEditTitle: "Edit Even email", + inputKind: "email", + normalize: (value) => (value ?? "").replace(/[\x00-\x1f]+/g, "").trim(), +}); + +export const evenHubPasswordSetting = new ConfigSettingString({ + id: "evenhub-password", + label: "Password", + storageKey: "integrations.evenhub.password", + defaultValue: "", + editorTitle: "Password", + glassesEditTitle: "Edit Even password", + inputKind: "password", + normalize: (value) => (value ?? "").replace(/[\x00-\x1f]+/g, ""), + formatValue: (value) => (value ? "(set)" : "(not set)"), +}); + +export function hasEvenHubCredentials(): boolean { + return Boolean(evenHubEmailSetting.get().trim() && evenHubPasswordSetting.get()); +} + +export function clearEvenHubPassword(): void { + evenHubPasswordSetting.set(""); +} diff --git a/app/apps/evenhub/even-api.ts b/app/apps/evenhub/even-api.ts index fa29aab4..bc548eeb 100644 --- a/app/apps/evenhub/even-api.ts +++ b/app/apps/evenhub/even-api.ts @@ -6,7 +6,7 @@ * the same signed-header scheme used by the firmware API. */ import { Application } from "@nativescript/core"; -import { evenHubEmailSetting, evenHubPasswordSetting } from "../../ui/dashboard-settings"; +import { evenHubEmailSetting, evenHubPasswordSetting, hasEvenHubCredentials } from "./credentials"; declare const android: any; @@ -60,7 +60,14 @@ export type EvenHubAppDownload = { }; export function isEvenHubStoreConfigured(): boolean { - return Boolean(evenHubEmailSetting.get().trim() && evenHubPasswordSetting.get()); + return hasEvenHubCredentials(); +} + +export class EvenHubAuthenticationError extends Error { + constructor(message: string) { + super(message); + this.name = "EvenHubAuthenticationError"; + } } export class EvenHubApiClient { @@ -162,7 +169,7 @@ export class EvenHubApiClient { private ensureLogin(): Promise { if (this.token) return Promise.resolve(this.token); if (!isEvenHubStoreConfigured()) { - return Promise.reject(new Error("Set the EvenHub email and password in Settings > EvenHub.")); + return Promise.reject(new EvenHubAuthenticationError("Enter your Even account email and password.")); } if (!this.loginPromise) { this.loginPromise = this.login().finally(() => { @@ -173,15 +180,20 @@ export class EvenHubApiClient { } private async login(): Promise { - const response = await this.request("POST", "/v2/g/login", { - commonVersion: 1, - body: { email: evenHubEmailSetting.get().trim(), passwd: evenHubPasswordSetting.get() }, - }); - const data = asRecord(unwrap(response.envelope, response.httpStatus, "/v2/g/login")); - const token = typeof data.token === "string" ? data.token : ""; - if (!token) throw new Error("Even login succeeded without returning a session token."); - this.token = token; - return token; + try { + const response = await this.request("POST", "/v2/g/login", { + commonVersion: 1, + body: { email: evenHubEmailSetting.get().trim(), passwd: evenHubPasswordSetting.get() }, + }); + const data = asRecord(unwrap(response.envelope, response.httpStatus, "/v2/g/login")); + const token = typeof data.token === "string" ? data.token : ""; + if (!token) throw new Error("Even login succeeded without returning a session token."); + this.token = token; + return token; + } catch (error) { + if (error instanceof EvenHubAuthenticationError) throw error; + throw new EvenHubAuthenticationError(String((error as Error)?.message ?? error)); + } } private async request( @@ -321,7 +333,7 @@ async function fetchWithTimeout(url: string, init: RequestInit, timeoutMs = REQU function unwrap(envelope: ApiEnvelope, httpStatus: number, path: string): unknown { if (httpStatus === 401) { - throw new Error("Even rejected the login session. Check Settings > EvenHub."); + throw new EvenHubAuthenticationError("Even rejected the login session."); } if (httpStatus < 200 || httpStatus >= 300) { throw new Error(`EvenHub request failed (HTTP ${httpStatus}, ${path}).`); diff --git a/app/apps/evenhub/index.ts b/app/apps/evenhub/index.ts index 63731881..c7d6aeca 100644 --- a/app/apps/evenhub/index.ts +++ b/app/apps/evenhub/index.ts @@ -12,6 +12,8 @@ import { shell } from "../../ui/shell/shell"; import { EvenHubStoreLayer } from "./store-layer"; import { launchPackage } from "./manager"; import { createInProcessWindow, type InProcessWindow } from "../../ui/shell/in-process-window"; +import { renderEvenRealitiesLogo } from "../../graphics/even-realities-logo"; +import { makeImageWindowIcon, windowIcon } from "../../ui/shell/chrome-layer"; const EVENHUB_STORE_WINDOW_ID = "evenhub:store"; const EVENHUB_STORE_SURFACE_ID = "window:evenhub:store"; @@ -28,6 +30,7 @@ const evenhubApp: AppDefinition = { appId: "evenhub", title: "EvenHub", icon: "package", + renderIcon: renderEvenRealitiesLogo, launch: async (ctx) => { const existing = shell.getWindows().find((window) => window.windowId === EVENHUB_STORE_WINDOW_ID); if (existing) { @@ -38,7 +41,6 @@ const evenhubApp: AppDefinition = { let created: InProcessWindow | null = null; const store = new EvenHubStoreLayer({ launchApp: (appId) => ctx.launchApp(appId), - openSettings: () => ctx.launchApp("settings", { section: "EvenHub" }), appendLog: ctx.appendLog, }); await ctx.launchInProcessApp(EVENHUB_STORE_WINDOW_ID, EVENHUB_STORE_SURFACE_ID, (options) => { @@ -48,6 +50,7 @@ const evenhubApp: AppDefinition = { title: "EvenHub", iconLetter: "EH", icon: "package", + drawIcon: makeImageWindowIcon(renderEvenRealitiesLogo, windowIcon("package", "EH")), closeable: true, menuItems: () => (created?.stack.isAtBase() ? store.buildMenuItems() : []), actions: options.actions, @@ -55,7 +58,10 @@ const evenhubApp: AppDefinition = { submitFrame: options.submitFrame, setSurfaceVisible: options.setSurfaceVisible, removeSurface: options.removeSurface, - onClosed: options.onClosed, + onClosed: () => { + store.closeCredentialEditor(options.actions); + options.onClosed(); + }, }); return created; }); diff --git a/app/apps/evenhub/store-layer.ts b/app/apps/evenhub/store-layer.ts index 9e667ca7..5cc11e3e 100644 --- a/app/apps/evenhub/store-layer.ts +++ b/app/apps/evenhub/store-layer.ts @@ -1,9 +1,9 @@ import { getDefaultSmallFont } from "../../graphics/bdffont"; import { GrayImage } from "../../graphics/image"; -import { truncateText } from "../../graphics/textwrap"; +import { truncateText, wrapText } from "../../graphics/textwrap"; import { clamp } from "../../util/numeric-util"; import { GESTURE_CLICK, GESTURE_DOUBLE_CLICK, GESTURE_SCROLL } from "../../ui/gestures"; -import { type DashboardInputEvent, type Layer, type LayerContext } from "../../ui/layers"; +import { type DashboardInputEvent, type Layer, type LayerActions, type LayerContext } from "../../ui/layers"; import { drawListScrollbar, drawSelectionHighlight, @@ -11,7 +11,17 @@ import { type MenuItem, } from "../../ui/menu"; import { shell } from "../../ui/shell/shell"; -import { evenHubApi, isEvenHubStoreConfigured, type EvenHubStoreApp } from "./even-api"; +import { + evenHubApi, + EvenHubAuthenticationError, + isEvenHubStoreConfigured, + type EvenHubStoreApp, +} from "./even-api"; +import { + clearEvenHubPassword, + evenHubEmailSetting, + evenHubPasswordSetting, +} from "./credentials"; import { EvenHubStoreDetailLayer } from "./store-detail-layer"; const HEADER_HEIGHT = 34; @@ -21,7 +31,6 @@ const LIST_X = 18; export type EvenHubStoreLayerOptions = { launchApp: (appId: string) => Promise | void; - openSettings: () => Promise | void; appendLog: (message: string) => void; }; @@ -34,14 +43,20 @@ export class EvenHubStoreLayer implements Layer { private nextPage = 1; private started = false; private loading = false; - private status = ""; + private showingLogin = !isEvenHubStoreConfigured(); + private status = this.showingLogin ? "Sign in to browse public apps." : ""; + private credentialEditorOpen = false; constructor(private readonly options: EvenHubStoreLayerOptions) {} paint(ctx: LayerContext): GrayImage { if (!this.started) { this.started = true; - void this.reload(ctx); + if (this.showingLogin) { + this.openCredentialEditor(ctx); + } else { + void this.reload(ctx); + } } const font = getDefaultSmallFont(); @@ -49,11 +64,26 @@ export class EvenHubStoreLayer implements Layer { const image = new GrayImage(width, height, 0); image.drawText(font, LIST_X, 8, "EvenHub", 220); - const subtitle = !isEvenHubStoreConfigured() - ? "Set account details in Settings > EvenHub" - : this.status || (this.total ? `${this.apps.length} of ${this.total} public apps` : "Public apps"); + const subtitle = this.status || (this.total ? `${this.apps.length} of ${this.total} public apps` : "Public apps"); image.drawText(font, LIST_X, 22, truncateText(font, subtitle, width - LIST_X * 2), 125); + if (this.showingLogin) { + const message = this.loading + ? "Signing in..." + : "Enter your Even account email and password in the phone app."; + for (const [index, line] of wrapText(font, message, width - LIST_X * 2).entries()) { + image.drawText(font, LIST_X, HEADER_HEIGHT + 22 + index * 15, line, 190); + } + image.drawText( + font, + LIST_X, + height - 16, + truncateText(font, `${GESTURE_CLICK} edit credentials ${GESTURE_DOUBLE_CLICK} back`, width - LIST_X * 2), + 105, + ); + return image; + } + if (this.apps.length === 0) { const message = this.loading ? "Loading apps..." : this.status || "No apps returned."; image.drawText(font, LIST_X, HEADER_HEIGHT + 28, truncateText(font, message, width - LIST_X * 2), 190); @@ -83,14 +113,20 @@ export class EvenHubStoreLayer implements Layer { } } - const hint = !isEvenHubStoreConfigured() - ? `${GESTURE_CLICK} settings ${GESTURE_DOUBLE_CLICK} back` - : `${GESTURE_SCROLL} select ${GESTURE_CLICK} details ${GESTURE_DOUBLE_CLICK} back`; + const hint = `${GESTURE_SCROLL} select ${GESTURE_CLICK} details ${GESTURE_DOUBLE_CLICK} back`; image.drawText(font, LIST_X, height - 16, truncateText(font, hint, width - LIST_X * 2), 105); return image; } async handleInput(event: DashboardInputEvent, ctx: LayerContext): Promise { + if (this.showingLogin) { + if (event.type === "click" && !this.loading) { + this.openCredentialEditor(ctx); + } else if (event.type === "double-click") { + shell.yieldFocusToSidebar(); + } + return; + } switch (event.type) { case "scroll-up": this.selectedIndex = Math.max(0, this.selectedIndex - 1); @@ -102,10 +138,6 @@ export class EvenHubStoreLayer implements Layer { } return; case "click": - if (!isEvenHubStoreConfigured()) { - await this.options.openSettings(); - return; - } if (!this.loading) { const app = this.apps[this.selectedIndex]; if (app) { @@ -127,6 +159,7 @@ export class EvenHubStoreLayer implements Layer { } buildMenuItems(): MenuItem[] { + if (this.showingLogin) return []; return [ { label: "Refresh", @@ -136,15 +169,23 @@ export class EvenHubStoreLayer implements Layer { }, }, { - label: "EvenHub settings", + label: "Log Out", onSelect: (ctx) => { ctx.stack.pop(); - void this.options.openSettings(); + clearEvenHubPassword(); + evenHubApi.clearSession(); + this.enterLogin(ctx, "Signed out."); }, }, ]; } + closeCredentialEditor(actions: Pick): void { + if (!this.credentialEditorOpen) return; + this.credentialEditorOpen = false; + void actions.endTextSettingEdit(); + } + private async reload(ctx: LayerContext): Promise { if (this.loading) return; evenHubApi.clearSession(); @@ -155,7 +196,7 @@ export class EvenHubStoreLayer implements Layer { this.scrollRow = 0; this.status = ""; if (!isEvenHubStoreConfigured()) { - ctx.actions.requestRender(); + this.enterLogin(ctx); return; } await this.loadNextPage(ctx); @@ -174,7 +215,13 @@ export class EvenHubStoreLayer implements Layer { this.nextPage = page.page + 1; this.status = ""; } catch (error) { - this.status = cleanError(error); + const message = cleanError(error); + if (error instanceof EvenHubAuthenticationError) { + this.options.appendLog(`evenhub store login failed: ${message}`); + this.enterLogin(ctx, `Login failed: ${message}`); + return; + } + this.status = message; this.options.appendLog(`evenhub store: ${this.status}`); } finally { this.loading = false; @@ -182,6 +229,38 @@ export class EvenHubStoreLayer implements Layer { } } + private enterLogin(ctx: LayerContext, status = "Sign in to browse public apps."): void { + this.showingLogin = true; + this.loading = false; + this.apps = []; + this.total = 0; + this.status = status; + this.openCredentialEditor(ctx); + ctx.actions.requestRender(); + } + + private openCredentialEditor(ctx: LayerContext): void { + if (this.credentialEditorOpen) return; + this.credentialEditorOpen = true; + void ctx.actions.startTextSettingsEdit( + [evenHubEmailSetting, evenHubPasswordSetting], + "Sign in to EvenHub", + () => { + this.credentialEditorOpen = false; + void this.submitCredentials(ctx); + }, + ); + } + + private async submitCredentials(ctx: LayerContext): Promise { + if (!isEvenHubStoreConfigured()) { + this.enterLogin(ctx, "Email and password are required."); + return; + } + this.showingLogin = false; + await this.reload(ctx); + } + } function cleanError(error: unknown): string { diff --git a/app/apps/launcher/index.ts b/app/apps/launcher/index.ts index 7bbc2f7c..1d3786cc 100644 --- a/app/apps/launcher/index.ts +++ b/app/apps/launcher/index.ts @@ -25,7 +25,12 @@ const launcherApp: AppDefinition = { apps: () => [ ...ctx.apps .filter((app) => app.showInLauncher !== false) - .map((app) => ({ appId: app.appId, label: app.title, icon: app.icon })), + .map((app) => ({ + appId: app.appId, + label: app.title, + icon: app.icon, + renderIcon: app.renderIcon, + })), ...getInstalledEvenHubApps().map((app) => ({ appId: installedEvenHubAppId(app.packageId), label: app.name, diff --git a/app/g2/dashboard-controller.ts b/app/g2/dashboard-controller.ts index e05f7670..ec2f841b 100644 --- a/app/g2/dashboard-controller.ts +++ b/app/g2/dashboard-controller.ts @@ -57,8 +57,14 @@ export type DashboardSnapshot = { */ displayPreviewMessage: string; activeTextSettingId: string | null; + activeTextEditorTitle: string; activeTextSettingTitle: string; activeTextSettingValue: string; + activeTextSettingInputKind: "text" | "email" | "password"; + secondaryTextSettingId: string | null; + secondaryTextSettingTitle: string; + secondaryTextSettingValue: string; + secondaryTextSettingInputKind: "text" | "email" | "password"; evenAppConflictMessage: string; evenAppConflictWarningVisible: boolean; firmwareWarningMessage: string; @@ -142,7 +148,9 @@ class DashboardController { private phase: ConnectionPhase = "disconnected"; private status = "Disconnected."; private log = ""; - private activeTextSetting: ConfigSettingString | null = null; + private activeTextSettings: ConfigSettingString[] = []; + private activeTextEditorTitle = ""; + private activeTextEditorOnFinish: (() => void) | null = null; private evenNotificationActive = false; private evenAppConflictMessage = ""; private firmwareWarningMessage = ""; @@ -212,6 +220,11 @@ class DashboardController { const sharedActions = { disconnect: () => this.disconnect(), startTextSettingEdit: (setting: ConfigSettingString) => this.startTextSettingEdit(setting), + startTextSettingsEdit: ( + settings: readonly ConfigSettingString[], + title: string, + onFinish?: () => void, + ) => this.startTextSettingsEdit(settings, title, onFinish), endTextSettingEdit: () => this.endTextSettingEdit(), startVoiceCapture: () => this.startVoiceCapture(), stopVoiceCapture: () => this.stopVoiceCapture(), @@ -683,15 +696,23 @@ class DashboardController { } snapshot(): DashboardSnapshot { + const primaryTextSetting = this.activeTextSettings[0] ?? null; + const secondaryTextSetting = this.activeTextSettings[1] ?? null; return { phase: this.phase, status: this.status, log: this.log, displayPreview: this.displayPreview, displayPreviewMessage: this.displayPreviewMessage(), - activeTextSettingId: this.activeTextSetting?.id ?? null, - activeTextSettingTitle: this.activeTextSetting?.editorTitle ?? "", - activeTextSettingValue: this.activeTextSetting?.get() ?? "", + activeTextSettingId: primaryTextSetting?.id ?? null, + activeTextEditorTitle: this.activeTextEditorTitle, + activeTextSettingTitle: primaryTextSetting?.editorTitle ?? "", + activeTextSettingValue: primaryTextSetting?.get() ?? "", + activeTextSettingInputKind: primaryTextSetting?.inputKind ?? "text", + secondaryTextSettingId: secondaryTextSetting?.id ?? null, + secondaryTextSettingTitle: secondaryTextSetting?.editorTitle ?? "", + secondaryTextSettingValue: secondaryTextSetting?.get() ?? "", + secondaryTextSettingInputKind: secondaryTextSetting?.inputKind ?? "text", evenAppConflictMessage: this.evenAppConflictMessage, evenAppConflictWarningVisible: this.evenAppConflictMessage.length > 0, firmwareWarningMessage: this.firmwareWarningMessage, @@ -771,9 +792,11 @@ class DashboardController { openEvenAppSettings(); } - setActiveTextSettingValue(value: string): void { + setActiveTextSettingValue(value: string, settingId?: string): void { shell.noteUserActivity(); - const setting = this.activeTextSetting; + const setting = settingId + ? this.activeTextSettings.find((candidate) => candidate.id === settingId) ?? null + : this.activeTextSettings[0] ?? null; if (!setting) return; if (setting.get() === value) return; setting.set(value); @@ -1182,7 +1205,17 @@ class DashboardController { } private startTextSettingEdit(setting: ConfigSettingString): void { - this.activeTextSetting = setting; + this.startTextSettingsEdit([setting], setting.editorTitle); + } + + private startTextSettingsEdit( + settings: readonly ConfigSettingString[], + title: string, + onFinish?: () => void, + ): void { + this.activeTextSettings = Array.from(settings.slice(0, 2)); + this.activeTextEditorTitle = title; + this.activeTextEditorOnFinish = onFinish ?? null; this.emit(); } @@ -1236,10 +1269,12 @@ class DashboardController { } private endTextSettingEdit(): void { - const finishedSetting = this.activeTextSetting; - this.activeTextSetting = null; + const finishedSettings = this.activeTextSettings; + this.activeTextSettings = []; + this.activeTextEditorTitle = ""; + this.activeTextEditorOnFinish = null; this.emit(); - if (finishedSetting === nightscoutSiteUrlSetting || finishedSetting === nightscoutApiTokenSetting) { + if (finishedSettings.includes(nightscoutSiteUrlSetting) || finishedSettings.includes(nightscoutApiTokenSetting)) { void this.refreshNightscoutAfterSettingsChange(); } } @@ -1250,11 +1285,14 @@ class DashboardController { * out of the edit page. */ finishActiveTextSettingEdit(): void { - if (!this.activeTextSetting) return; + if (!this.activeTextSettings.length) return; + const onFinish = this.activeTextEditorOnFinish; + const closesGlassesEditor = this.activeTextSettings.length === 1; this.endTextSettingEdit(); - if (this.textEditorHost?.closeTextEditor()) { + if (closesGlassesEditor && this.textEditorHost?.closeTextEditor()) { this.textEditorHost.requestRender(); } + onFinish?.(); } private updateTextSetting(setting: ConfigSettingString, value: string): void { diff --git a/app/graphics/even-realities-logo.ts b/app/graphics/even-realities-logo.ts new file mode 100644 index 00000000..45f3c9dc --- /dev/null +++ b/app/graphics/even-realities-logo.ts @@ -0,0 +1,45 @@ +import { GrayImage } from "./image"; +import { loadPngAsGrayImage } from "./imagefile"; + +const LOGO_PATH = "images/EvenRealitiesLogo.png"; + +let sourceLogo: GrayImage | null | undefined; +const scaledLogos = new Map(); + +/** Render the bundled Even Realities logo at launcher/sidebar icon size. */ +export function renderEvenRealitiesLogo(size: number): GrayImage | null { + const targetSize = Math.max(1, Math.round(size)); + const cached = scaledLogos.get(targetSize); + if (cached) return cached; + + if (sourceLogo === undefined) { + try { + sourceLogo = loadPngAsGrayImage(LOGO_PATH); + } catch (error) { + console.warn(`Could not load ${LOGO_PATH}: ${error}`); + sourceLogo = null; + } + } + if (!sourceLogo) return null; + + const scaled = scaleToFit(sourceLogo, targetSize, targetSize); + scaledLogos.set(targetSize, scaled); + return scaled; +} + +function scaleToFit(source: GrayImage, maxWidth: number, maxHeight: number): GrayImage { + const scale = Math.min(maxWidth / source.width, maxHeight / source.height, 1); + const width = Math.max(1, Math.round(source.width * scale)); + const height = Math.max(1, Math.round(source.height * scale)); + if (width === source.width && height === source.height) return source; + + const output = new GrayImage(width, height, 0); + for (let y = 0; y < height; y++) { + const sourceY = Math.min(source.height - 1, Math.floor(((y + 0.5) * source.height) / height)); + for (let x = 0; x < width; x++) { + const sourceX = Math.min(source.width - 1, Math.floor(((x + 0.5) * source.width) / width)); + output.pixels[y * width + x] = source.pixels[sourceY * source.width + sourceX]!; + } + } + return output; +} diff --git a/app/images/EvenRealitiesLogo.png b/app/images/EvenRealitiesLogo.png new file mode 100644 index 0000000000000000000000000000000000000000..72dac6c51584f359326a4bb16f6c57a620430047 GIT binary patch literal 483 zcmeAS@N?(olHy`uVBq!ia0vp^2SAtuNHCOdH@*#|n3BBRT^Rni_n+AhHvWoPl|SBY_*7VR;7VuCtJ3bA|JBm%Ze6?nVTtvoSq;eW);Gpr^-a?cpZfli@!g3mCKPy^-DmEJIzH|5 p-P=l~=asmJ2?wA+n3EY8X8&MSb{FWj { const textField = page.getViewById('settingsTextField') + const secondaryTextField = page.getViewById('secondarySettingsTextField') if (textField) { applySettingsTextFieldContrast(textField) } + if (secondaryTextField) { + applySettingsTextFieldContrast(secondaryTextField) + } textField?.focus() }, 0) } @@ -139,7 +143,7 @@ export function loaded(args: EventData) { } if (propertyArgs.propertyName === 'activeTextSettingId') { if (model.isTextSettingEditorActive) { - focusSystemNameField(page) + focusTextEditor(page) } return } @@ -160,7 +164,7 @@ export function loaded(args: EventData) { setPageState(page, state) scrollLogsToBottom(scrollViews) if (model.isTextSettingEditorActive) { - focusSystemNameField(page) + focusTextEditor(page) } } diff --git a/app/phone-ui/main-page.xml b/app/phone-ui/main-page.xml index bf7bc295..98f51b4a 100644 --- a/app/phone-ui/main-page.xml +++ b/app/phone-ui/main-page.xml @@ -105,15 +105,31 @@ visibility="{{ textSettingEditorVisibility }}" horizontalAlignment="stretch" verticalAlignment="top"> +