fix chat un read messges

This commit is contained in:
Peter Maquiran
2024-03-01 14:42:16 +01:00
parent 1f4274e3e0
commit 9c7c1589e6
10 changed files with 104 additions and 24 deletions
@@ -21,7 +21,7 @@
</div>
<div>
<div class="subject" [ngClass]="{'add-ellipsis': i != selectedIndex}">{{ attachment.Assunto || "Sem assunto" }}</div>
<div class="subject add-ellipsis">{{ attachment.Assunto || "Sem assunto" }}</div>
<div class="user" >
{{ attachment.Sender }}
</div>
@@ -25,7 +25,7 @@
margin: 0px;
}
.subject {
max-width: 230px;
max-width: 150px;
}
ion-icon {
@@ -47,7 +47,7 @@ iframe {
}
.subject {
max-width: 300px !important;
max-width: 200px !important;
}
}
+22
View File
@@ -82,6 +82,28 @@ export class ChatService {
return this.http.get(environment.apiChatUrl + 'rooms.info', opts);
}
GetSubscriptionRoomUnreadM(roomId) {
let params = new HttpParams();
params = params.set("roomId", roomId);
let opts = {
headers: this.headers,
params: params
}
return this.http.get(environment.apiChatUrl + 'subscriptions.getOne', opts);
}
getChannelInfo(roomId: any) {
let params = new HttpParams();
params = params.set("roomId", roomId);
params = params.set("unread", "true");
let opts = {
headers: this.headers,
params: params
}
return this.http.get(environment.apiChatUrl + 'rooms.info', opts);
}
customsRooms(params: any) {
let opts = {
headers: this.headers,
+5 -1
View File
@@ -370,7 +370,9 @@ export class ChatSystemService {
this.RochetChatConnectorService.streamNotifyLogged().then((subscription => { }))
this.RochetChatConnectorService.subStreamMessageUser().then((subscription => { }))
this.RochetChatConnectorService.subStreamMessageUser().then((subscription => {
console.log({subscription})
}))
} else {
setTimeout(() => {
@@ -490,6 +492,8 @@ export class ChatSystemService {
room.sortRoomList = this.sortRoomList
room.chatServiceDeleteRoom = this.deleteRoom
room.isGroup = !this.isIndividual(roomData)
room.info()
// create individual room
if (this.isIndividual(roomData)) {
@@ -461,6 +461,11 @@ export class RochetChatConnectorService {
resolve(message)
return true
}
if (message.id == requestId || message?.subs?.[0] == requestId) { // same request send
resolve(message)
return true
}
}
})
});
@@ -588,6 +593,40 @@ export class RochetChatConnectorService {
});
}
loadHistoryUnread(roomId, limit: number = 50) {
const requestId = uuidv4()
const message = {
msg: "method",
method: "loadHistory",
id: requestId,
params: [
roomId,
null,
limit,
{
"$date": 1480377601
}
]
}
this.ws.send({ message, requestId: 'loadHistory' })
return new Promise<chatHistory>((resolve, reject) => {
this.ws.registerCallback({
type: 'Onmessage', funx: (message) => {
//
if (message.id == requestId) { // same request send
resolve(message)
return true
}
}
})
});
}
setStatus(status: 'online' | 'busy' | 'away' | 'offline') {
const requestId = uuidv4()
+16 -1
View File
@@ -379,6 +379,17 @@ export class RoomService {
}, 5)
})
async info() {
// set unread messages
const response: any = await this.chatService.GetSubscriptionRoomUnreadM(this.id).toPromise()
if(response?.subscription?.unread >= 1) {
this.messageUnread = true
}
}
getUsersByStatus(status: 'offline' | 'online') {
return this.getAllUsers().filter((user => {
@@ -958,6 +969,10 @@ export class RoomService {
const users = this.getUsersByStatus('online')
if(chatHistory.result.unreadNotLoaded >= 1) {
this.messageUnread = true
}
for (let message of chatHistory.result.messages.reverse()) {
message.origin = 'history'
@@ -1231,7 +1246,7 @@ export class RoomService {
setTimeout(() => {
console.log("getGroupMembers", this.membersExcludeMe)
// console.log("getGroupMembers", this.membersExcludeMe)
}, 500)
}
@@ -1,5 +1,5 @@
<ion-header *ngIf="task" class="ion-no-border ">
<div class="main-header mt-30 px-20">
<div *ngIf="dropButton" class="main-header mt-30 px-20">
<div class="title-content width-100 d-flex justify-space-between align-center">
<div class=" btn-dismiss font-30-rem cursor-pointer" (click)="goBack.emit()" defaultHref="#">
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " slot="end" src='assets/images/icons-arrow-arrow-left.svg'></ion-icon>
@@ -28,7 +28,7 @@
</div>
<div class=" flex-1 d-flex flex-column height-100 d-flex overflow-y-auto-desktop" >
<div class="upper-content" >
<div *ngIf="dropButton" class="upper-content" >
<div class="content-details">
<div class="mobile-header">
<ion-label>
@@ -44,7 +44,7 @@
</ion-label>
</div>
</div>
<div class="line mx-20"></div>
<div *ngIf="dropButton" class="line mx-20"></div>
<div style="
display: flex;
+3 -3
View File
@@ -1,7 +1,7 @@
import { Environment } from './../app/models/envarioment'
import { oaprProd } from './suport/oapr'
import { doneITProd } from './suport/doneIt'
// import { DevDev } from './suport/dev'
// import { doneITProd } from './suport/doneIt'
import { DevDev } from './suport/dev'
export const environment: Environment = doneITProd;
export const environment: Environment = DevDev;
+3 -3
View File
@@ -1,7 +1,7 @@
import { Environment } from './../app/models/envarioment'
import { oaprDev } from './suport/oapr'
import { doneITDev } from './suport/doneIt'
//import { DevDev } from './suport/dev'
// import { doneITDev } from './suport/doneIt'
import { DevDev } from './suport/dev'
export const environment: Environment = doneITDev
export const environment: Environment = DevDev