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

View File

@ -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<void> {
private appNativeService: AppNativeService,
private snackBarService: SnackBarService,
private translateService: TranslateService,
private dialogService: DialogService,
private logger: NGXLogger
) {}
@ -141,6 +147,21 @@ export class AppMessengerResolver implements Resolve<void> {
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);

View File

@ -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<any>,
private roomProtocolService: RoomProtocolService,
private sessionStorageService: SessionStorageService,
private dialogService: DialogService,
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 { 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<any>,