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