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 QueryStore from '@app/store/messenger/query';
|
||||
import * as SyncStore from '@app/store/messenger/sync';
|
||||
import { VerInfo2, KEY_VER_INFO } from '@app/types/ver-info.type';
|
||||
|
||||
@Injectable()
|
||||
export class AppMessengerResolver implements Resolve<void> {
|
||||
|
@ -83,6 +84,7 @@ export class AppMessengerResolver implements Resolve<void> {
|
|||
.pipe(
|
||||
take(1),
|
||||
tap(res => {
|
||||
this.sessionStorageService.set<VerInfo2>(KEY_VER_INFO, res);
|
||||
this.store.dispatch(VersionInfoStore.versionInfo2Success({ 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 { NGXLogger } from 'ngx-logger';
|
||||
import { tap } from 'rxjs/operators';
|
||||
import { SessionStorageService } from '@ucap-webmessenger/web-storage';
|
||||
import { KEY_VER_INFO, VerInfo2 } from '@app/types/ver-info.type';
|
||||
|
||||
@Component({
|
||||
selector: 'ucap-profile-user-list-item',
|
||||
|
@ -29,24 +31,31 @@ export class UserListItemComponent implements OnInit, OnDestroy {
|
|||
@Input()
|
||||
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() {
|
||||
this.profileImageRootSubscription = this.store
|
||||
.pipe(
|
||||
select(AppStore.SettingSelector.VersionInfoSelector.profileImageRoot),
|
||||
tap(profileImageRoot => {
|
||||
this.profileImageRoot = this.profileImageRoot || profileImageRoot;
|
||||
})
|
||||
)
|
||||
.subscribe();
|
||||
// this.profileImageRootSubscription = this.store
|
||||
// .pipe(
|
||||
// select(AppStore.SettingSelector.VersionInfoSelector.profileImageRoot),
|
||||
// tap(profileImageRoot => {
|
||||
// this.profileImageRoot = this.profileImageRoot || profileImageRoot;
|
||||
// })
|
||||
// )
|
||||
// .subscribe();
|
||||
|
||||
const verInfo = this.sessionStorageService.get<VerInfo2>(KEY_VER_INFO);
|
||||
this.profileImageRoot = this.profileImageRoot || verInfo.profileRoot;
|
||||
}
|
||||
|
||||
ngOnDestroy(): void {
|
||||
if (!!this.profileImageRootSubscription) {
|
||||
this.profileImageRootSubscription.unsubscribe();
|
||||
}
|
||||
// if (!!this.profileImageRootSubscription) {
|
||||
// this.profileImageRootSubscription.unsubscribe();
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user