forked from Blendman974/faceclaw
iOS TTF support; voice input
This commit is contained in:
1 parent
ae14edcb59
commit
b07ae0b479
67 files changed
+15717
-55
No files matched your search
@@ -59,9 +59,14 @@ export function onAnySettingChanged(listener: () => void): () => void {
|
||||
}
|
||||
|
||||
onSettingsStoreChanged(() => {
|
||||
for (const listener of Array.from(settingChangeListeners)) {
|
||||
listener();
|
||||
}
|
||||
// Font/cache invalidation listeners may register after this relay. Let the
|
||||
// entire store notification finish before observers synchronously repaint.
|
||||
// Otherwise Save updates the label but paints the previous typeface once.
|
||||
setTimeout(() => {
|
||||
for (const listener of Array.from(settingChangeListeners)) {
|
||||
listener();
|
||||
}
|
||||
}, 0);
|
||||
});
|
||||
|
||||
export abstract class ConfigSetting<TValue, TId extends string = string> {
|
||||
|
||||
@@ -233,8 +233,12 @@ function settingsSections(): SettingsSection[] {
|
||||
},
|
||||
];
|
||||
if (!global.isIOS) return sections;
|
||||
const deferred = new Set(["Voice", "Assistant", "Navigate", "Watch", "Developer"]);
|
||||
const deferred = new Set(["Assistant", "Navigate", "Watch", "Developer"]);
|
||||
return sections.map(section => {
|
||||
if (section.label === "Voice") return { label: "Voice", items: [{
|
||||
label: "On-device dictation (Apple)", disabled: true, onSelect: () => {},
|
||||
description: "Uses the glasses microphone and your iPhone's speech language. No API key needed. Open Voice from the phone or glasses menu, speak, then click to finish and send the text into an app.",
|
||||
}] };
|
||||
if (deferred.has(section.label)) return { label: section.label, items: [{
|
||||
label: "Not available on iOS yet", disabled: true, onSelect: () => {},
|
||||
description: `${section.label} integration has not been ported to iOS.`,
|
||||
|
||||
@@ -278,7 +278,6 @@ export class FontPickerLayer implements Layer {
|
||||
|
||||
/** Installed fonts grouped into families (styles sorted by weight). */
|
||||
function collectFamilies(monospaceOnly: boolean): FontFamily[] {
|
||||
if (global.isIOS) return []; // Native TTF rendering has not been ported.
|
||||
const byLabel = new Map<string, FontFamily>();
|
||||
for (const font of listInstalledFonts()) {
|
||||
if (monospaceOnly && !font.monospace) continue;
|
||||
@@ -327,7 +326,7 @@ export function terminalFontPickerMenuItem(): MenuItem {
|
||||
function fontPickerMenuItem(options: FontPickerOptions & { rowLabel: string; description: string }): MenuItem {
|
||||
return {
|
||||
label: options.rowLabel,
|
||||
description: global.isIOS ? "Choose a bundled bitmap font. Native TTF rendering is not available on iOS yet." : options.description,
|
||||
description: options.description,
|
||||
onSelect: (ctx) => {
|
||||
ctx.stack.push(new FontPickerLayer(options));
|
||||
},
|
||||
@@ -339,7 +338,7 @@ function fontPickerMenuItem(options: FontPickerOptions & { rowLabel: string; des
|
||||
y,
|
||||
width,
|
||||
options.rowLabel,
|
||||
global.isIOS && options.get().kind === "ttf" ? "Terminus (iOS)" : fontSelectionLabel(options.get()),
|
||||
fontSelectionLabel(options.get()),
|
||||
);
|
||||
},
|
||||
};
|
||||
|
||||
@@ -970,7 +970,7 @@ class Shell {
|
||||
*/
|
||||
private buildVoiceSendTargets(): VoiceSendTarget[] {
|
||||
const targets: VoiceSendTarget[] = [];
|
||||
if (this.isAssistantAvailable()) {
|
||||
if (!global.isIOS && this.isAssistantAvailable()) {
|
||||
targets.push({
|
||||
id: "assistant",
|
||||
label: "Send to Assistant",
|
||||
|
||||
@@ -116,9 +116,9 @@ export class VoiceInputLayer implements Layer {
|
||||
this.status = state.status;
|
||||
this.actions.requestRender();
|
||||
});
|
||||
if (this.handsFree) {
|
||||
// No button is held, so the mic has to stop itself. endCapture() is
|
||||
// idempotent, and a click still ends the utterance early.
|
||||
if (this.handsFree || global.isIOS) {
|
||||
// Endpointing or the recognizer ending its session can finish capture.
|
||||
// endCapture() is idempotent, including after a manual button release.
|
||||
this.unsubscribeSpeechEnd = voiceControlBridge.onSpeechEnd(() => {
|
||||
if (this.phase === "capturing") {
|
||||
this.endCapture();
|
||||
@@ -186,7 +186,7 @@ export class VoiceInputLayer implements Layer {
|
||||
private menuRows(): Array<{ label: string; dim: boolean; onSelect: () => void }> {
|
||||
const text = this.displayText().trim();
|
||||
const hasText = text.length > 0;
|
||||
const hasLlmKey = anthropicApiKeySetting.get().trim().length > 0;
|
||||
const hasLlmKey = !global.isIOS && anthropicApiKeySetting.get().trim().length > 0;
|
||||
const rows: Array<{ label: string; dim: boolean; onSelect: () => void }> = [];
|
||||
for (const target of this.sendTargets) {
|
||||
rows.push({
|
||||
@@ -199,7 +199,7 @@ export class VoiceInputLayer implements Layer {
|
||||
});
|
||||
}
|
||||
rows.push({
|
||||
label: hasLlmKey ? "Continue" : "Continue (Needs LLM API key)",
|
||||
label: global.isIOS ? "Continue (Not available on iOS)" : hasLlmKey ? "Continue" : "Continue (Needs LLM API key)",
|
||||
dim: !hasLlmKey,
|
||||
onSelect: () => {
|
||||
if (hasLlmKey) this.startContinuation();
|
||||
@@ -379,6 +379,7 @@ export class VoiceInputLayer implements Layer {
|
||||
this.capturing = false;
|
||||
void this.actions.stopVoiceCapture();
|
||||
}
|
||||
if (global.isIOS) voiceControlBridge.stop();
|
||||
this.onClosed();
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user