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 {UserService} from '@chatenium/chatenium-sdk/services/userService';
|
||||
import { SessionManager } from '../session-manager';
|
||||
import { CacheService, LoadState } from '../cache';
|
||||
|
||||
@Component({
|
||||
selector: 'app-chat',
|
||||
@@ -42,10 +43,11 @@ import { SessionManager } from '../session-manager';
|
||||
})
|
||||
export class Chat implements OnInit {
|
||||
sessionManager = inject(SessionManager);
|
||||
serviceManager = inject(ServiceManager)
|
||||
indexedDb = inject(IndexedDB)
|
||||
breakpoint = inject(TUI_BREAKPOINT)
|
||||
router = inject(Router)
|
||||
serviceManager = inject(ServiceManager);
|
||||
cache = inject(CacheService);
|
||||
indexedDb = inject(IndexedDB);
|
||||
breakpoint = inject(TUI_BREAKPOINT);
|
||||
router = inject(Router);
|
||||
|
||||
expandedSidenav = signal(false)
|
||||
|
||||
@@ -86,24 +88,6 @@ export class Chat implements OnInit {
|
||||
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(() => {
|
||||
const latestRead = localStorage.getItem("changeLogLastRead")
|
||||
if (latestRead != environment.version) {
|
||||
@@ -115,4 +99,5 @@ export class Chat implements OnInit {
|
||||
protected readonly LoadStatus = LoadStatus;
|
||||
protected readonly localStorage = localStorage;
|
||||
protected readonly environment = environment;
|
||||
protected readonly LoadState = LoadState;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user