fix(mac): updater progress UI and skip redundant download
Show update stage in the modal, forward electron-updater progress over IPC, and install immediately when the build is already cached. Rename window titles to TTRPG - *. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -11,3 +11,21 @@ export function appDisplayNameForLocale(localeTag: string): string {
|
||||
if (tag.startsWith('ru')) return APP_DISPLAY_NAME_RU;
|
||||
return APP_DISPLAY_NAME_EN;
|
||||
}
|
||||
|
||||
/** Префикс заголовка окон: `TTRPG - Редактор`. */
|
||||
export const APP_WINDOW_BRAND = 'TTRPG';
|
||||
|
||||
export type AppWindowKind = 'editor' | 'presentation' | 'control' | 'boot';
|
||||
|
||||
const WINDOW_SUFFIX: Record<AppWindowKind, { ru: string; en: string }> = {
|
||||
editor: { ru: 'Редактор', en: 'Editor' },
|
||||
presentation: { ru: 'Презентация', en: 'Presentation' },
|
||||
control: { ru: 'Пульт', en: 'Control' },
|
||||
boot: { ru: 'Загрузка', en: 'Loading' },
|
||||
};
|
||||
|
||||
export function windowChromeTitle(kind: AppWindowKind, localeTag: string): string {
|
||||
const tag = localeTag.trim().toLowerCase();
|
||||
const suffix = tag.startsWith('ru') ? WINDOW_SUFFIX[kind].ru : WINDOW_SUFFIX[kind].en;
|
||||
return `${APP_WINDOW_BRAND} - ${suffix}`;
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ export const ipcChannels = {
|
||||
updater: {
|
||||
check: 'updater.check',
|
||||
downloadAndRestart: 'updater.downloadAndRestart',
|
||||
progress: 'updater.progress',
|
||||
},
|
||||
project: {
|
||||
list: 'project.list',
|
||||
@@ -97,6 +98,22 @@ export type UpdaterCheckResponse =
|
||||
|
||||
export type UpdaterDownloadResponse = { ok: true } | { ok: false; message: string };
|
||||
|
||||
export type UpdaterProgressPhase =
|
||||
| 'checking'
|
||||
| 'available'
|
||||
| 'not-available'
|
||||
| 'downloading'
|
||||
| 'installing'
|
||||
| 'error';
|
||||
|
||||
export type UpdaterProgressEvent = {
|
||||
phase: UpdaterProgressPhase;
|
||||
/** 0..100 при phase=downloading */
|
||||
percent?: number;
|
||||
version?: string;
|
||||
message?: string;
|
||||
};
|
||||
|
||||
export type IpcEventMap = {
|
||||
[ipcChannels.session.stateChanged]: { state: SessionState };
|
||||
[ipcChannels.effects.stateChanged]: { state: EffectsState };
|
||||
@@ -105,6 +122,7 @@ export type IpcEventMap = {
|
||||
[ipcChannels.windows.multiWindowStateChanged]: { open: boolean };
|
||||
[ipcChannels.project.importZipProgress]: ZipProgressEvent;
|
||||
[ipcChannels.project.exportZipProgress]: ZipProgressEvent;
|
||||
[ipcChannels.updater.progress]: UpdaterProgressEvent;
|
||||
};
|
||||
|
||||
export type IpcInvokeMap = {
|
||||
@@ -121,7 +139,7 @@ export type IpcInvokeMap = {
|
||||
res: UpdaterCheckResponse;
|
||||
};
|
||||
[ipcChannels.updater.downloadAndRestart]: {
|
||||
req: Record<string, never>;
|
||||
req: { version: string };
|
||||
res: UpdaterDownloadResponse;
|
||||
};
|
||||
[ipcChannels.project.list]: {
|
||||
|
||||
Reference in New Issue
Block a user