added expired warnning

This commit is contained in:
leejh 2020-02-21 16:38:01 +09:00
parent be284a3240
commit 1fcb309056
4 changed files with 98 additions and 6 deletions

View File

@ -32,6 +32,7 @@ export interface VersionInfo2Response extends APIResponse {
authIp?: boolean; authIp?: boolean;
launcherAppVersion?: string; launcherAppVersion?: string;
launcherInstallUrl?: string; launcherInstallUrl?: string;
isExpired?: string;
} }
const versionInfo2EncodeMap = { const versionInfo2EncodeMap = {
@ -68,6 +69,7 @@ export const decodeVersionInfo2: APIDecoder<VersionInfo2Response> = (
protocolCode: Number(res.ProtocolCD), protocolCode: Number(res.ProtocolCD),
serverIp: res.ServerIP, serverIp: res.ServerIP,
syncMode: res.SyncMode as SyncMode, syncMode: res.SyncMode as SyncMode,
uploadUrl: res.UploadURL uploadUrl: res.UploadURL,
isExpired: res.isExpired
} as VersionInfo2Response; } as VersionInfo2Response;
}; };

View File

@ -48,7 +48,12 @@ import {
} from '@ucap-webmessenger/protocol-query'; } from '@ucap-webmessenger/protocol-query';
import { OptionProtocolService } from '@ucap-webmessenger/protocol-option'; import { OptionProtocolService } from '@ucap-webmessenger/protocol-option';
import { TranslateService as UCapTranslateService } from '@ucap-webmessenger/ui'; import {
AlertDialogResult,
AlertDialogData,
AlertDialogComponent,
DialogService
} from '@ucap-webmessenger/ui';
import * as AppStore from '@app/store'; import * as AppStore from '@app/store';
import * as AuthenticationStore from '@app/store/account/authentication'; import * as AuthenticationStore from '@app/store/account/authentication';
@ -91,6 +96,7 @@ export class AppMessengerResolver implements Resolve<void> {
private appNativeService: AppNativeService, private appNativeService: AppNativeService,
private snackBarService: SnackBarService, private snackBarService: SnackBarService,
private translateService: TranslateService, private translateService: TranslateService,
private dialogService: DialogService,
private logger: NGXLogger private logger: NGXLogger
) {} ) {}
@ -141,6 +147,21 @@ export class AppMessengerResolver implements Resolve<void> {
res res
); );
this.store.dispatch(VersionInfoStore.versionInfo2Success({ res })); this.store.dispatch(VersionInfoStore.versionInfo2Success({ res }));
/** Expired Warnning for license */
if (!!res && !!res.isExpired && res.isExpired.length > 0) {
this.dialogService.open<
AlertDialogComponent,
AlertDialogData,
AlertDialogResult
>(AlertDialogComponent, {
disableClose: true,
data: {
title: 'Warnning!!',
html: res.isExpired
}
});
}
}), }),
switchMap(res => { switchMap(res => {
return this.protocolService.connect(res.serverIp); return this.protocolService.connect(res.serverIp);

View File

@ -5,7 +5,6 @@ import { Actions, createEffect, ofType } from '@ngrx/effects';
import { Store, select } from '@ngrx/store'; import { Store, select } from '@ngrx/store';
import { NGXLogger } from 'ngx-logger'; import { NGXLogger } from 'ngx-logger';
import { of } from 'rxjs'; import { of } from 'rxjs';
import { import {
tap, tap,
@ -72,7 +71,14 @@ import {
clearRoomUser clearRoomUser
} from './actions'; } from './actions';
import { SessionStorageService } from '@ucap-webmessenger/web-storage'; import { SessionStorageService } from '@ucap-webmessenger/web-storage';
import { LoginInfo, KEY_LOGIN_INFO } from '@app/types'; import { LoginInfo, KEY_LOGIN_INFO, KEY_VER_INFO } from '@app/types';
import { VersionInfo2Response } from '@ucap-webmessenger/api-public';
import {
DialogService,
AlertDialogComponent,
AlertDialogData,
AlertDialogResult
} from '@ucap-webmessenger/ui';
@Injectable() @Injectable()
export class Effects { export class Effects {
@ -86,6 +92,29 @@ export class Effects {
) )
), ),
map(([action, roomInfo]) => { map(([action, roomInfo]) => {
/** Expired Warnning for license */
const sessionVerinfo = this.sessionStorageService.get<
VersionInfo2Response
>(KEY_VER_INFO);
if (
!!sessionVerinfo &&
!!sessionVerinfo.isExpired &&
sessionVerinfo.isExpired.length > 0
) {
this.dialogService.open<
AlertDialogComponent,
AlertDialogData,
AlertDialogResult
>(AlertDialogComponent, {
disableClose: true,
data: {
title: 'Warnning!!',
html: sessionVerinfo.isExpired
}
});
}
if (!!roomInfo && roomInfo.roomSeq === action.roomSeq) { if (!!roomInfo && roomInfo.roomSeq === action.roomSeq) {
} else { } else {
this.store.dispatch(ChatStore.clearEvent()); this.store.dispatch(ChatStore.clearEvent());
@ -425,6 +454,7 @@ export class Effects {
private store: Store<any>, private store: Store<any>,
private roomProtocolService: RoomProtocolService, private roomProtocolService: RoomProtocolService,
private sessionStorageService: SessionStorageService, private sessionStorageService: SessionStorageService,
private dialogService: DialogService,
private logger: NGXLogger private logger: NGXLogger
) {} ) {}
} }

View File

@ -1,3 +1,4 @@
import { VersionInfo2Response } from './../../../../../../ucap-webmessenger-api-public/src/lib/apis/version-info2';
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { tap } from 'rxjs/operators'; import { tap } from 'rxjs/operators';
@ -7,9 +8,14 @@ import { Store } from '@ngrx/store';
import { NGXLogger } from 'ngx-logger'; import { NGXLogger } from 'ngx-logger';
import { DialogService } from '@ucap-webmessenger/ui'; import {
DialogService,
AlertDialogComponent,
AlertDialogData,
AlertDialogResult
} from '@ucap-webmessenger/ui';
import { showDialog } from './actions'; import { showDialog, selectedGnbMenuIndex } from './actions';
import { import {
MessengerSettingsDialogComponent, MessengerSettingsDialogComponent,
MessengerSettingsDialogData, MessengerSettingsDialogData,
@ -18,6 +24,7 @@ import {
import { SessionStorageService } from '@ucap-webmessenger/web-storage'; import { SessionStorageService } from '@ucap-webmessenger/web-storage';
import { LoginResponse } from '@ucap-webmessenger/protocol-authentication'; import { LoginResponse } from '@ucap-webmessenger/protocol-authentication';
import { KEY_LOGIN_RES_INFO } from '@app/types/login-res-info.type'; import { KEY_LOGIN_RES_INFO } from '@app/types/login-res-info.type';
import { KEY_VER_INFO } from '@app/types';
@Injectable() @Injectable()
export class Effects { export class Effects {
@ -49,6 +56,38 @@ export class Effects {
{ dispatch: false } { dispatch: false }
); );
selectedGnbMenuIndex$ = createEffect(
() =>
this.actions$.pipe(
ofType(selectedGnbMenuIndex),
tap(async () => {
/** Expired Warnning for license */
const sessionVerinfo = this.sessionStorageService.get<
VersionInfo2Response
>(KEY_VER_INFO);
if (
!!sessionVerinfo &&
!!sessionVerinfo.isExpired &&
sessionVerinfo.isExpired.length > 0
) {
this.dialogService.open<
AlertDialogComponent,
AlertDialogData,
AlertDialogResult
>(AlertDialogComponent, {
disableClose: true,
data: {
title: 'Warnning!!',
html: sessionVerinfo.isExpired
}
});
}
})
),
{ dispatch: false }
);
constructor( constructor(
private actions$: Actions, private actions$: Actions,
private store: Store<any>, private store: Store<any>,