diff --git a/src/app/ui/chat/component/messages/messages.page.ts b/src/app/ui/chat/component/messages/messages.page.ts index bb36ba37a..e1875dee9 100644 --- a/src/app/ui/chat/component/messages/messages.page.ts +++ b/src/app/ui/chat/component/messages/messages.page.ts @@ -426,6 +426,8 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy async viewOnce(event: Event, message: MessageViewModal, index:number) { const params: ViewOncesImagePageInput = { imageDataUrl: message.attachments[index].safeFile as any, + messageId: message.id, + roomId: this.room.id, } const modal = await this.modalController.create({ component: ViewOncesImagePage, @@ -456,14 +458,14 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy if(!me) { - //if(message.oneShot == false) { + if(message.oneShot == false) { this.chatServiceService.sendReadAt({ memberId: SessionStore.user.UserId, messageId: message.id, requestId: uuidv4(), roomId: this.room.id }) - //} + } } } @@ -502,14 +504,14 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy } } - //if(message.oneShot == false) { + if(message.oneShot == false) { this.chatServiceService.sendReadAt({ memberId: SessionStore.user.UserId, messageId: message.id, requestId: '', roomId: this.room.id }) - //} + } setTimeout(() => { this.scrollToBottomClicked() diff --git a/src/app/ui/chat/modal/view-onces/view-onces.page.ts b/src/app/ui/chat/modal/view-onces/view-onces.page.ts index 21bd372c9..67f088c2e 100644 --- a/src/app/ui/chat/modal/view-onces/view-onces.page.ts +++ b/src/app/ui/chat/modal/view-onces/view-onces.page.ts @@ -1,10 +1,13 @@ import { Component, OnInit } from '@angular/core'; import { NavParams, ModalController } from '@ionic/angular'; +import { ChatServiceService } from 'src/app/module/chat/domain/chat-service.service'; +import { SessionStore } from 'src/app/store/session.service'; import { z } from 'zod'; const ViewOncesImagePageInputSchema = z.object({ - // messageId: z.string(), + messageId: z.string(), + roomId: z.string(), // attachmentIndex: z.number(), imageDataUrl: z.string() }) @@ -24,6 +27,7 @@ export class ViewOncesImagePage implements OnInit { constructor( private navParams: NavParams, public modalController: ModalController, + private chatServiceService: ChatServiceService, ) { this.params = this.navParams.data @@ -35,6 +39,18 @@ export class ViewOncesImagePage implements OnInit { } else { this.blobURl = false } + + this.sendReadMessage(); + } + + + sendReadMessage() { + this.chatServiceService.sendReadAt({ + memberId: SessionStore.user.UserId, + messageId: this.params.messageId, + requestId: '', + roomId: this.params.roomId + }) } closePage() { diff --git a/src/app/ui/chat/store/roomStore.ts b/src/app/ui/chat/store/roomStore.ts index 0d43967d8..7aa095fb0 100644 --- a/src/app/ui/chat/store/roomStore.ts +++ b/src/app/ui/chat/store/roomStore.ts @@ -10,7 +10,6 @@ import { IDBoolean } from 'src/app/infra/database/dexie/type'; import { ChatServiceService } from 'src/app/module/chat/domain/chat-service.service'; import { MessageAttachmentSource, MessageEntitySchema } from 'src/app/core/chat/entity/message'; import { SessionStore } from 'src/app/store/session.service'; -import { Logger } from 'src/app/services/logger/main/service'; import { Observable as DexieObservable } from 'Dexie'; import { tap } from 'rxjs/operators'; import { MemberTable } from 'src/app/infra/database/dexie/instance/chat/schema/members'; @@ -224,14 +223,14 @@ export class RoomStore { } } - //if(message.oneShot == false) { + if(message.oneShot == false) { this.chatServiceService.sendReadAt({ memberId: SessionStore.user.UserId, messageId: message.id, requestId: uuidv4(), roomId: this.room.id }) - //} + } setTimeout(() => { @@ -351,14 +350,14 @@ export class RoomStore { if(!me) { // Logger.info('send read at, sender '+ message.sender.wxFullName+ ' '+ message.message +'message id'+ message.id) - //if(message.oneShot == false) { + if(message.oneShot == false) { this.chatServiceService.sendReadAt({ memberId: SessionStore.user.UserId, messageId: message.id, requestId: uuidv4(), roomId: this.room.id }) - //} + } } else { // console.log('no need', message )