update is modified

This commit is contained in:
richard-loafle 2020-01-23 14:15:08 +09:00
parent 91fcf7f2e5
commit 49ffe6b3d8
8 changed files with 19 additions and 54 deletions

View File

@ -51,7 +51,7 @@
"target": ["nsis-web"], "target": ["nsis-web"],
"icon": "./config/build/win/icon/daesang/16x16.ico", "icon": "./config/build/win/icon/daesang/16x16.ico",
"legalTrademarks": "(c) 2015 lgucap.com", "legalTrademarks": "(c) 2015 lgucap.com",
"publisherName": "LGCNS", "publisherName": "LG CNS Co.,Ltd",
"signingHashAlgorithms": ["sha1"], "signingHashAlgorithms": ["sha1"],
"certificateFile": "./config/sign/www.lgcns.com.pfx", "certificateFile": "./config/sign/www.lgcns.com.pfx",
"certificatePassword": "it15itsm", "certificatePassword": "it15itsm",

View File

@ -350,7 +350,7 @@ function onDidLoad(fn: OnDidLoadFn) {
} }
} }
ipcMain.on(UpdaterChannel.Check, (event: IpcMainEvent, ...args: any[]) => { ipcMain.on(UpdaterChannel.Apply, (event: IpcMainEvent, ...args: any[]) => {
// if (__DEV__) { // if (__DEV__) {
// event.returnValue = false; // event.returnValue = false;
// return; // return;
@ -365,18 +365,10 @@ ipcMain.on(UpdaterChannel.Check, (event: IpcMainEvent, ...args: any[]) => {
}; };
autoUpdater autoUpdater
.checkForUpdatesAndNotify() .checkForUpdatesAndNotify()
.then(result => { .then(result => {})
if (!result) {
event.returnValue = false;
} else {
event.returnValue = true;
}
})
.catch(reason => { .catch(reason => {
event.returnValue = false; log.error(reason);
}); });
} else {
event.returnValue = false;
} }
}); });

View File

@ -1,6 +1,6 @@
{ {
"name": "ucap-webmessenger", "name": "ucap-webmessenger",
"version": "0.0.8", "version": "0.0.9",
"author": { "author": {
"name": "LG CNS", "name": "LG CNS",
"email": "lgucap@lgcns.com" "email": "lgucap@lgcns.com"

View File

@ -128,30 +128,15 @@ export class Effects {
() => () =>
this.actions$.pipe( this.actions$.pipe(
ofType(webLoginSuccess), ofType(webLoginSuccess),
switchMap( tap(params => {
params => this.nativeService.checkForUpdates(params.login2Response.version);
new Observable<void>(subscriber => {
this.nativeService
.checkForUpdates(params.login2Response.version)
.then((update: boolean) => {
if (!update) {
this.appAuthenticationService.login( this.appAuthenticationService.login(
params.loginInfo, params.loginInfo,
params.rememberMe, params.rememberMe,
params.autoLogin params.autoLogin
); );
this.router.navigate(['/messenger']); this.router.navigate(['/messenger']);
}
subscriber.next();
}) })
.catch(reason => {
subscriber.error(reason);
})
.finally(() => {
subscriber.complete();
});
})
)
), ),
{ dispatch: false } { dispatch: false }
); );

View File

@ -114,11 +114,7 @@ export class BrowserNativeService extends NativeService {
} }
closeAllNotify(): void {} closeAllNotify(): void {}
checkForUpdates(currentVersion: string): Promise<boolean> { checkForUpdates(currentVersion: string): void {}
return new Promise<boolean>((resolve, reject) => {
resolve(false);
});
}
checkForInstantUpdates(config: UpdateCheckConfig): Observable<UpdateInfo> { checkForInstantUpdates(config: UpdateCheckConfig): Observable<UpdateInfo> {
return new Observable<UpdateInfo>(subscriber => { return new Observable<UpdateInfo>(subscriber => {

View File

@ -183,16 +183,8 @@ export class ElectronNativeService implements NativeService {
this.ipcRenderer.send(NotificationChannel.CloseAllNotify); this.ipcRenderer.send(NotificationChannel.CloseAllNotify);
} }
checkForUpdates(currentVersion: string): Promise<boolean> { checkForUpdates(currentVersion: string): void {
return new Promise<boolean>((resolve, reject) => { this.ipcRenderer.send(UpdaterChannel.Apply, currentVersion);
try {
resolve(
this.ipcRenderer.sendSync(UpdaterChannel.Check, currentVersion)
);
} catch (error) {
reject(error);
}
});
} }
checkForInstantUpdates(config: UpdateCheckConfig): Observable<UpdateInfo> { checkForInstantUpdates(config: UpdateCheckConfig): Observable<UpdateInfo> {

View File

@ -23,7 +23,7 @@ export enum NotificationChannel {
} }
export enum UpdaterChannel { export enum UpdaterChannel {
Check = 'UCAP::updater::check', Apply = 'UCAP::updater::apply',
StartCheckInstant = 'UCAP::updater::startCheckInstant', StartCheckInstant = 'UCAP::updater::startCheckInstant',
ExistInstant = 'UCAP::updater::existInstant', ExistInstant = 'UCAP::updater::existInstant',
ApplyInstant = 'UCAP::updater::applyInstant', ApplyInstant = 'UCAP::updater::applyInstant',

View File

@ -36,7 +36,7 @@ export abstract class NativeService {
abstract notify(noti: NotificationRequest): void; abstract notify(noti: NotificationRequest): void;
abstract closeAllNotify(): void; abstract closeAllNotify(): void;
abstract checkForUpdates(currentVersion: string): Promise<boolean>; abstract checkForUpdates(currentVersion: string): void;
abstract checkForInstantUpdates( abstract checkForInstantUpdates(
config: UpdateCheckConfig config: UpdateCheckConfig
): Observable<UpdateInfo>; ): Observable<UpdateInfo>;