mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
fix chat un read messges
This commit is contained in:
+1
-1
@@ -211,4 +211,4 @@
|
||||
"styleext": "scss"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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,
|
||||
@@ -348,12 +370,12 @@ export class ChatService {
|
||||
|
||||
setheader() {
|
||||
try {
|
||||
|
||||
|
||||
if (this.p.userPermission(this.p.permissionList.Chat.access) && SessionStore.user.ChatData) {
|
||||
this.headers = new HttpHeaders();;
|
||||
|
||||
|
||||
if (this.p.userPermission(this.p.permissionList.Chat.access)) {
|
||||
//
|
||||
//
|
||||
this.headers = this.headers.set('X-User-Id', SessionStore.user.ChatData.data.userId);
|
||||
this.headers = this.headers.set('X-Auth-Token', SessionStore.user.ChatData.data.authToken);
|
||||
this.options = {
|
||||
@@ -375,10 +397,10 @@ export class ChatService {
|
||||
let options = {
|
||||
headers: this.headers
|
||||
};
|
||||
|
||||
|
||||
try {
|
||||
let res = await this.http.get(environment.apiURL + 'UserAuthentication/RegenereChatToken', options).toPromise();
|
||||
|
||||
|
||||
let data = {
|
||||
status: res['status'],
|
||||
data: {
|
||||
@@ -412,7 +434,7 @@ export class ChatService {
|
||||
await this.refreshtoken();
|
||||
}, 60000)
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -436,13 +458,13 @@ export class ChatService {
|
||||
if(this.timerEventTriggerDateLastUpdate == null) {
|
||||
return true
|
||||
}
|
||||
|
||||
|
||||
if(diffTime >= 5000) {
|
||||
return true
|
||||
}
|
||||
|
||||
return false
|
||||
|
||||
|
||||
}
|
||||
|
||||
functionTimer = null;
|
||||
@@ -460,7 +482,7 @@ export class ChatService {
|
||||
} else {
|
||||
this.resetTimer()
|
||||
}
|
||||
|
||||
|
||||
}, 60000 * 15); // time is in milliseconds
|
||||
|
||||
}
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user