receive user typing

This commit is contained in:
Peter Maquiran
2024-07-17 16:39:18 +01:00
parent 0312df88e8
commit cf6fe3a4c8
17 changed files with 424 additions and 33 deletions
@@ -50,6 +50,9 @@ export class MessageRepositoryService {
if(localActionResult.isOk()) {
(await this.sendTyping(data.roomId)).map((e) => {
console.log('map', e)
})
const sendMessageResult = await this.messageLiveSignalRDataSourceService.sendMessage(data)
@@ -101,4 +104,8 @@ export class MessageRepositoryService {
subscribeToNewMessages(roomId: any) {
return this.messageLocalDataSourceService.subscribeToNewMessage(roomId)
}
sendTyping(ChatRoomId) {
return this.messageLiveSignalRDataSourceService.sendTyping({ChatRoomId, UserName:SessionStore.user.FullName})
}
}
@@ -42,26 +42,7 @@ export class RoomRepositoryService {
private roomLocalDataSourceService: RoomLocalDataSourceService,
private roomLiveDataSourceService: RoomLiveDataSourceService,
private messageLiveDataSourceService: MessageLiveDataSourceService,
) {
// this.messageLiveDataSourceService.socket.messages$.subscribe(({payload, requestId, type}) => {
// if(payload.sender == null) {
// delete payload.sender
// }
// if(type == 'sendMessage') {
// let clone: TableMessage = {
// ...payload,
// messageId: payload.id,
// }
// this.roomLocalDataSourceService.updateRoom({lastMessage: clone})
// }
// })
}
) {}
@captureAndReraiseAsync('RoomRepositoryService/list')
async list() {
@@ -0,0 +1,28 @@
import { Injectable } from '@angular/core';
import { TypingList, UserTypingLocalDataSourceService } from '../data-source/userTyping/user-typing-local-data-source.service';
import { UserTypingLiveDataSourceService } from '../data-source/userTyping/user-typing-live-data-source.service';
import { SessionStore } from 'src/app/store/session.service';
@Injectable({
providedIn: 'root'
})
export class UserTypingServiceRepository {
constructor(
private localDataSource: UserTypingLocalDataSourceService,
private liveDataSource: UserTypingLiveDataSourceService
) { }
async addUserTyping(ChatRoomId: any) {
return await this.liveDataSource.sendTyping(ChatRoomId)
}
async removeUserTyping(data: TypingList) {
return await this.localDataSource.removeUserTyping(data)
}
getUserTypingLive() {
return this.localDataSource.getUserTypingLive()
}
}