forked from Blendman974/faceclaw
Navigate app: Saved destinations
This commit is contained in:
1 parent
c37a9eec45
commit
0fac92c7e4
6 files changed
+779
-36
No files matched your search
@@ -721,6 +721,96 @@ export const nightscoutApiTokenSetting = new ConfigSettingString({
|
||||
description: "Access token for the Nightscout site's API.",
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Navigate app: saved and recent destinations.
|
||||
|
||||
const stripControlChars = (value: string | null | undefined): string =>
|
||||
(value ?? "").replace(/[\x00-\x1f]+/g, "").trim();
|
||||
|
||||
export const navigateHomeAddressSetting = new ConfigSettingString({
|
||||
id: "navigate-home-address",
|
||||
label: "Home address",
|
||||
storageKey: "navigate.homeAddress",
|
||||
defaultValue: "",
|
||||
editorTitle: "Home address",
|
||||
glassesEditTitle: "Set Home address",
|
||||
normalize: stripControlChars,
|
||||
formatValue: emptySettingDisplay,
|
||||
description: "Address (or place name) the Navigate app's Home destination routes to.",
|
||||
});
|
||||
|
||||
export const navigateWorkAddressSetting = new ConfigSettingString({
|
||||
id: "navigate-work-address",
|
||||
label: "Work address",
|
||||
storageKey: "navigate.workAddress",
|
||||
defaultValue: "",
|
||||
editorTitle: "Work address",
|
||||
glassesEditTitle: "Set Work address",
|
||||
normalize: stripControlChars,
|
||||
formatValue: emptySettingDisplay,
|
||||
description: "Address (or place name) the Navigate app's Work destination routes to.",
|
||||
});
|
||||
|
||||
export const navigateRememberRecentSetting = new ConfigSettingBoolean({
|
||||
id: "navigate-remember-recent",
|
||||
label: "Remember recent destinations",
|
||||
storageKey: "navigate.rememberRecent",
|
||||
defaultValue: true,
|
||||
description:
|
||||
"Keep a short list of places you have navigated to, offered as destinations on the Navigate app's start page. Turning this off clears the list.",
|
||||
});
|
||||
|
||||
/**
|
||||
* Custom named destinations beyond Home and Work, as a JSON array of
|
||||
* {id, name, address}. Managed inside the Navigate app (its context menu),
|
||||
* not listed in the Settings app.
|
||||
*/
|
||||
export const navigateSavedDestinationsSetting = new ConfigSettingString({
|
||||
id: "navigate-saved-destinations",
|
||||
label: "Saved destinations",
|
||||
storageKey: "navigate.savedDestinations",
|
||||
defaultValue: "[]",
|
||||
});
|
||||
|
||||
/**
|
||||
* Recently navigated-to places, as a JSON array of {name, place, longitude,
|
||||
* latitude, atMs}, most recent first. Written by the Navigate app when
|
||||
* navigateRememberRecentSetting is on.
|
||||
*/
|
||||
export const navigateRecentDestinationsSetting = new ConfigSettingString({
|
||||
id: "navigate-recent-destinations",
|
||||
label: "Recent destinations",
|
||||
storageKey: "navigate.recentDestinations",
|
||||
defaultValue: "[]",
|
||||
});
|
||||
|
||||
/**
|
||||
* Staging buffers for the Navigate app's add/edit-destination flow: the
|
||||
* worker asks the shell to open the phone text editor on one of these, the
|
||||
* user types (or dictates) the name/address, and the worker reads the draft
|
||||
* when the user confirms on the glasses. Deliberately not listed in the
|
||||
* Settings app.
|
||||
*/
|
||||
export const navigateDestinationNameDraftSetting = new ConfigSettingString({
|
||||
id: "navigate-destination-name-draft",
|
||||
label: "Destination name",
|
||||
storageKey: "navigate.destinationNameDraft",
|
||||
defaultValue: "",
|
||||
editorTitle: "Destination name (e.g. Gym)",
|
||||
glassesEditTitle: "Destination name",
|
||||
normalize: stripControlChars,
|
||||
});
|
||||
|
||||
export const navigateDestinationAddressDraftSetting = new ConfigSettingString({
|
||||
id: "navigate-destination-address-draft",
|
||||
label: "Destination address",
|
||||
storageKey: "navigate.destinationAddressDraft",
|
||||
defaultValue: "",
|
||||
editorTitle: "Destination address or place name",
|
||||
glassesEditTitle: "Destination address",
|
||||
normalize: stripControlChars,
|
||||
});
|
||||
|
||||
|
||||
export function screenTimeoutSettingToMs(value: ScreenTimeoutSetting): number | null {
|
||||
switch (value) {
|
||||
|
||||
@@ -39,6 +39,9 @@ import {
|
||||
elevenLabsApiKeySetting,
|
||||
mapboxApiKeySetting,
|
||||
mirrorTouchSetting,
|
||||
navigateHomeAddressSetting,
|
||||
navigateRememberRecentSetting,
|
||||
navigateWorkAddressSetting,
|
||||
openAiApiKeySetting,
|
||||
previewColorSetting,
|
||||
ringConnectionModeSetting,
|
||||
@@ -65,6 +68,7 @@ import {
|
||||
watchMirrorAssistantSetting,
|
||||
watchRemoteEnabledSetting,
|
||||
} from "../dashboard-settings";
|
||||
import { clearRecentDestinations } from "../../apps/navigate/destinations";
|
||||
import { wearBridge } from "../../native/wear-bridge";
|
||||
import { SettingsPanelLayer, type SettingsSection } from "./settings-panel";
|
||||
import { terminalFontPickerMenuItem, uiFontPickerMenuItem } from "../font-picker";
|
||||
@@ -146,6 +150,20 @@ function settingsSections(): SettingsSection[] {
|
||||
toggleSettingMenuItem(terminalWakeOnBellSetting),
|
||||
],
|
||||
},
|
||||
{
|
||||
label: "Navigate",
|
||||
// Home/Work are plain addresses; other named destinations (and the
|
||||
// recent list) are managed inside the Navigate app's context menu.
|
||||
items: [
|
||||
textSettingMenuItem(navigateHomeAddressSetting),
|
||||
textSettingMenuItem(navigateWorkAddressSetting),
|
||||
toggleSettingMenuItem(navigateRememberRecentSetting, {
|
||||
onChange: (_ctx, enabled) => {
|
||||
if (!enabled) clearRecentDestinations();
|
||||
},
|
||||
}),
|
||||
],
|
||||
},
|
||||
{
|
||||
label: "Phone display",
|
||||
// The phone app's mirror of the glasses screen and its controls
|
||||
|
||||
Reference in new issue
Block a user