Skip to content
This repository was archived by the owner on Jul 9, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Composer/packages/electron-server/src/appUpdater.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,22 +93,22 @@ export class AppUpdater extends EventEmitter {
private onUpdateAvailable(updateInfo: UpdateInfo) {
log('Update available: %O', updateInfo);
this.checkingForUpdate = false;
if (!this.settings.autoDownload) {
if (this.explicitCheck || !this.settings.autoDownload) {
this.emit('update-available', updateInfo);
}
}

private onUpdateNotAvailable(updateInfo: UpdateInfo) {
log('Update not available: %O', updateInfo);
if (!this.settings.autoDownload) {
if (this.explicitCheck || !this.settings.autoDownload) {
this.emit('update-not-available', this.explicitCheck);
}
this.resetToIdle();
}

private onDownloadProgress(progress: any) {
log('Got update progress: %O', progress);
if (!this.settings.autoDownload) {
if (this.explicitCheck || !this.settings.autoDownload) {
this.emit('progress', progress);
}
}
Expand All @@ -117,7 +117,7 @@ export class AppUpdater extends EventEmitter {
log('Update downloaded: %O', updateInfo);
this._downloadedUpdate = true;
this.resetToIdle();
if (!this.settings.autoDownload) {
if (this.explicitCheck || !this.settings.autoDownload) {
this.emit('update-downloaded', updateInfo);
}
}
Expand Down
28 changes: 16 additions & 12 deletions Composer/packages/electron-server/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,20 @@ const checkAppLocale = (newAppLocale: string) => {
}
};

const initSettingsListeners = () => {
ipcMain.once('init-user-settings', (_ev, settings: UserSettings) => {
// Check app locale for changes
checkAppLocale(settings.appLocale);
// we can't synchronously call the main process (due to deadlocks)
// so we wait for the initial settings to be loaded from the client
initializeAppUpdater(settings.appUpdater);
});

ipcMain.on('update-user-settings', (_ev, settings: UserSettings) => {
checkAppLocale(settings.appLocale);
});
};

async function run() {
fixPath(); // required PATH fix for Mac (https://github.com/electron/electron/issues/5626)

Expand Down Expand Up @@ -239,19 +253,9 @@ async function run() {

updateStatus(formatMessage('Starting server...'));
await loadServer();
await main();

ipcMain.once('init-user-settings', (_ev, settings: UserSettings) => {
// Check app locale for changes
checkAppLocale(settings.appLocale);
// we can't synchronously call the main process (due to deadlocks)
// so we wait for the initial settings to be loaded from the client
initializeAppUpdater(settings.appUpdater);
});

ipcMain.on('update-user-settings', (_ev, settings: UserSettings) => {
checkAppLocale(settings.appLocale);
});
initSettingsListeners();
await main();

setTimeout(startApp, 500);
});
Expand Down