diff --git a/projects/ucap-webmessenger-api-public/src/lib/apis/version-info2.ts b/projects/ucap-webmessenger-api-public/src/lib/apis/version-info2.ts index 44206202..8dc86dee 100644 --- a/projects/ucap-webmessenger-api-public/src/lib/apis/version-info2.ts +++ b/projects/ucap-webmessenger-api-public/src/lib/apis/version-info2.ts @@ -32,6 +32,7 @@ export interface VersionInfo2Response extends APIResponse { authIp?: boolean; launcherAppVersion?: string; launcherInstallUrl?: string; + isExpired?: string; } const versionInfo2EncodeMap = { @@ -68,6 +69,7 @@ export const decodeVersionInfo2: APIDecoder = ( protocolCode: Number(res.ProtocolCD), serverIp: res.ServerIP, syncMode: res.SyncMode as SyncMode, - uploadUrl: res.UploadURL + uploadUrl: res.UploadURL, + isExpired: res.isExpired } as VersionInfo2Response; }; diff --git a/projects/ucap-webmessenger-app/src/app/resolvers/messenger.resolver.ts b/projects/ucap-webmessenger-app/src/app/resolvers/messenger.resolver.ts index a50999ec..7012e5a9 100644 --- a/projects/ucap-webmessenger-app/src/app/resolvers/messenger.resolver.ts +++ b/projects/ucap-webmessenger-app/src/app/resolvers/messenger.resolver.ts @@ -48,7 +48,12 @@ import { } from '@ucap-webmessenger/protocol-query'; 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 AuthenticationStore from '@app/store/account/authentication'; @@ -91,6 +96,7 @@ export class AppMessengerResolver implements Resolve { private appNativeService: AppNativeService, private snackBarService: SnackBarService, private translateService: TranslateService, + private dialogService: DialogService, private logger: NGXLogger ) {} @@ -141,6 +147,21 @@ export class AppMessengerResolver implements Resolve { 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 => { return this.protocolService.connect(res.serverIp); diff --git a/projects/ucap-webmessenger-app/src/app/store/messenger/room/effects.ts b/projects/ucap-webmessenger-app/src/app/store/messenger/room/effects.ts index bc208a8a..9cf07234 100644 --- a/projects/ucap-webmessenger-app/src/app/store/messenger/room/effects.ts +++ b/projects/ucap-webmessenger-app/src/app/store/messenger/room/effects.ts @@ -5,7 +5,6 @@ import { Actions, createEffect, ofType } from '@ngrx/effects'; import { Store, select } from '@ngrx/store'; import { NGXLogger } from 'ngx-logger'; - import { of } from 'rxjs'; import { tap, @@ -72,7 +71,14 @@ import { clearRoomUser } from './actions'; 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() export class Effects { @@ -86,6 +92,29 @@ export class Effects { ) ), 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) { } else { this.store.dispatch(ChatStore.clearEvent()); @@ -425,6 +454,7 @@ export class Effects { private store: Store, private roomProtocolService: RoomProtocolService, private sessionStorageService: SessionStorageService, + private dialogService: DialogService, private logger: NGXLogger ) {} } diff --git a/projects/ucap-webmessenger-app/src/app/store/messenger/settings/effects.ts b/projects/ucap-webmessenger-app/src/app/store/messenger/settings/effects.ts index 4087323e..db09ba89 100644 --- a/projects/ucap-webmessenger-app/src/app/store/messenger/settings/effects.ts +++ b/projects/ucap-webmessenger-app/src/app/store/messenger/settings/effects.ts @@ -1,3 +1,4 @@ +import { VersionInfo2Response } from './../../../../../../ucap-webmessenger-api-public/src/lib/apis/version-info2'; import { Injectable } from '@angular/core'; import { tap } from 'rxjs/operators'; @@ -7,9 +8,14 @@ import { Store } from '@ngrx/store'; 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 { MessengerSettingsDialogComponent, MessengerSettingsDialogData, @@ -18,6 +24,7 @@ import { import { SessionStorageService } from '@ucap-webmessenger/web-storage'; import { LoginResponse } from '@ucap-webmessenger/protocol-authentication'; import { KEY_LOGIN_RES_INFO } from '@app/types/login-res-info.type'; +import { KEY_VER_INFO } from '@app/types'; @Injectable() export class Effects { @@ -49,6 +56,38 @@ export class Effects { { 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( private actions$: Actions, private store: Store,