feat(config): add configuration window (#70)

This commit is contained in:
2026-05-21 04:16:21 -07:00
committed by GitHub
parent a54f03f0cd
commit dc52bc2fba
287 changed files with 14507 additions and 8134 deletions
+14 -4
View File
@@ -17,7 +17,8 @@ export type ShowMessageBox = (options: {
export interface UpdateDialogPresenterDeps {
showMessageBox: ShowMessageBox;
focusApp?: () => void;
focusApp?: () => void | Promise<void>;
yieldToRunLoop?: () => Promise<void>;
platform?: NodeJS.Platform;
}
@@ -33,14 +34,23 @@ export async function showNoUpdateDialog(
});
}
function maybeFocusAppForDialog(deps: UpdateDialogPresenterDeps): void {
async function maybeFocusAppForDialog(deps: UpdateDialogPresenterDeps): Promise<void> {
if ((deps.platform ?? process.platform) !== 'darwin') return;
deps.focusApp?.();
await deps.focusApp?.();
// Yield to the macOS run loop so the activation request is processed before the
// modal alert blocks JS execution; without this, the alert often appears behind
// other apps when SubMiner is not the active app at dialog-show time.
const yieldToRunLoop = deps.yieldToRunLoop ?? (() => new Promise((r) => setTimeout(r, 0)));
await yieldToRunLoop();
}
export function createUpdateDialogPresenter(deps: UpdateDialogPresenterDeps) {
const showFocusedMessageBox: ShowMessageBox = async (options) => {
maybeFocusAppForDialog(deps);
try {
await maybeFocusAppForDialog(deps);
} catch {
// Best-effort focus only; never block the dialog itself.
}
return deps.showMessageBox(options);
};