diff --git a/angular.json b/angular.json
index 889dc4fd9..0c755a853 100644
--- a/angular.json
+++ b/angular.json
@@ -211,4 +211,4 @@
"styleext": "scss"
}
}
-}
\ No newline at end of file
+}
diff --git a/src/app/pages/gabinete-digital/viewer-attachment/viewer-attachment.page.html b/src/app/pages/gabinete-digital/viewer-attachment/viewer-attachment.page.html
index fc65b0d24..71037aef3 100644
--- a/src/app/pages/gabinete-digital/viewer-attachment/viewer-attachment.page.html
+++ b/src/app/pages/gabinete-digital/viewer-attachment/viewer-attachment.page.html
@@ -21,7 +21,7 @@
-
{{ attachment.Assunto || "Sem assunto" }}
+
{{ attachment.Assunto || "Sem assunto" }}
{{ attachment.Sender }}
diff --git a/src/app/pages/gabinete-digital/viewer-attachment/viewer-attachment.page.scss b/src/app/pages/gabinete-digital/viewer-attachment/viewer-attachment.page.scss
index 102b090c1..62d3f8d8d 100644
--- a/src/app/pages/gabinete-digital/viewer-attachment/viewer-attachment.page.scss
+++ b/src/app/pages/gabinete-digital/viewer-attachment/viewer-attachment.page.scss
@@ -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;
}
}
diff --git a/src/app/services/chat.service.ts b/src/app/services/chat.service.ts
index 236cd2fd0..792716595 100644
--- a/src/app/services/chat.service.ts
+++ b/src/app/services/chat.service.ts
@@ -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
}
diff --git a/src/app/services/chat/chat-system.service.ts b/src/app/services/chat/chat-system.service.ts
index b1815b00d..175a72db1 100644
--- a/src/app/services/chat/chat-system.service.ts
+++ b/src/app/services/chat/chat-system.service.ts
@@ -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)) {
diff --git a/src/app/services/chat/rochet-chat-connector.service.ts b/src/app/services/chat/rochet-chat-connector.service.ts
index bd2d2e3c6..9993c6d53 100644
--- a/src/app/services/chat/rochet-chat-connector.service.ts
+++ b/src/app/services/chat/rochet-chat-connector.service.ts
@@ -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
((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()
diff --git a/src/app/services/chat/room.service.ts b/src/app/services/chat/room.service.ts
index 71cbe6ad0..8278a55c3 100644
--- a/src/app/services/chat/room.service.ts
+++ b/src/app/services/chat/room.service.ts
@@ -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)
}
diff --git a/src/app/shared/gabinete-digital/generic/task-details/task-details.page.html b/src/app/shared/gabinete-digital/generic/task-details/task-details.page.html
index eab6674f0..093a8cdca 100644
--- a/src/app/shared/gabinete-digital/generic/task-details/task-details.page.html
+++ b/src/app/shared/gabinete-digital/generic/task-details/task-details.page.html
@@ -1,5 +1,5 @@
-