forked from Blendman974/faceclaw
Add a consolidated single export to each app
This commit is contained in:
1 parent
9b3832d7a7
commit
f38366df6e
23 files changed
+597
-337
No files matched your search
@@ -0,0 +1,45 @@
|
||||
import { shell } from "../../ui/shell/shell";
|
||||
import { type AppDefinition } from "../app-definition";
|
||||
import {
|
||||
createSettingsAppWindow,
|
||||
SETTINGS_SURFACE_ID,
|
||||
SETTINGS_WINDOW_ID,
|
||||
type SettingsAppWindow,
|
||||
} from "./settings-app";
|
||||
|
||||
// The Settings app is a singleton; tracked so a relaunch with a section
|
||||
// deep-link can focus that section in the open window.
|
||||
let activeSettingsApp: SettingsAppWindow | null = null;
|
||||
|
||||
const settingsApp: AppDefinition = {
|
||||
appId: "settings",
|
||||
title: "Settings",
|
||||
icon: "settings",
|
||||
launch: async (ctx, params) => {
|
||||
if (activeSettingsApp) {
|
||||
if (params?.section) activeSettingsApp.focusSection(params.section);
|
||||
shell.focusWindow(SETTINGS_WINDOW_ID);
|
||||
ctx.requestShellRender();
|
||||
return;
|
||||
}
|
||||
await ctx.launchInProcessApp(SETTINGS_WINDOW_ID, SETTINGS_SURFACE_ID, (options) => {
|
||||
const app = createSettingsAppWindow({
|
||||
...options,
|
||||
onClosed: () => {
|
||||
// Closing mid-edit must not leave the phone-side editor dangling.
|
||||
void options.actions.endTextSettingEdit();
|
||||
ctx.setTextEditorHost(null);
|
||||
activeSettingsApp = null;
|
||||
options.onClosed();
|
||||
},
|
||||
});
|
||||
activeSettingsApp = app;
|
||||
// The controller echoes phone-side edits into the glasses editor.
|
||||
ctx.setTextEditorHost(app);
|
||||
return app.inProcess;
|
||||
});
|
||||
if (params?.section) activeSettingsApp?.focusSection(params.section);
|
||||
},
|
||||
};
|
||||
|
||||
export default settingsApp;
|
||||
Reference in new issue
Block a user