35 lines
1004 B
TypeScript
35 lines
1004 B
TypeScript
import {Component, inject, OnInit} from '@angular/core';
|
|
import {RouterOutlet} from '@angular/router';
|
|
import {TuiSegmented} from '@taiga-ui/kit';
|
|
import {TuiButton, TuiIcon, TuiLoader} from '@taiga-ui/core';
|
|
import {SessionManager} from '@chatenium/chatenium-sdk/services/sessionManager';
|
|
import {ServiceManager} from '../service-manager';
|
|
import {IndexedDB} from '../storage/indexed-db';
|
|
import {DmList} from './dm-list/dm-list';
|
|
import {JsonPipe} from '@angular/common';
|
|
|
|
@Component({
|
|
selector: 'app-chat',
|
|
imports: [
|
|
RouterOutlet,
|
|
TuiSegmented,
|
|
TuiIcon,
|
|
TuiButton,
|
|
TuiLoader,
|
|
DmList,
|
|
JsonPipe
|
|
],
|
|
templateUrl: './chat.html',
|
|
styleUrl: './chat.scss',
|
|
})
|
|
export class Chat implements OnInit {
|
|
serviceManager = inject(ServiceManager)
|
|
indexedDb = inject(IndexedDB)
|
|
|
|
async ngOnInit() {
|
|
this.indexedDb.openDatabase().then(async () => {
|
|
this.serviceManager.currentSession.set(await this.serviceManager.sessionManager.loadPreferredSession())
|
|
})
|
|
}
|
|
}
|