Merge upstream main preserving custom feature integrations

This commit is contained in:
MasterControl committed 2026-11-10 17:08:15 +00:00
commit 6150a1ac57
228 files changed
+16844 -1388

No files matched your search

+49 -10
View File
@@ -24,7 +24,6 @@ import {
type AsrModelId,
} from "../../native/asr-model";
import { TextViewerLayer } from "../../apps/files/text-viewer";
import { IOS_PRIVACY_NOTICE } from "../../analytics/privacy-disclosure";
import type { LayerContext } from "../layers";
import { drawRightValueMenuItem, openModalMenu, submenuItem, type MenuItem } from "../menu";
import { shell } from "../shell/shell";
@@ -61,6 +60,7 @@ import {
dataCollectionSetting,
distanceUnitSetting,
glassesBatteryVisibilitySetting,
glassesModelName,
phoneBatteryVisibilitySetting,
ringBatteryVisibilitySetting,
watchBatteryVisibilitySetting,
@@ -74,6 +74,7 @@ import {
previewScalingSetting,
phoneRotationSetting,
ringConnectionModeSetting,
glassesTypeSetting,
sonioxApiKeySetting,
saveTranscribeAudioSetting,
whisperServerApiKeySetting,
@@ -85,6 +86,7 @@ import {
firmwareDebugFlagsSetting,
lockScreenEnabledSetting,
menuAnimationSetting,
newNotificationDisplaySetting,
saveVoiceRecordingsSetting,
showBleBandwidthSetting,
suspendEvenHubWhenScreenOffSetting,
@@ -109,9 +111,13 @@ import {
import { wearBridge } from "../../native/wear-bridge";
import { openSettingsSubMenu, SettingsPanelLayer, type SettingsSection } from "./settings-panel";
import { uiFontPickerMenuItem } from "../font-picker";
import { NotificationFilterLayer } from "../notification-filter";
import { compatibleModelDiscoveryMenuItem } from "../openai-compatible-model-picker";
import { isVeniceApiBaseUrl } from "../../native/openai-chat";
/** The Settings section the Notifications app's "Settings" menu item opens. */
export const NOTIFICATIONS_SETTINGS_SECTION = "Notifications";
/** The Settings app's master-detail panel (sections on the left, contents on the right). */
export function createSettingsPanelLayer(): SettingsPanelLayer {
return new SettingsPanelLayer(settingsSections());
@@ -127,7 +133,7 @@ function settingsSections(): SettingsSection[] {
// the dashboard controller when changed and on each connect.
enumSettingMenuItem(brightnessSetting),
autoBrightnessMenuItem(),
...(!global.isIOS ? [toggleSettingMenuItem(headUpWakeSetting), enumSettingMenuItem(headUpAngleSetting)] : []),
...(!global.isIOS && glassesTypeSetting.get() === "g2" ? [toggleSettingMenuItem(headUpWakeSetting), enumSettingMenuItem(headUpAngleSetting)] : []),
enumSettingMenuItem(screenTimeoutSetting, {
onChange: () => {
shell.noteUserActivity();
@@ -149,6 +155,14 @@ function settingsSections(): SettingsSection[] {
return customizationItems();
},
},
{
// Also opened from the Notifications app's menu (deep link by label).
label: NOTIFICATIONS_SETTINGS_SECTION,
items: [
enumSettingMenuItem(newNotificationDisplaySetting),
notificationFilterMenuItem(),
],
},
{
label: "Voice",
items: [
@@ -254,7 +268,7 @@ function settingsSections(): SettingsSection[] {
items: [
// Whether and how the phone opens its own BLE link to the R1 ring.
// Applied at connect time.
enumSettingMenuItem(ringConnectionModeSetting),
ringConnectionMenuItem(),
toggleSettingMenuItem(saveVoiceRecordingsSetting),
toggleSettingMenuItem(firmwareDebugFlagsSetting),
toggleSettingMenuItem(suspendEvenHubWhenScreenOffSetting),
@@ -267,11 +281,6 @@ function settingsSections(): SettingsSection[] {
items: [
// First chosen in the on-glasses onboarding (app/apps/onboarding/).
enumSettingMenuItem(dataCollectionSetting),
...(global.isIOS ? [{
label: "iOS / TestFlight privacy",
description: "Apple's beta reports are separate from Faceclaw statistics. Tap to read.",
onSelect: (ctx: LayerContext) => ctx.stack.push(new TextViewerLayer(IOS_PRIVACY_NOTICE, "iOS / TestFlight privacy")),
}] : []),
bundledDocMenuItem("PRIVACY", "Privacy policy"),
],
},
@@ -303,7 +312,7 @@ function settingsSections(): SettingsSection[] {
];
if (!global.isIOS) return sections;
return sections.map(section => {
if (section.label === "Developer") return { ...section, items: [enumSettingMenuItem(ringConnectionModeSetting),
if (section.label === "Developer") return { ...section, items: [ringConnectionMenuItem(),
toggleSettingMenuItem(showBleBandwidthSetting)] };
// No downloadable on-device models: iOS's on-device option is Apple's recognizer.
if (section.label === "Voice") return { label: "Voice", items: [enumSettingMenuItem(wakeWordActionSetting),
@@ -362,6 +371,17 @@ function customizationRows(): () => MenuItem[] {
};
}
/** Notifications > Notification filter: per-app toggles for notifications shown on the glasses. */
function notificationFilterMenuItem(): MenuItem {
return submenuItem(
"Notification filter",
(ctx) => {
ctx.stack.push(new NotificationFilterLayer());
},
{ description: "Disabled apps are hidden from glasses popups, the notification list, and the tray. Their notifications remain on your phone." },
);
}
function autoBrightnessMenuItem(): MenuItem {
return submenuItem(
"Auto-brightness",
@@ -391,7 +411,8 @@ function batteryIndicatorsMenuItem(): MenuItem {
enumSettingMenuItem(batteryDisplayModeSetting),
enumSettingMenuItem(phoneBatteryVisibilitySetting),
enumSettingMenuItem(watchBatteryVisibilitySetting),
enumSettingMenuItem(glassesBatteryVisibilitySetting),
// Named as the top bar names this indicator.
enumSettingMenuItem(glassesBatteryVisibilitySetting, { label: glassesModelName() }),
enumSettingMenuItem(ringBatteryVisibilitySetting),
]);
},
@@ -624,6 +645,24 @@ function readBundledDoc(fileName: string): string {
}
}
/**
* Developer > Ring connection: the setting, except with a RayNeo iO, which
* always takes the ring directly (effectiveRingConnectionMode): then a fixed,
* disabled "Direct" row, the stored choice kept for G2 glasses.
*/
function ringConnectionMenuItem(): MenuItem {
const item = enumSettingMenuItem(ringConnectionModeSetting);
const io = () => glassesTypeSetting.get() !== "g2";
return {
...item,
disabled: io,
render: (args) => {
if (!io()) return item.render?.(args);
drawRightValueMenuItem(args.image, getDefaultSmallFont(), args.x, args.y, args.width, item.label, glassesTypeSetting.get() === "g1" ? "Direct (Even G1)" : "Direct (RayNeo iO)");
},
};
}
function renderWatchStatus(args: { image: GrayImage; x: number; y: number; width: number }): number {
const { image, x, y, width } = args;
const font = getDefaultSmallFont();
+25 -1
View File
@@ -36,6 +36,8 @@ const ROW_GAP = 2;
/** Horizontal inset of row text (and custom row content) from its selection box. */
const ROW_TEXT_X = 10;
const MAX_DESCRIPTION_LINES = 3;
/** Rows a section's list keeps beside its detail while focus is in it (see detailCrowdsList). */
const MIN_LIST_ROWS = 3;
// A throwaway menu to satisfy MenuItem.onSelect's second parameter; the
// settings items never use it (they act via ctx only).
const NO_MENU = new MenuLayer(null, []);
@@ -134,7 +136,7 @@ export class SettingsPanelLayer implements Layer {
const rightX = divX + 14;
const rightW = width - rightX - PAD;
let rightTop = top;
if (section.renderDetail) {
if (section.renderDetail && !this.detailCrowdsList(section, ctx, font, { x: rightX, y: top, width: rightW, height: listBottom - top })) {
const used = section.renderDetail({ image, x: rightX, y: top, width: rightW, height: listBottom - top, ctx });
rightTop = typeof used === "number" ? Math.min(top + used, listBottom) : listBottom;
}
@@ -157,6 +159,28 @@ export class SettingsPanelLayer implements Layer {
return image;
}
/**
* Whether the section's detail (About's blurb, the watch status) would
* leave its rows less than MIN_LIST_ROWS while focus is in them, as on a
* short screen (the RayNeo iO's): the list then takes the whole pane, the
* detail staying in the preview. Measured by drawing the detail on a
* scratch image.
*/
private detailCrowdsList(
section: SettingsSection,
ctx: LayerContext,
font: UiFont,
pane: { x: number; y: number; width: number; height: number },
): boolean {
if (this.focus !== "right" || !section.items.length || !section.renderDetail) return false;
const scratch = new GrayImage(pane.x + pane.width, pane.y + pane.height, 0);
const used = section.renderDetail({ image: scratch, ...pane, ctx });
if (typeof used !== "number") return false;
const rows = Math.min(MIN_LIST_ROWS, section.items.length);
const room = pane.height - used - this.descriptionHeight(font, pane.width);
return room < rows * (listRowHeight(font) + ROW_GAP);
}
/** The selected item's wrapped help text, or [] when none applies. */
private descriptionLines(font: UiFont, rightW: number): string[] {
if (this.focus !== "right") return [];