2024-08-07 15:23:23 +01:00
|
|
|
import { NgModule } from '@angular/core';
|
|
|
|
|
import { SignalRService } from 'src/app/module/chat/infra/socket/signal-r.service'
|
|
|
|
|
import { SyncMessageRepositoryService } from './data/service/sync-repository/sync-message-repository.service';
|
2024-08-13 10:52:35 +01:00
|
|
|
import { UserTypingAsyncService } from 'src/app/module/chat/data/async/socket/user-typing-async.service'
|
2024-08-14 15:29:16 +01:00
|
|
|
import { ChatServiceService } from 'src/app/module/chat/domain/chat-service.service'
|
2024-08-13 10:52:35 +01:00
|
|
|
|
2024-08-07 15:23:23 +01:00
|
|
|
@NgModule({
|
|
|
|
|
imports: [
|
|
|
|
|
|
|
|
|
|
],
|
|
|
|
|
providers: [
|
|
|
|
|
SyncMessageRepositoryService
|
|
|
|
|
],
|
|
|
|
|
declarations: [],
|
|
|
|
|
schemas: [],
|
|
|
|
|
entryComponents: []
|
|
|
|
|
})
|
|
|
|
|
export class ChatModule {
|
|
|
|
|
|
|
|
|
|
constructor(
|
|
|
|
|
private message: SyncMessageRepositoryService,
|
2024-08-13 10:52:35 +01:00
|
|
|
private SignalRService: SignalRService,
|
2024-08-14 15:29:16 +01:00
|
|
|
private UserTypingAsyncService: UserTypingAsyncService,
|
|
|
|
|
private ChatServiceService: ChatServiceService
|
2024-08-07 15:23:23 +01:00
|
|
|
) {
|
|
|
|
|
|
|
|
|
|
this.triggerToSendOfflineMessages()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
triggerToSendOfflineMessages() {
|
|
|
|
|
const result = this.SignalRService.getConnectionState()
|
|
|
|
|
|
|
|
|
|
result.subscribe((value) => {
|
|
|
|
|
if(value) {
|
2024-08-14 15:29:16 +01:00
|
|
|
this.ChatServiceService.asyncAllRoomMessage();
|
2024-08-07 15:23:23 +01:00
|
|
|
this.message.sendLocalMessages()
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|