bug of updater is fixed
This commit is contained in:
parent
e4a42d0dcc
commit
c37f439fb0
|
@ -268,11 +268,6 @@ app.on(ElectronAppChannel.Ready, () => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
updateWindowService.options.webPreferences.preload = path.join(
|
|
||||||
__dirname,
|
|
||||||
'resources/update-window/preload.js'
|
|
||||||
);
|
|
||||||
|
|
||||||
updateWindowService.templatePath = path.join(
|
updateWindowService.templatePath = path.join(
|
||||||
__dirname,
|
__dirname,
|
||||||
'resources/update-window/template.html'
|
'resources/update-window/template.html'
|
||||||
|
@ -319,12 +314,28 @@ function onDidLoad(fn: OnDidLoadFn) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ipcMain.on(UpdaterChannel.Check, (event: IpcMainEvent, ...args: any[]) => {
|
ipcMain.on(UpdaterChannel.Check, (event: IpcMainEvent, ...args: any[]) => {
|
||||||
|
// if (__DEV__) {
|
||||||
|
// event.returnValue = false;
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
|
||||||
const ver = args[0];
|
const ver = args[0];
|
||||||
|
|
||||||
if (semver.lt(app.getVersion(), ver)) {
|
if (semver.lt(app.getVersion(), ver)) {
|
||||||
autoUpdater.checkForUpdatesAndNotify();
|
autoUpdater
|
||||||
return true;
|
.checkForUpdatesAndNotify()
|
||||||
|
.then(result => {
|
||||||
|
if (!result) {
|
||||||
|
event.returnValue = false;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
event.returnValue = true;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(reason => {
|
||||||
|
event.returnValue = false;
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
event.returnValue = false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -119,7 +119,7 @@ export class Effects {
|
||||||
params =>
|
params =>
|
||||||
new Observable<void>(subscriber => {
|
new Observable<void>(subscriber => {
|
||||||
this.nativeService
|
this.nativeService
|
||||||
.checkForUpdates()
|
.checkForUpdates(params.login2Response.version)
|
||||||
.then((update: boolean) => {
|
.then((update: boolean) => {
|
||||||
if (!update) {
|
if (!update) {
|
||||||
this.appAuthenticationService.login(
|
this.appAuthenticationService.login(
|
||||||
|
|
|
@ -70,7 +70,7 @@ export class BrowserNativeService extends NativeService {
|
||||||
}
|
}
|
||||||
closeAllNotify(): void {}
|
closeAllNotify(): void {}
|
||||||
|
|
||||||
checkForUpdates(): Promise<boolean> {
|
checkForUpdates(currentVersion: string): Promise<boolean> {
|
||||||
return new Promise<boolean>((resolve, reject) => {
|
return new Promise<boolean>((resolve, reject) => {
|
||||||
resolve(false);
|
resolve(false);
|
||||||
});
|
});
|
||||||
|
|
|
@ -105,10 +105,12 @@ export class ElectronNativeService implements NativeService {
|
||||||
this.ipcRenderer.send(NotificationChannel.CloseAllNotify);
|
this.ipcRenderer.send(NotificationChannel.CloseAllNotify);
|
||||||
}
|
}
|
||||||
|
|
||||||
checkForUpdates(): Promise<boolean> {
|
checkForUpdates(currentVersion: string): Promise<boolean> {
|
||||||
return new Promise<boolean>((resolve, reject) => {
|
return new Promise<boolean>((resolve, reject) => {
|
||||||
try {
|
try {
|
||||||
resolve(this.ipcRenderer.sendSync(UpdaterChannel.Check));
|
resolve(
|
||||||
|
this.ipcRenderer.sendSync(UpdaterChannel.Check, currentVersion)
|
||||||
|
);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
reject(error);
|
reject(error);
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@ export abstract class NativeService {
|
||||||
abstract notify(noti: NotificationRequest): void;
|
abstract notify(noti: NotificationRequest): void;
|
||||||
abstract closeAllNotify(): void;
|
abstract closeAllNotify(): void;
|
||||||
|
|
||||||
abstract checkForUpdates(): Promise<boolean>;
|
abstract checkForUpdates(currentVersion: string): Promise<boolean>;
|
||||||
abstract checkForInstantUpdates(
|
abstract checkForInstantUpdates(
|
||||||
config: UpdateCheckConfig
|
config: UpdateCheckConfig
|
||||||
): Observable<UpdateInfo>;
|
): Observable<UpdateInfo>;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user