desktop 앱 적용

This commit is contained in:
Macbook
2026-06-14 10:15:54 +09:00
parent 7a2f65088c
commit 86b99d8c10
81 changed files with 8164 additions and 37 deletions
+47
View File
@@ -0,0 +1,47 @@
import { isDesktop } from './platform';
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 }>;
getAppVersion: () => Promise<string>;
}
declare global {
interface Window {
__goldenDesktopBridge?: DesktopBridge;
}
}
export function getDesktopBridge(): DesktopBridge | null {
if (!isDesktop()) return null;
return window.__goldenDesktopBridge ?? null;
}
export async function showDesktopNativeNotification(title: string, body: string): Promise<void> {
const bridge = getDesktopBridge();
if (!bridge) return;
try {
await bridge.showNativeNotification(title, body);
} catch {
/* ignore */
}
}
export async function checkDesktopUpdates(): Promise<{ available: boolean; version?: string; message?: string }> {
const bridge = getDesktopBridge();
if (!bridge) return { available: false, message: '데스크톱 앱에서만 사용 가능합니다.' };
return bridge.checkForUpdates();
}
export async function getDesktopAppVersion(): Promise<string | null> {
const bridge = getDesktopBridge();
if (!bridge) return null;
try {
return await bridge.getAppVersion();
} catch {
return null;
}
}