앱 버전표시
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
declare const __DESKTOP_APP_VERSION__: string | undefined;
|
||||
|
||||
declare global {
|
||||
interface Window {
|
||||
__GC_APP_VERSION__?: string;
|
||||
}
|
||||
}
|
||||
|
||||
/** Desktop Vite 빌드·index.html 인라인 스크립트에 주입된 앱 버전 */
|
||||
export function readBakedDesktopAppVersion(): string | null {
|
||||
if (typeof window !== 'undefined') {
|
||||
const fromWindow = window.__GC_APP_VERSION__?.trim();
|
||||
if (fromWindow) return fromWindow;
|
||||
}
|
||||
if (typeof __DESKTOP_APP_VERSION__ !== 'undefined') {
|
||||
const fromDefine = __DESKTOP_APP_VERSION__.trim();
|
||||
if (fromDefine) return fromDefine;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
export function formatDesktopWindowTitle(version: string | null | undefined): string {
|
||||
const v = version?.trim();
|
||||
return v ? `GoldenChart (v${v})` : 'GoldenChart';
|
||||
}
|
||||
@@ -2,7 +2,9 @@
|
||||
export type RuntimePlatform = 'web' | 'desktop' | 'mobile';
|
||||
|
||||
export function isDesktop(): boolean {
|
||||
return typeof window !== 'undefined' && '__TAURI__' in window;
|
||||
if (typeof window === 'undefined') return false;
|
||||
if ('__TAURI__' in window || '__TAURI_INTERNALS__' in window) return true;
|
||||
return document.documentElement.classList.contains('desktop-client');
|
||||
}
|
||||
|
||||
export function isMobileCapacitor(): boolean {
|
||||
|
||||
Reference in New Issue
Block a user