Removed old redundant initializers
This commit is contained in:
@@ -16,6 +16,7 @@ import {UserSettings} from './user-settings/user-settings';
|
|||||||
import {AuthService} from '@chatenium/chatenium-sdk/services/authService';
|
import {AuthService} from '@chatenium/chatenium-sdk/services/authService';
|
||||||
import {UserService} from '@chatenium/chatenium-sdk/services/userService';
|
import {UserService} from '@chatenium/chatenium-sdk/services/userService';
|
||||||
import { SessionManager } from '../session-manager';
|
import { SessionManager } from '../session-manager';
|
||||||
|
import { CacheService, LoadState } from '../cache';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-chat',
|
selector: 'app-chat',
|
||||||
@@ -42,10 +43,11 @@ import { SessionManager } from '../session-manager';
|
|||||||
})
|
})
|
||||||
export class Chat implements OnInit {
|
export class Chat implements OnInit {
|
||||||
sessionManager = inject(SessionManager);
|
sessionManager = inject(SessionManager);
|
||||||
serviceManager = inject(ServiceManager)
|
serviceManager = inject(ServiceManager);
|
||||||
indexedDb = inject(IndexedDB)
|
cache = inject(CacheService);
|
||||||
breakpoint = inject(TUI_BREAKPOINT)
|
indexedDb = inject(IndexedDB);
|
||||||
router = inject(Router)
|
breakpoint = inject(TUI_BREAKPOINT);
|
||||||
|
router = inject(Router);
|
||||||
|
|
||||||
expandedSidenav = signal(false)
|
expandedSidenav = signal(false)
|
||||||
|
|
||||||
@@ -86,24 +88,6 @@ export class Chat implements OnInit {
|
|||||||
this.navigationActiveIndex = 2
|
this.navigationActiveIndex = 2
|
||||||
}
|
}
|
||||||
|
|
||||||
this.indexedDb.openDatabase().then(async () => {
|
|
||||||
const session = await this.serviceManager.sessionManager.loadPreferredSession()
|
|
||||||
this.serviceManager.currentSession.set(session)
|
|
||||||
this.serviceManager.currentSessionHandler = new UserService(session.userData.userid, session.token, this.indexedDb.getApi())
|
|
||||||
await WebSocketHandler.getInstance().connect(session.userData.userid, session.token)
|
|
||||||
try {
|
|
||||||
console.log("Updating sessions...")
|
|
||||||
const sessions = await this.serviceManager.sessionManager.loadSessions()
|
|
||||||
console.log("Updating sessions: saved sessions loaded...")
|
|
||||||
await this.serviceManager.sessionManager.updateSessions(sessions)
|
|
||||||
const session = await this.serviceManager.sessionManager.loadPreferredSession()
|
|
||||||
console.log("Updating sessions succeeded: updating sessions...")
|
|
||||||
this.serviceManager.currentSession.set(session)
|
|
||||||
} catch (e) {
|
|
||||||
console.warn("Session update failed, skipping...", e)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
const latestRead = localStorage.getItem("changeLogLastRead")
|
const latestRead = localStorage.getItem("changeLogLastRead")
|
||||||
if (latestRead != environment.version) {
|
if (latestRead != environment.version) {
|
||||||
@@ -115,4 +99,5 @@ export class Chat implements OnInit {
|
|||||||
protected readonly LoadStatus = LoadStatus;
|
protected readonly LoadStatus = LoadStatus;
|
||||||
protected readonly localStorage = localStorage;
|
protected readonly localStorage = localStorage;
|
||||||
protected readonly environment = environment;
|
protected readonly environment = environment;
|
||||||
|
protected readonly LoadState = LoadState;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user