forked from Blendman974/faceclaw
Add options to load an app from a URL or a QR code
(The QR code reading does not work yet)
This commit is contained in:
1 parent
6e4ece5dc7
commit
92cd05b6ca
22 files changed
+685
-93
No files matched your search
@@ -503,6 +503,23 @@ export const terminalNewConnectionSetting = new ConfigSettingString({
|
||||
normalize: (value) => (value ?? "").replace(/[\x00-\x1f]+/g, "").trim(),
|
||||
});
|
||||
|
||||
/**
|
||||
* Staging buffer for the Developer app's "Load app from URL" flow: the app
|
||||
* opens the phone text editor on this setting, the user types (or scans, or
|
||||
* dictates) the URL, and the app reads it back when the load is confirmed on
|
||||
* the glasses. Kept across launches so a reload after an edit-and-rebuild only
|
||||
* takes a click. Deliberately not listed in the Settings app.
|
||||
*/
|
||||
export const developerAppUrlSetting = new ConfigSettingString({
|
||||
id: "developer-app-url",
|
||||
label: "App URL",
|
||||
storageKey: "developer.appUrl",
|
||||
defaultValue: "",
|
||||
editorTitle: "EvenHub app URL (http:// or https://)",
|
||||
glassesEditTitle: "Load app from URL",
|
||||
normalize: (value) => (value ?? "").replace(/[\x00-\x1f]+/g, "").trim(),
|
||||
});
|
||||
|
||||
export const terminalLaunchPresetsSetting = new ConfigSettingString({
|
||||
id: "terminal-launch-presets",
|
||||
label: "Launch presets",
|
||||
|
||||
@@ -98,6 +98,13 @@ export interface Layer {
|
||||
handleInput(event: DashboardInputEvent, ctx: LayerContext): Promise<void> | void;
|
||||
/** Called when the layer leaves the stack by any path (pop or clearToBase). */
|
||||
onRemoved?(): void;
|
||||
/**
|
||||
* Accept a finished text string aimed at this window (voice input, and
|
||||
* anything else the shell routes through sendTextToForegroundWindow).
|
||||
* Layers that have somewhere to put text implement it; the rest don't, and
|
||||
* the shell then has no app destination to offer.
|
||||
*/
|
||||
receiveTextInput?(text: string, ctx: LayerContext): void;
|
||||
}
|
||||
|
||||
export class LayerStack {
|
||||
@@ -191,6 +198,15 @@ export class LayerStack {
|
||||
await this.layers[this.layers.length - 1]!.handleInput(event, this.ctx);
|
||||
}
|
||||
|
||||
/** Hand text to the top layer; false if it doesn't take text input. */
|
||||
receiveTextInput(text: string): boolean {
|
||||
const layer = this.layers[this.layers.length - 1]!;
|
||||
if (!layer.receiveTextInput) return false;
|
||||
layer.receiveTextInput(text, this.ctx);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
private paintLayer(index: number): Plane[] {
|
||||
const layer = this.layers[index]!;
|
||||
let canvas: GrayImage | null = null;
|
||||
|
||||
@@ -37,6 +37,12 @@ export type InProcessWindowOptions = {
|
||||
menuItems?: () => MenuItem[];
|
||||
/** Shared actions; requestRender is rebound to this window's render. */
|
||||
actions: LayerActions;
|
||||
/**
|
||||
* Accept text aimed at this window (voice input). Supply it for apps with a
|
||||
* layer that takes dictation; leaving it out is what tells the shell not to
|
||||
* offer "Type Into App" for this window.
|
||||
*/
|
||||
receiveTextInput?: (text: string) => void;
|
||||
baseLayer: Layer;
|
||||
submitFrame: (planes: Plane[], paintMs: number, frameId: number) => Promise<void>;
|
||||
setSurfaceVisible: (visible: boolean) => void;
|
||||
@@ -189,6 +195,7 @@ export function createInProcessWindow(options: InProcessWindowOptions): InProces
|
||||
await render(frameId);
|
||||
},
|
||||
requestRender,
|
||||
receiveTextInput: options.receiveTextInput,
|
||||
setForeground: (foreground) => {
|
||||
options.setSurfaceVisible(foreground);
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user