This commit is contained in:
Peter Maquiran
2023-01-05 12:11:50 +01:00
parent 0d485672d8
commit 572ab6db7b
12 changed files with 165 additions and 88 deletions
+4 -31
View File
@@ -22,6 +22,7 @@ import { IncomingChatMessage, ChatMessageInterface, falseTypingMethod } from 'sr
import { AttachmentsService } from 'src/app/services/attachments.service';
import { ConnectionStatus, NetworkServiceService} from 'src/app/services/network-service.service';
import { ChatSystemService } from './chat-system.service';
import { ViewedMessageService } from './viewed-message.service'
@Injectable({
providedIn: 'root'
@@ -94,7 +95,8 @@ export class RoomService {
private AESEncrypt: AESEncrypt,
private AttachmentsService: AttachmentsService,
private NetworkServiceService: NetworkServiceService,
private ChatSystemService: ChatSystemService
private ChatSystemService: ChatSystemService,
private ViewedMessageService: ViewedMessageService
) {
this.NativeNotificationService.askForPermission()
@@ -104,37 +106,8 @@ export class RoomService {
const statusNum = d.fields.args[0][2]
const statusText = this.statusNumberToText(statusNum)
if(this.membersExcludeMe?.map) {
const membersIds = this.membersExcludeMe.map((user)=> user._id)
this.ViewedMessageService.request(this, userId, statusNum, statusText)
if(membersIds.includes(userId)) {
if(statusText != 'offline') {
this.deleteMessageToReceive(userId)
}
this.messages.forEach((message, index) => {
if(!message.messageOwnerById(userId)) {
if(!this.messages[index]?.received?.includes(userId)) {
if(this.messages[index]._id) {
try {
if(!this.messages[index].received.includes(userId)) {
this.messages[index].received.push(userId)
}
} catch(e) {
this.messages[index].received = [userId]
}
this.messages[index].save()
}
}
}
})
}
}
})
this.RochetChatConnectorService.registerCallback({