This commit is contained in:
Macbook
2026-06-14 11:35:54 +09:00
parent 117a588df8
commit 78cda775ad
8 changed files with 519 additions and 63 deletions
+40
View File
@@ -1,11 +1,41 @@
import { isDesktop } from './platform';
export type DesktopUpdatePhase =
| 'checking'
| 'uptodate'
| 'available'
| 'downloading'
| 'installing'
| 'relaunching'
| 'error';
export interface DesktopUpdateProgress {
phase: DesktopUpdatePhase;
message: string;
currentVersion?: string;
newVersion?: string;
downloadPercent?: number;
downloadedBytes?: number;
totalBytes?: number;
}
export interface DesktopUpdateResult {
ok: boolean;
phase: DesktopUpdatePhase;
message: string;
currentVersion?: string;
newVersion?: string;
}
export interface DesktopBridge {
openWidgetWindow: (instance: import('../types/floatingWidget').FloatingWidgetInstance) => Promise<void>;
closeWidgetWindow: (id: string) => Promise<void>;
focusWidgetWindow: (id: string) => Promise<void>;
showNativeNotification: (title: string, body: string) => Promise<void>;
checkForUpdates: () => Promise<{ available: boolean; version?: string; message?: string }>;
runDesktopUpdate: (
onProgress?: (progress: DesktopUpdateProgress) => void,
) => Promise<DesktopUpdateResult>;
getAppVersion: () => Promise<string>;
}
@@ -36,6 +66,16 @@ export async function checkDesktopUpdates(): Promise<{ available: boolean; versi
return bridge.checkForUpdates();
}
export async function runDesktopUpdate(
onProgress?: (progress: DesktopUpdateProgress) => void,
): Promise<DesktopUpdateResult> {
const bridge = getDesktopBridge();
if (!bridge?.runDesktopUpdate) {
return { ok: false, phase: 'error', message: '데스크톱 앱에서만 사용 가능합니다.' };
}
return bridge.runDesktopUpdate(onProgress);
}
export async function getDesktopAppVersion(): Promise<string | null> {
const bridge = getDesktopBridge();
if (!bridge) return null;