forked from Blendman974/faceclaw
Minor refactoring
This commit is contained in:
1 parent
f38366df6e
commit
63f515b8a6
3 files changed
+3
-59
No files matched your search
@@ -1,12 +1,5 @@
|
|||||||
import { ImageSource } from "@nativescript/core";
|
import { ImageSource } from "@nativescript/core";
|
||||||
import {
|
import { EvenAIStatus, EvenAIStatusName, EventSourceType, EventSourceTypeName, OsEventTypeList, OsEventTypeName } from "./events";
|
||||||
EvenAIStatus,
|
|
||||||
EvenAIStatusName,
|
|
||||||
EventSourceType,
|
|
||||||
EventSourceTypeName,
|
|
||||||
OsEventTypeList,
|
|
||||||
OsEventTypeName,
|
|
||||||
} from "./events";
|
|
||||||
import { loadDeviceAddresses } from "./device-addresses";
|
import { loadDeviceAddresses } from "./device-addresses";
|
||||||
import { ensureBlePermissions, ensureVoicePermissions } from "./android-permissions";
|
import { ensureBlePermissions, ensureVoicePermissions } from "./android-permissions";
|
||||||
import { FaceclawCommunicatorBridge, type RawInputEvent } from "../native/faceclaw-communicator";
|
import { FaceclawCommunicatorBridge, type RawInputEvent } from "../native/faceclaw-communicator";
|
||||||
@@ -32,41 +25,12 @@ import { assistantBridge } from "../assistant/bridge-client";
|
|||||||
import { registerWindowTools } from "../assistant/window-tools";
|
import { registerWindowTools } from "../assistant/window-tools";
|
||||||
import { WorkerAppHost } from "../ui/shell/worker-window";
|
import { WorkerAppHost } from "../ui/shell/worker-window";
|
||||||
import { ALL_APPS } from "../apps/all-apps";
|
import { ALL_APPS } from "../apps/all-apps";
|
||||||
import {
|
import { type AppContext, type AppDefinition, type AppLaunchParams, type TextEditorHost } from "../apps/app-definition";
|
||||||
type AppContext,
|
|
||||||
type AppDefinition,
|
|
||||||
type AppLaunchParams,
|
|
||||||
type TextEditorHost,
|
|
||||||
} from "../apps/app-definition";
|
|
||||||
import { type InProcessAppOptions, type InProcessWindow } from "../ui/shell/in-process-window";
|
import { type InProcessAppOptions, type InProcessWindow } from "../ui/shell/in-process-window";
|
||||||
import { loadPersistedOpenApps, savePersistedOpenApps } from "../ui/shell/open-apps-persistence";
|
import { loadPersistedOpenApps, savePersistedOpenApps } from "../ui/shell/open-apps-persistence";
|
||||||
import { appViewportRect, type WindowHeightMode } from "../ui/shell/geometry";
|
import { appViewportRect, type WindowHeightMode } from "../ui/shell/geometry";
|
||||||
import { type LayerActions } from "../ui/layers";
|
import { type LayerActions } from "../ui/layers";
|
||||||
import {
|
import { assistantAllowProactiveSetting, assistantBackendSetting, assistantBridgeHostSetting, assistantBridgePortSetting, assistantBridgeTokenSetting, brightnessSetting, brightnessSettingToLevel, elevenLabsApiKeySetting, openAiApiKeySetting, nightscoutApiTokenSetting, firmwareDebugFlagsSetting, lockScreenEnabledSetting, nightscoutSiteUrlSetting, onAnySettingChanged, saveVoiceRecordingsSetting, screenTimeoutSetting, screenTimeoutSettingToMs, suspendEvenHubWhenScreenOffSetting, verticalPositionSetting, voiceProviderSetting, wakeWordActionSetting, type ConfigSettingString } from "../ui/dashboard-settings";
|
||||||
assistantAllowProactiveSetting,
|
|
||||||
assistantBackendSetting,
|
|
||||||
assistantBridgeHostSetting,
|
|
||||||
assistantBridgePortSetting,
|
|
||||||
assistantBridgeTokenSetting,
|
|
||||||
brightnessSetting,
|
|
||||||
brightnessSettingToLevel,
|
|
||||||
elevenLabsApiKeySetting,
|
|
||||||
openAiApiKeySetting,
|
|
||||||
nightscoutApiTokenSetting,
|
|
||||||
firmwareDebugFlagsSetting,
|
|
||||||
lockScreenEnabledSetting,
|
|
||||||
nightscoutSiteUrlSetting,
|
|
||||||
onAnySettingChanged,
|
|
||||||
saveVoiceRecordingsSetting,
|
|
||||||
screenTimeoutSetting,
|
|
||||||
screenTimeoutSettingToMs,
|
|
||||||
suspendEvenHubWhenScreenOffSetting,
|
|
||||||
systemCardNameSetting,
|
|
||||||
verticalPositionSetting,
|
|
||||||
voiceProviderSetting,
|
|
||||||
wakeWordActionSetting,
|
|
||||||
type ConfigSettingString,
|
|
||||||
} from "../ui/dashboard-settings";
|
|
||||||
import { isIgnoringBatteryOptimizations, requestIgnoreBatteryOptimizations } from "../native/battery-optimization";
|
import { isIgnoringBatteryOptimizations, requestIgnoreBatteryOptimizations } from "../native/battery-optimization";
|
||||||
|
|
||||||
type ConnectionPhase = "disconnected" | "connecting" | "connected" | "charging" | "disconnecting";
|
type ConnectionPhase = "disconnected" | "connecting" | "connected" | "charging" | "disconnecting";
|
||||||
@@ -793,10 +757,6 @@ class DashboardController {
|
|||||||
openEvenAppSettings();
|
openEvenAppSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
setSystemCardName(name: string): void {
|
|
||||||
this.updateTextSetting(systemCardNameSetting, name);
|
|
||||||
}
|
|
||||||
|
|
||||||
setActiveTextSettingValue(value: string): void {
|
setActiveTextSettingValue(value: string): void {
|
||||||
shell.noteUserActivity();
|
shell.noteUserActivity();
|
||||||
const setting = this.activeTextSetting;
|
const setting = this.activeTextSetting;
|
||||||
|
|||||||
@@ -422,10 +422,6 @@ export class MainViewModel extends Observable {
|
|||||||
this.showLog = !this.showLog;
|
this.showLog = !this.showLog;
|
||||||
}
|
}
|
||||||
|
|
||||||
onSystemCardNameTextChange(args: { value?: string; object?: { text?: string } }): void {
|
|
||||||
dashboardController.setSystemCardName(args.object?.text ?? args.value ?? "");
|
|
||||||
}
|
|
||||||
|
|
||||||
onTextSettingTextChange(args: { value?: string; object?: { text?: string } }): void {
|
onTextSettingTextChange(args: { value?: string; object?: { text?: string } }): void {
|
||||||
dashboardController.setActiveTextSettingValue(args.object?.text ?? args.value ?? "");
|
dashboardController.setActiveTextSettingValue(args.object?.text ?? args.value ?? "");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -193,18 +193,6 @@ export class ConfigSettingString<TId extends string = string> extends ConfigSett
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export const systemCardNameSetting = new ConfigSettingString({
|
|
||||||
id: "dashboard-name",
|
|
||||||
label: "Dashboard name",
|
|
||||||
storageKey: "dashboard.systemCardName",
|
|
||||||
defaultValue: "Faceclaw",
|
|
||||||
editorTitle: "Dashboard name",
|
|
||||||
glassesEditTitle: "Edit dashboard name",
|
|
||||||
normalize: normalizeSystemCardName,
|
|
||||||
formatValue: (value) => value || "Faceclaw",
|
|
||||||
description: "Title text shown on the dashboard's system card.",
|
|
||||||
});
|
|
||||||
|
|
||||||
export const batteryDisplayModeSetting = new ConfigSettingEnum<BatteryDisplayMode>({
|
export const batteryDisplayModeSetting = new ConfigSettingEnum<BatteryDisplayMode>({
|
||||||
id: "batteryDisplayMode",
|
id: "batteryDisplayMode",
|
||||||
label: "Battery display",
|
label: "Battery display",
|
||||||
|
|||||||
Reference in new issue
Block a user