save sessionstorage for verinfo2 response data
This commit is contained in:
parent
5dd24638c8
commit
55d593904b
|
@ -44,6 +44,7 @@ import * as VersionInfoStore from '@app/store/setting/version-info';
|
||||||
import * as OptionStore from '@app/store/messenger/option';
|
import * as OptionStore from '@app/store/messenger/option';
|
||||||
import * as QueryStore from '@app/store/messenger/query';
|
import * as QueryStore from '@app/store/messenger/query';
|
||||||
import * as SyncStore from '@app/store/messenger/sync';
|
import * as SyncStore from '@app/store/messenger/sync';
|
||||||
|
import { VerInfo2, KEY_VER_INFO } from '@app/types/ver-info.type';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class AppMessengerResolver implements Resolve<void> {
|
export class AppMessengerResolver implements Resolve<void> {
|
||||||
|
@ -83,6 +84,7 @@ export class AppMessengerResolver implements Resolve<void> {
|
||||||
.pipe(
|
.pipe(
|
||||||
take(1),
|
take(1),
|
||||||
tap(res => {
|
tap(res => {
|
||||||
|
this.sessionStorageService.set<VerInfo2>(KEY_VER_INFO, res);
|
||||||
this.store.dispatch(VersionInfoStore.versionInfo2Success({ res }));
|
this.store.dispatch(VersionInfoStore.versionInfo2Success({ res }));
|
||||||
}),
|
}),
|
||||||
switchMap(res => {
|
switchMap(res => {
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
import { SyncMode } from '@ucap-webmessenger/api-public';
|
||||||
|
|
||||||
|
export const KEY_VER_INFO = 'ucap::VER_INFO';
|
||||||
|
|
||||||
|
export interface VerInfo2 {
|
||||||
|
protocolCode?: number;
|
||||||
|
syncMode?: SyncMode;
|
||||||
|
appVersion?: string;
|
||||||
|
installUrl?: string;
|
||||||
|
serverIp?: string;
|
||||||
|
uploadUrl?: string;
|
||||||
|
downloadUrl?: string;
|
||||||
|
profileUploadUrl?: string;
|
||||||
|
profileRoot?: string;
|
||||||
|
fileTerm?: number;
|
||||||
|
fileAllowSize?: number;
|
||||||
|
authIp?: boolean;
|
||||||
|
launcherAppVersion?: string;
|
||||||
|
launcherInstallUrl?: string;
|
||||||
|
}
|
|
@ -11,6 +11,8 @@ import * as AppStore from '@app/store';
|
||||||
import { Subscription } from 'rxjs';
|
import { Subscription } from 'rxjs';
|
||||||
import { NGXLogger } from 'ngx-logger';
|
import { NGXLogger } from 'ngx-logger';
|
||||||
import { tap } from 'rxjs/operators';
|
import { tap } from 'rxjs/operators';
|
||||||
|
import { SessionStorageService } from '@ucap-webmessenger/web-storage';
|
||||||
|
import { KEY_VER_INFO, VerInfo2 } from '@app/types/ver-info.type';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ucap-profile-user-list-item',
|
selector: 'ucap-profile-user-list-item',
|
||||||
|
@ -29,24 +31,31 @@ export class UserListItemComponent implements OnInit, OnDestroy {
|
||||||
@Input()
|
@Input()
|
||||||
compactable = false;
|
compactable = false;
|
||||||
|
|
||||||
private profileImageRootSubscription: Subscription;
|
// private profileImageRootSubscription: Subscription;
|
||||||
|
|
||||||
constructor(private store: Store<any>, private logger: NGXLogger) {}
|
constructor(
|
||||||
|
private store: Store<any>,
|
||||||
|
private logger: NGXLogger,
|
||||||
|
private sessionStorageService: SessionStorageService
|
||||||
|
) {}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.profileImageRootSubscription = this.store
|
// this.profileImageRootSubscription = this.store
|
||||||
.pipe(
|
// .pipe(
|
||||||
select(AppStore.SettingSelector.VersionInfoSelector.profileImageRoot),
|
// select(AppStore.SettingSelector.VersionInfoSelector.profileImageRoot),
|
||||||
tap(profileImageRoot => {
|
// tap(profileImageRoot => {
|
||||||
this.profileImageRoot = this.profileImageRoot || profileImageRoot;
|
// this.profileImageRoot = this.profileImageRoot || profileImageRoot;
|
||||||
})
|
// })
|
||||||
)
|
// )
|
||||||
.subscribe();
|
// .subscribe();
|
||||||
|
|
||||||
|
const verInfo = this.sessionStorageService.get<VerInfo2>(KEY_VER_INFO);
|
||||||
|
this.profileImageRoot = this.profileImageRoot || verInfo.profileRoot;
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnDestroy(): void {
|
ngOnDestroy(): void {
|
||||||
if (!!this.profileImageRootSubscription) {
|
// if (!!this.profileImageRootSubscription) {
|
||||||
this.profileImageRootSubscription.unsubscribe();
|
// this.profileImageRootSubscription.unsubscribe();
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user