mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 04:57:52 +00:00
add documentation and remove console logs
This commit is contained in:
@@ -14,7 +14,7 @@ import { DexieUserPhotoTable, UserPhotoTable, UserPhotoTableColumn } from './ins
|
||||
|
||||
|
||||
// Database declaration (move this to its own module also)
|
||||
export const chatDatabase = new Dexie('chat-database-v2',{
|
||||
export const chatDatabase = new Dexie('chat-database-v3',{
|
||||
// indexedDB: new FDBFactory,
|
||||
// IDBKeyRange: FDBKeyRange, // Mocking IDBKeyRange
|
||||
}) as Dexie & {
|
||||
|
||||
@@ -33,6 +33,10 @@ export class RoomBoldSyncUseCaseService {
|
||||
this.loadHistory()
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @description listen to all incoming message and set bold to true
|
||||
*/
|
||||
private listenToIncomingMessage() {
|
||||
return this.MessageSocketRepositoryService.listenToMessages().pipe(
|
||||
filter((message) => !message?.requestId?.startsWith(InstanceId)),
|
||||
@@ -51,6 +55,10 @@ export class RoomBoldSyncUseCaseService {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @description Listen to all update message. If the incoming updated message has readAt my me and is the last message then remove bold
|
||||
*/
|
||||
private listenToUpdateMessages() {
|
||||
return this.MessageSocketRepositoryService.listenToUpdateMessages().pipe(
|
||||
filter((message) => !message?.requestId?.startsWith(InstanceId)),
|
||||
@@ -77,6 +85,9 @@ export class RoomBoldSyncUseCaseService {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @description set bold base on the last message on load history. If the last message has readAt by me then remove bold in case not set bold
|
||||
*/
|
||||
@XTracerAsync({name:'RoomBoldSyncUseCaseService/loadHistory', module:'chat', bugPrint: true})
|
||||
private loadHistory() {
|
||||
const regex = new RegExp("Room\\/([0-9a-fA-F]{8})-([0-9a-fA-F]{4})-([0-9a-fA-F]{4})-([0-9a-fA-F]{4})-([0-9a-fA-F]{12})\\/Messages");
|
||||
|
||||
@@ -163,7 +163,7 @@ export class RoomSetLastMessageService {
|
||||
|
||||
const room = await this.roomLocalRepository.findOne({id: roomId})
|
||||
|
||||
if(room.isOk()) {
|
||||
if(room.isOk() && room.value) {
|
||||
const roomEntity = new RoomEntity(room.value)
|
||||
if(!roomEntity.hasLastMessage()) {
|
||||
await this.roomLocalRepository.update(loadHistoryFirstMessage.roomId, {
|
||||
@@ -219,6 +219,8 @@ export class RoomSetLastMessageService {
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
console.log('cant find room locally')
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -178,17 +178,17 @@ export class ContactsPage implements OnInit {
|
||||
|
||||
if(room.isOk()) {
|
||||
|
||||
console.log('room', room)
|
||||
console.log('result.value', result.value)
|
||||
console.log('receiverId', user.wxUserId)
|
||||
|
||||
// await this.chatServiceService.getRoomById(user.wxUserId.toString())
|
||||
this.close(user.wxUserId.toString())
|
||||
this.openMessageComponent(new RoomViewModel(room.value))
|
||||
}
|
||||
|
||||
} else {
|
||||
this.close(user.wxUserId.toString())
|
||||
const room = await this.chatServiceService.roomGetLocalById({
|
||||
$roomId: user.wxUserId.toString()
|
||||
})
|
||||
|
||||
if(room.isOk()) {
|
||||
this.openMessageComponent(new RoomViewModel(room.value))
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user