mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 12:37:53 +00:00
fix chat open modal
This commit is contained in:
@@ -390,7 +390,7 @@
|
|||||||
CODE_SIGN_ENTITLEMENTS = App/App.entitlements;
|
CODE_SIGN_ENTITLEMENTS = App/App.entitlements;
|
||||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution";
|
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution";
|
||||||
CODE_SIGN_STYLE = Manual;
|
CODE_SIGN_STYLE = Manual;
|
||||||
CURRENT_PROJECT_VERSION = 47;
|
CURRENT_PROJECT_VERSION = 61;
|
||||||
DEVELOPMENT_TEAM = "";
|
DEVELOPMENT_TEAM = "";
|
||||||
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = 94BRNM2LSS;
|
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = 94BRNM2LSS;
|
||||||
INFOPLIST_FILE = App/Info.plist;
|
INFOPLIST_FILE = App/Info.plist;
|
||||||
@@ -419,7 +419,7 @@
|
|||||||
CODE_SIGN_ENTITLEMENTS = App/App.entitlements;
|
CODE_SIGN_ENTITLEMENTS = App/App.entitlements;
|
||||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution";
|
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution";
|
||||||
CODE_SIGN_STYLE = Manual;
|
CODE_SIGN_STYLE = Manual;
|
||||||
CURRENT_PROJECT_VERSION = 47;
|
CURRENT_PROJECT_VERSION = 61;
|
||||||
DEVELOPMENT_TEAM = "";
|
DEVELOPMENT_TEAM = "";
|
||||||
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = 94BRNM2LSS;
|
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = 94BRNM2LSS;
|
||||||
INFOPLIST_FILE = App/Info.plist;
|
INFOPLIST_FILE = App/Info.plist;
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ import { SessionStore } from 'src/app/store/session.service';
|
|||||||
import { ChatDebuggingPage } from 'src/app/shared/popover/chat-debugging/chat-debugging.page';
|
import { ChatDebuggingPage } from 'src/app/shared/popover/chat-debugging/chat-debugging.page';
|
||||||
import { EventTrigger } from 'src/app/services/eventTrigger.service';
|
import { EventTrigger } from 'src/app/services/eventTrigger.service';
|
||||||
import { RochetChatConnectorService } from 'src/app/services/chat/rochet-chat-connector.service';
|
import { RochetChatConnectorService } from 'src/app/services/chat/rochet-chat-connector.service';
|
||||||
|
import { RouteService } from 'src/app/services/route.service';
|
||||||
import { Plugins } from '@capacitor/core';
|
import { Plugins } from '@capacitor/core';
|
||||||
|
|
||||||
const { App } = Plugins;
|
const { App } = Plugins;
|
||||||
@@ -126,7 +126,8 @@ export class ChatPage implements OnInit {
|
|||||||
private activatedRoute: ActivatedRoute,
|
private activatedRoute: ActivatedRoute,
|
||||||
private eventTriger: EventTrigger,
|
private eventTriger: EventTrigger,
|
||||||
private RochetChatConnectorService: RochetChatConnectorService,
|
private RochetChatConnectorService: RochetChatConnectorService,
|
||||||
private zone: NgZone
|
private zone: NgZone,
|
||||||
|
public RouteService: RouteService,
|
||||||
) {
|
) {
|
||||||
|
|
||||||
this.headers = new HttpHeaders();
|
this.headers = new HttpHeaders();
|
||||||
@@ -174,7 +175,6 @@ export class ChatPage implements OnInit {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
this.routeCheck()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnDestroy() {
|
ngOnDestroy() {
|
||||||
@@ -189,14 +189,45 @@ export class ChatPage implements OnInit {
|
|||||||
// Retry connecting or other reconnection logic can be added here.
|
// Retry connecting or other reconnection logic can be added here.
|
||||||
}
|
}
|
||||||
|
|
||||||
routeCheck() {
|
firstEnter = true
|
||||||
|
|
||||||
|
routeCheck() {
|
||||||
const urlParams = new URLSearchParams(window.location.search);
|
const urlParams = new URLSearchParams(window.location.search);
|
||||||
const roomId = urlParams.get('roomId');
|
const roomId = urlParams.get('roomId');
|
||||||
|
|
||||||
if (roomId) {
|
if (roomId) {
|
||||||
const room = this.ChatSystemService.getRoomById(roomId);
|
|
||||||
|
|
||||||
|
if (this.firstEnter) {
|
||||||
|
this.firstEnter = false
|
||||||
|
|
||||||
|
let delay = this.RouteService.history.find((item) => {
|
||||||
|
return ['/home/publications', '/home/agenda', '/home/gabinete', '/home/events'].filter(x => {
|
||||||
|
return item.includes(x)
|
||||||
|
}).length >= 1
|
||||||
|
})
|
||||||
|
if (!delay) {
|
||||||
|
console.log("delay")
|
||||||
|
setTimeout(() => {
|
||||||
|
this.openChat(roomId)
|
||||||
|
}, 2000)
|
||||||
|
} else {
|
||||||
|
console.log("no dalay")
|
||||||
|
this.openChat(roomId)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.openChat(roomId)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
openFailed = 0
|
||||||
|
openChat(roomId) {
|
||||||
|
const room = this.ChatSystemService.getRoomById(roomId);
|
||||||
|
if (room) {
|
||||||
|
this.openFailed = 0
|
||||||
if (room.isGroup) {
|
if (room.isGroup) {
|
||||||
this.segment = 'Grupos'
|
this.segment = 'Grupos'
|
||||||
this.openGroupMessagesPage(roomId)
|
this.openGroupMessagesPage(roomId)
|
||||||
@@ -204,8 +235,17 @@ export class ChatPage implements OnInit {
|
|||||||
this.segment = 'Contactos'
|
this.segment = 'Contactos'
|
||||||
this.openMessagesPage(roomId)
|
this.openMessagesPage(roomId)
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
|
if (this.openFailed <= 3) {
|
||||||
|
this.openFailed++
|
||||||
|
|
||||||
|
setTimeout(() => {
|
||||||
|
this.openChat(roomId)
|
||||||
|
}, 1000)
|
||||||
|
} else {
|
||||||
|
this.openFailed = 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -751,7 +791,6 @@ export class ChatPage implements OnInit {
|
|||||||
});
|
});
|
||||||
|
|
||||||
modal.onDidDismiss().then((Data) => {
|
modal.onDidDismiss().then((Data) => {
|
||||||
// console.log(Data,'daatatatat');
|
|
||||||
|
|
||||||
// let data = Data.data
|
// let data = Data.data
|
||||||
// let roomId = data.roomId
|
// let roomId = data.roomId
|
||||||
|
|||||||
@@ -30,7 +30,8 @@
|
|||||||
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' " src="assets/icon/theme/gov/icons-user.svg"></ion-icon>
|
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' " src="assets/icon/theme/gov/icons-user.svg"></ion-icon>
|
||||||
</div>
|
</div>
|
||||||
<div class="header-bottom-contacts" *ngIf="ChatSystemService.getGroupRoom(roomId)">
|
<div class="header-bottom-contacts" *ngIf="ChatSystemService.getGroupRoom(roomId)">
|
||||||
<ion-label class="contacts-list" *ngFor="let member of ChatSystemService.getGroupRoom(roomId).membersExcludeMe" >
|
<ion-label class="contacts-list"
|
||||||
|
*ngFor="let member of ChatSystemService.getGroupRoom(roomId).membersExcludeMe">
|
||||||
{{member.name}},
|
{{member.name}},
|
||||||
</ion-label>
|
</ion-label>
|
||||||
</div>
|
</div>
|
||||||
@@ -39,6 +40,7 @@
|
|||||||
<i class="far fa-clock font-15"></i>
|
<i class="far fa-clock font-15"></i>
|
||||||
<ion-label class="font-15 pl-10" color="warning">{{roomCountDownDate}}</ion-label>
|
<ion-label class="font-15 pl-10" color="warning">{{roomCountDownDate}}</ion-label>
|
||||||
</div>
|
</div>
|
||||||
|
{{ RouteService.history }}
|
||||||
</div>
|
</div>
|
||||||
</ion-toolbar>
|
</ion-toolbar>
|
||||||
</ion-header>
|
</ion-header>
|
||||||
@@ -51,19 +53,26 @@
|
|||||||
<ion-label>Esta conversa passou a grupo</ion-label><br />
|
<ion-label>Esta conversa passou a grupo</ion-label><br />
|
||||||
<ion-label>A conversa original mantêm-se como chat individual</ion-label>
|
<ion-label>A conversa original mantêm-se como chat individual</ion-label>
|
||||||
</div>
|
</div>
|
||||||
<div class="messages-list-item-wrapper container-width-100" *ngFor="let msg of ChatSystemService.getGroupRoom(roomId).messages; let last = last" [class.messages-list-item-wrapper-active]="msg._id == selectedMsgId">
|
<div class="messages-list-item-wrapper container-width-100"
|
||||||
<div class='message-container incoming-{{msg.u.username!=sessionStore.user.UserName}}' *ngIf="msg.t != 'r' && msg.t != 'ul' && msg.t != 'au' && msg.t != 'ru' && msg.msg !=''" (press)="handlePress(msg._id)" [class.dateLabel]="msg.dateLabel">
|
*ngFor="let msg of ChatSystemService.getGroupRoom(roomId).messages; let last = last"
|
||||||
|
[class.messages-list-item-wrapper-active]="msg._id == selectedMsgId">
|
||||||
|
<div class='message-container incoming-{{msg.u.username!=sessionStore.user.UserName}}'
|
||||||
|
*ngIf="msg.t != 'r' && msg.t != 'ul' && msg.t != 'au' && msg.t != 'ru' && msg.msg !=''"
|
||||||
|
(press)="handlePress(msg._id)" [class.dateLabel]="msg.dateLabel">
|
||||||
<div class="title" *ngIf="!msg.dateLabel">
|
<div class="title" *ngIf="!msg.dateLabel">
|
||||||
<ion-label>{{msg.u.name ?? ""}}</ion-label>
|
<ion-label>{{msg.u.name ?? ""}}</ion-label>
|
||||||
<span class="time">{{msg.time}}</span>
|
<span class="time">{{msg.time}}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="message">
|
<div class="message">
|
||||||
<pre *ngIf="msg.delate == false" class="message-box text ma-0 font-13-rem" style="font-size: 0.8125rem !important;" >{{msg.msg}}</pre>
|
<pre *ngIf="msg.delate == false" class="message-box text ma-0 font-13-rem"
|
||||||
<pre *ngIf="msg.delate == true" class="message-box text ma-0 font-13-rem" style="font-size: 0.8125rem !important;" >{{msg.msg}}</pre>
|
style="font-size: 0.8125rem !important;">{{msg.msg}}</pre>
|
||||||
|
<pre *ngIf="msg.delate == true" class="message-box text ma-0 font-13-rem"
|
||||||
|
style="font-size: 0.8125rem !important;">{{msg.msg}}</pre>
|
||||||
|
|
||||||
|
|
||||||
<ion-label class="float-status-all float-status" *ngIf="msg.u.username==sessionStore.user.UserName">
|
<ion-label class="float-status-all float-status" *ngIf="msg.u.username==sessionStore.user.UserName">
|
||||||
<span *ngIf="msg.online == true && !msg.manualRetry && msg.viewed == 0" class="enviado pl-10"> Enviado</span>
|
<span *ngIf="msg.online == true && !msg.manualRetry && msg.viewed == 0" class="enviado pl-10">
|
||||||
|
Enviado</span>
|
||||||
<!-- <ion-icon *ngIf="msg.messageSend == false && !msg.manualRetry" src="assets/images/clock-regular.svg"></ion-icon> -->
|
<!-- <ion-icon *ngIf="msg.messageSend == false && !msg.manualRetry" src="assets/images/clock-regular.svg"></ion-icon> -->
|
||||||
<!-- <ion-icon *ngIf="msg.messageSend == true && msg.received.length == 0 && msg.viewed.length == 0" src="assets/images/check-solid.svg"></ion-icon> -->
|
<!-- <ion-icon *ngIf="msg.messageSend == true && msg.received.length == 0 && msg.viewed.length == 0" src="assets/images/check-solid.svg"></ion-icon> -->
|
||||||
<!-- <ion-icon *ngIf="msg.messageSend && msg.received.length >= 1 && msg.viewed.length == 0" src="assets/images/check-double-solid.svg"></ion-icon> -->
|
<!-- <ion-icon *ngIf="msg.messageSend && msg.received.length >= 1 && msg.viewed.length == 0" src="assets/images/check-double-solid.svg"></ion-icon> -->
|
||||||
@@ -77,7 +86,10 @@
|
|||||||
|
|
||||||
|
|
||||||
<div *ngIf="msg.file && msg.delate == false">
|
<div *ngIf="msg.file && msg.delate == false">
|
||||||
<div class='message-container incoming-{{msg.u.username!=sessionStore.user.UserName}}' class='message-container incoming-{{msg.u.username!=sessionStore.user.UserName}}' *ngIf="msg.t != 'r' && msg.t != 'ul' && msg.t != 'ru' && msg.file.type != 'application/meeting'" (press)="handlePress(msg._id)">
|
<div class='message-container incoming-{{msg.u.username!=sessionStore.user.UserName}}'
|
||||||
|
class='message-container incoming-{{msg.u.username!=sessionStore.user.UserName}}'
|
||||||
|
*ngIf="msg.t != 'r' && msg.t != 'ul' && msg.t != 'ru' && msg.file.type != 'application/meeting'"
|
||||||
|
(press)="handlePress(msg._id)">
|
||||||
<div class="title">
|
<div class="title">
|
||||||
<ion-label>{{msg.u.name ?? ""}}</ion-label>
|
<ion-label>{{msg.u.name ?? ""}}</ion-label>
|
||||||
<span class="time">{{msg.time}}</span>
|
<span class="time">{{msg.time}}</span>
|
||||||
@@ -88,20 +100,29 @@
|
|||||||
<div *ngIf="msg.file.type == 'application/img' && !msg.attachments[0].image_url">
|
<div *ngIf="msg.file.type == 'application/img' && !msg.attachments[0].image_url">
|
||||||
NOT UPLOADED
|
NOT UPLOADED
|
||||||
</div>
|
</div>
|
||||||
<div *ngIf="msg.file.type == 'application/img' && msg.attachments[0].image_url" (click)="openPreview(msg)">
|
<div *ngIf="msg.file.type == 'application/img' && msg.attachments[0].image_url"
|
||||||
|
(click)="openPreview(msg)">
|
||||||
<div *ngIf="!msg.attachments[0].image_url">
|
<div *ngIf="!msg.attachments[0].image_url">
|
||||||
<ion-item class="add-attachment-bg-color" shape="round" lines="none" type="button">
|
<ion-item class="add-attachment-bg-color" shape="round" lines="none" type="button">
|
||||||
<ion-icon name="image" class="file-icon"></ion-icon>
|
<ion-icon name="image" class="file-icon"></ion-icon>
|
||||||
<ion-label>{{"Imagem"}}</ion-label>
|
<ion-label>{{"Imagem"}}</ion-label>
|
||||||
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' && msg.downloadLoader == false && msg.uploadingFile == false && msg.downloadAttachmentsTemp == 0" class="icon-download" src="assets/icon/theme/{{ThemeService.currentTheme}}/icons-download.svg" slot="end"></ion-icon>
|
<ion-icon
|
||||||
<ion-icon *ngIf="msg.downloadLoader == true || msg.uploadingFile == true " class="icon-download" src="assets/gif/theme/{{ThemeService.currentTheme}}/Blocks-loader.svg" slot="end"></ion-icon>
|
*ngIf="ThemeService.currentTheme == 'gov' && msg.downloadLoader == false && msg.uploadingFile == false && msg.downloadAttachmentsTemp == 0"
|
||||||
<ion-icon *ngIf="msg.downloadAttachments == false && msg.downloadAttachmentsTemp >= 1 && msg.downloadLoader == false" src="assets/images/retry-svgrepo-com.svg" class="icon-download font-12"> </ion-icon>
|
class="icon-download" src="assets/icon/theme/{{ThemeService.currentTheme}}/icons-download.svg"
|
||||||
|
slot="end"></ion-icon>
|
||||||
|
<ion-icon *ngIf="msg.downloadLoader == true || msg.uploadingFile == true " class="icon-download"
|
||||||
|
src="assets/gif/theme/{{ThemeService.currentTheme}}/Blocks-loader.svg" slot="end"></ion-icon>
|
||||||
|
<ion-icon
|
||||||
|
*ngIf="msg.downloadAttachments == false && msg.downloadAttachmentsTemp >= 1 && msg.downloadLoader == false"
|
||||||
|
src="assets/images/retry-svgrepo-com.svg" class="icon-download font-12"> </ion-icon>
|
||||||
</ion-item>
|
</ion-item>
|
||||||
</div>
|
</div>
|
||||||
<img class="d-block width-100" *ngIf="msg.attachments[0].image_url" src="{{msg.attachments[0].image_url}}" alt="image" >
|
<img class="d-block width-100" *ngIf="msg.attachments[0].image_url"
|
||||||
|
src="{{msg.attachments[0].image_url}}" alt="image">
|
||||||
<ion-icon *ngIf="msg.attachments[0].image_url == null" name="download-outline"></ion-icon>
|
<ion-icon *ngIf="msg.attachments[0].image_url == null" name="download-outline"></ion-icon>
|
||||||
<ion-label class="float-status-all float-status" *ngIf="msg.u.username==sessionStore.user.UserName">
|
<ion-label class="float-status-all float-status" *ngIf="msg.u.username==sessionStore.user.UserName">
|
||||||
<span *ngIf="msg.online == true && !msg.manualRetry && msg.viewed == 0" class="enviado pl-10"> Enviado</span>
|
<span *ngIf="msg.online == true && !msg.manualRetry && msg.viewed == 0" class="enviado pl-10">
|
||||||
|
Enviado</span>
|
||||||
<!-- <ion-icon *ngIf="msg.messageSend == false && !msg.manualRetry" src="assets/images/clock-regular.svg"></ion-icon> -->
|
<!-- <ion-icon *ngIf="msg.messageSend == false && !msg.manualRetry" src="assets/images/clock-regular.svg"></ion-icon> -->
|
||||||
<!-- <ion-icon *ngIf="msg.messageSend == true && msg.received.length == 0 && msg.viewed.length == 0" src="assets/images/check-solid.svg"></ion-icon> -->
|
<!-- <ion-icon *ngIf="msg.messageSend == true && msg.received.length == 0 && msg.viewed.length == 0" src="assets/images/check-solid.svg"></ion-icon> -->
|
||||||
<!-- <ion-icon *ngIf="msg.messageSend && msg.received.length >= 1 && msg.viewed.length == 0" src="assets/images/check-double-solid.svg"></ion-icon> -->
|
<!-- <ion-icon *ngIf="msg.messageSend && msg.received.length >= 1 && msg.viewed.length == 0" src="assets/images/check-double-solid.svg"></ion-icon> -->
|
||||||
@@ -116,39 +137,64 @@
|
|||||||
<div *ngIf="!msg.attachments[0].image_url">
|
<div *ngIf="!msg.attachments[0].image_url">
|
||||||
<ion-item class="add-attachment-bg-color" shape="round" lines="none" type="button">
|
<ion-item class="add-attachment-bg-color" shape="round" lines="none" type="button">
|
||||||
|
|
||||||
<ion-icon *ngIf="msg.attachments[0].type != 'webtrix'" name="document" class="file-icon"></ion-icon>
|
<ion-icon *ngIf="msg.attachments[0].type != 'webtrix'" name="document"
|
||||||
<ion-icon *ngIf="msg.attachments[0].type == 'webtrix'" src="assets/icon/webtrix.svg" class="file-icon"></ion-icon>
|
class="file-icon"></ion-icon>
|
||||||
|
<ion-icon *ngIf="msg.attachments[0].type == 'webtrix'" src="assets/icon/webtrix.svg"
|
||||||
|
class="file-icon"></ion-icon>
|
||||||
<ion-label>{{ file.title}}</ion-label>
|
<ion-label>{{ file.title}}</ion-label>
|
||||||
<ion-icon *ngIf="ThemeService.currentTheme == 'default' && msg.attachments[0].type != 'webtrix' && !( msg.downloadLoader == true || msg.uploadingFile == true ) " class="icon-download" src="assets/icon/theme/default/icons-download.svg" slot="end"></ion-icon>
|
<ion-icon
|
||||||
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' && msg.attachments[0].type != 'webtrix' && !( msg.downloadLoader == true || msg.uploadingFile == true ) " class="icon-download" src="assets/icon/theme/gov/icons-download.svg" slot="end"></ion-icon>
|
*ngIf="ThemeService.currentTheme == 'default' && msg.attachments[0].type != 'webtrix' && !( msg.downloadLoader == true || msg.uploadingFile == true ) "
|
||||||
<ion-icon *ngIf="( msg.downloadLoader == true || msg.uploadingFile == true )" class="icon-download" src="assets/gif/theme/{{ThemeService.currentTheme}}/Blocks-loader.svg" slot="end"></ion-icon>
|
class="icon-download" src="assets/icon/theme/default/icons-download.svg"
|
||||||
|
slot="end"></ion-icon>
|
||||||
|
<ion-icon
|
||||||
|
*ngIf="ThemeService.currentTheme == 'gov' && msg.attachments[0].type != 'webtrix' && !( msg.downloadLoader == true || msg.uploadingFile == true ) "
|
||||||
|
class="icon-download" src="assets/icon/theme/gov/icons-download.svg" slot="end"></ion-icon>
|
||||||
|
<ion-icon *ngIf="( msg.downloadLoader == true || msg.uploadingFile == true )"
|
||||||
|
class="icon-download" src="assets/gif/theme/{{ThemeService.currentTheme}}/Blocks-loader.svg"
|
||||||
|
slot="end"></ion-icon>
|
||||||
|
|
||||||
|
|
||||||
</ion-item>
|
</ion-item>
|
||||||
</div>
|
</div>
|
||||||
<div *ngIf="msg.attachments[0].image_url">
|
<div *ngIf="msg.attachments[0].image_url">
|
||||||
<span *ngIf="msg.file.type">
|
<span *ngIf="msg.file.type">
|
||||||
<fa-icon *ngIf="msg.file.type == 'application/pdf'" icon="file-pdf" class="pdf-icon"></fa-icon>
|
<fa-icon *ngIf="msg.file.type == 'application/pdf'" icon="file-pdf"
|
||||||
<fa-icon *ngIf="msg.file.type == 'application/word'" icon="file-word" class="word-icon"></fa-icon>
|
class="pdf-icon"></fa-icon>
|
||||||
<fa-icon *ngIf="msg.file.type == 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'" icon="file-word" class="word-icon"></fa-icon>
|
<fa-icon *ngIf="msg.file.type == 'application/word'" icon="file-word"
|
||||||
<fa-icon *ngIf="msg.file.type == 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'" icon="file-word" class="excel-icon"></fa-icon>
|
class="word-icon"></fa-icon>
|
||||||
<ion-icon *ngIf="msg.file.type == 'application/webtrix'" src="assets/icon/webtrix.svg"></ion-icon>
|
<fa-icon
|
||||||
|
*ngIf="msg.file.type == 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'"
|
||||||
|
icon="file-word" class="word-icon"></fa-icon>
|
||||||
|
<fa-icon
|
||||||
|
*ngIf="msg.file.type == 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'"
|
||||||
|
icon="file-word" class="excel-icon"></fa-icon>
|
||||||
|
<ion-icon *ngIf="msg.file.type == 'application/webtrix'"
|
||||||
|
src="assets/icon/webtrix.svg"></ion-icon>
|
||||||
</span>
|
</span>
|
||||||
<ion-label class="file-title">{{file.title}}</ion-label>
|
<ion-label class="file-title">{{file.title}}</ion-label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div (click)="audioPreview(msg)" class="audio-contentainer" *ngIf="msg.file.type == 'application/audio' && !file.title_link">
|
<div (click)="audioPreview(msg)" class="audio-contentainer"
|
||||||
|
*ngIf="msg.file.type == 'application/audio' && !file.title_link">
|
||||||
<ion-item class="add-attachment-bg-color" shape="round" lines="none" type="button">
|
<ion-item class="add-attachment-bg-color" shape="round" lines="none" type="button">
|
||||||
<ion-icon name="mic-outline" class="file-icon"></ion-icon>
|
<ion-icon name="mic-outline" class="file-icon"></ion-icon>
|
||||||
<ion-label>{{"Mensagem de voz"}}</ion-label>
|
<ion-label>{{"Mensagem de voz"}}</ion-label>
|
||||||
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' && msg.downloadLoader == false && msg.uploadingFile == false && msg.downloadAttachmentsTemp == 0" class="icon-download" src="assets/icon/theme/{{ThemeService.currentTheme}}/icons-download.svg" slot="end"></ion-icon>
|
<ion-icon
|
||||||
<ion-icon *ngIf="( msg.downloadLoader == true || msg.uploadingFile == true )" class="icon-download" src="assets/gif/theme/{{ThemeService.currentTheme}}/Blocks-loader.svg" slot="end"></ion-icon>
|
*ngIf="ThemeService.currentTheme == 'gov' && msg.downloadLoader == false && msg.uploadingFile == false && msg.downloadAttachmentsTemp == 0"
|
||||||
<ion-icon *ngIf="msg.downloadAttachments == false && msg.downloadAttachmentsTemp >= 1 && msg.downloadLoader == false" src="assets/images/retry-svgrepo-com.svg" class="icon-download font-12"> </ion-icon>
|
class="icon-download" src="assets/icon/theme/{{ThemeService.currentTheme}}/icons-download.svg"
|
||||||
|
slot="end"></ion-icon>
|
||||||
|
<ion-icon *ngIf="( msg.downloadLoader == true || msg.uploadingFile == true )"
|
||||||
|
class="icon-download" src="assets/gif/theme/{{ThemeService.currentTheme}}/Blocks-loader.svg"
|
||||||
|
slot="end"></ion-icon>
|
||||||
|
<ion-icon
|
||||||
|
*ngIf="msg.downloadAttachments == false && msg.downloadAttachmentsTemp >= 1 && msg.downloadLoader == false"
|
||||||
|
src="assets/images/retry-svgrepo-com.svg" class="icon-download font-12"> </ion-icon>
|
||||||
</ion-item>
|
</ion-item>
|
||||||
</div>
|
</div>
|
||||||
<div class="audio-contentainer" *ngIf="msg.file.type == 'application/audio' && file.title_link">
|
<div class="audio-contentainer" *ngIf="msg.file.type == 'application/audio' && file.title_link">
|
||||||
<audio [src]="file.title_link|safehtml" preload="metadata" class="d-flex width-100" controls controlsList="nodownload noplaybackrate"></audio>
|
<audio [src]="file.title_link|safehtml" preload="metadata" class="d-flex width-100" controls
|
||||||
|
controlsList="nodownload noplaybackrate"></audio>
|
||||||
</div>
|
</div>
|
||||||
<div class="file-details-optional add-attachment-bg-color">
|
<div class="file-details-optional add-attachment-bg-color">
|
||||||
<ion-label *ngIf="msg.file && msg.file != ''">
|
<ion-label *ngIf="msg.file && msg.file != ''">
|
||||||
@@ -158,7 +204,8 @@
|
|||||||
</ion-label>
|
</ion-label>
|
||||||
<ion-label class="float-status-all float-status" *ngIf="msg.u.username==sessionStore.user.UserName">
|
<ion-label class="float-status-all float-status" *ngIf="msg.u.username==sessionStore.user.UserName">
|
||||||
|
|
||||||
<span *ngIf="msg.online == true && !msg.manualRetry && msg.viewed == 0" class="enviado pl-10"> Enviado</span>
|
<span *ngIf="msg.online == true && !msg.manualRetry && msg.viewed == 0" class="enviado pl-10">
|
||||||
|
Enviado</span>
|
||||||
<!-- <ion-icon *ngIf="msg.messageSend == false && !msg.manualRetry" src="assets/images/clock-regular.svg"></ion-icon> -->
|
<!-- <ion-icon *ngIf="msg.messageSend == false && !msg.manualRetry" src="assets/images/clock-regular.svg"></ion-icon> -->
|
||||||
<!-- <ion-icon *ngIf="msg.messageSend == true && msg.received.length == 0 && msg.viewed.length == 0" src="assets/images/check-solid.svg"></ion-icon> -->
|
<!-- <ion-icon *ngIf="msg.messageSend == true && msg.received.length == 0 && msg.viewed.length == 0" src="assets/images/check-solid.svg"></ion-icon> -->
|
||||||
<!-- <ion-icon *ngIf="msg.messageSend && msg.received.length >= 1 && msg.viewed.length == 0" src="assets/images/check-double-solid.svg"></ion-icon> -->
|
<!-- <ion-icon *ngIf="msg.messageSend && msg.received.length >= 1 && msg.viewed.length == 0" src="assets/images/check-double-solid.svg"></ion-icon> -->
|
||||||
@@ -175,9 +222,12 @@
|
|||||||
</div>
|
</div>
|
||||||
<div *ngIf="msg.file.type == 'application/meeting'" class="info-meeting">
|
<div *ngIf="msg.file.type == 'application/meeting'" class="info-meeting">
|
||||||
<ion-label class="info-meeting-small">{{msg.u.name ?? ""}} criou esta reunião</ion-label><br />
|
<ion-label class="info-meeting-small">{{msg.u.name ?? ""}} criou esta reunião</ion-label><br />
|
||||||
<button (click)="goToEvent(msg.file)" class="btn-no-color info-meeting-normal"><ion-label class="info-meeting-normal">{{msg.file.subject}}</ion-label></button><br />
|
<button (click)="goToEvent(msg.file)" class="btn-no-color info-meeting-normal"><ion-label
|
||||||
<ion-label class="info-meeting-medium"><ion-icon name="calendar-outline"></ion-icon> De {{showDateDuration(msg.file.start_date)}} a {{showDateDuration(msg.file.end_date)}}</ion-label><br />
|
class="info-meeting-normal">{{msg.file.subject}}</ion-label></button><br />
|
||||||
<ion-label class="info-meeting-medium"><ion-icon></ion-icon><ion-icon name="location-outline"></ion-icon> {{msg.file.venue}}</ion-label><br />
|
<ion-label class="info-meeting-medium"><ion-icon name="calendar-outline"></ion-icon> De
|
||||||
|
{{showDateDuration(msg.file.start_date)}} a {{showDateDuration(msg.file.end_date)}}</ion-label><br />
|
||||||
|
<ion-label class="info-meeting-medium"><ion-icon></ion-icon><ion-icon name="location-outline"></ion-icon>
|
||||||
|
{{msg.file.venue}}</ion-label><br />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -231,24 +281,24 @@
|
|||||||
<ion-footer>
|
<ion-footer>
|
||||||
|
|
||||||
<div class="typing" *ngIf="ChatSystemService.getGroupRoom(roomId).otherUserType == true">
|
<div class="typing" *ngIf="ChatSystemService.getGroupRoom(roomId).otherUserType == true">
|
||||||
<ngx-letters-avatar *ngIf="showAvatar"
|
<ngx-letters-avatar *ngIf="showAvatar" [avatarName]="ChatSystemService.getGroupRoom(roomId).name" [width]="30"
|
||||||
[avatarName]= "ChatSystemService.getGroupRoom(roomId).name"
|
[circular]="true" fontFamily="Roboto"></ngx-letters-avatar>
|
||||||
[width]="30"
|
|
||||||
[circular]="true"
|
|
||||||
fontFamily="Roboto"></ngx-letters-avatar>
|
|
||||||
{{ ChatSystemService.getGroupRoom(roomId).userThatIsTyping }} está a escrever...
|
{{ ChatSystemService.getGroupRoom(roomId).userThatIsTyping }} está a escrever...
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="width-100 pl-20 pr-20">
|
<div class="width-100 pl-20 pr-20">
|
||||||
<span *ngIf="!lastAudioRecorded">{{durationDisplay}}</span>
|
<span *ngIf="!lastAudioRecorded">{{durationDisplay}}</span>
|
||||||
<audio [src]="audioRecorded" class="d-flex width-100 mt-10 mb-10" *ngIf="lastAudioRecorded" controls controlsList="nodownload noplaybackrate"></audio>
|
<audio [src]="audioRecorded" class="d-flex width-100 mt-10 mb-10" *ngIf="lastAudioRecorded" controls
|
||||||
|
controlsList="nodownload noplaybackrate"></audio>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="container width-100 d-flex">
|
<div class="container width-100 d-flex">
|
||||||
<div>
|
<div>
|
||||||
<button *ngIf="!recording && !lastAudioRecorded && allowTyping" class="btn-no-color" (click)="openChatOptions()">
|
<button *ngIf="!recording && !lastAudioRecorded && allowTyping" class="btn-no-color" (click)="openChatOptions()">
|
||||||
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " class="chat-icon-options" src="assets/images/icons-add.svg"></ion-icon>
|
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " class="chat-icon-options"
|
||||||
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' " class="chat-icon-options" src="assets/images/theme/gov/icons-add.svg"></ion-icon>
|
src="assets/images/icons-add.svg"></ion-icon>
|
||||||
|
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' " class="chat-icon-options"
|
||||||
|
src="assets/images/theme/gov/icons-add.svg"></ion-icon>
|
||||||
</button>
|
</button>
|
||||||
<button *ngIf="recording || lastAudioRecorded || !allowTyping" class="btn-no-color" (click)="deleteRecording()">
|
<button *ngIf="recording || lastAudioRecorded || !allowTyping" class="btn-no-color" (click)="deleteRecording()">
|
||||||
<fa-icon class="icon-size-27" icon="trash"></fa-icon>
|
<fa-icon class="icon-size-27" icon="trash"></fa-icon>
|
||||||
@@ -256,7 +306,10 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="message-box width-80">
|
<div class="message-box width-80">
|
||||||
<div *ngIf="!recording && !lastAudioRecorded" class="type-message">
|
<div *ngIf="!recording && !lastAudioRecorded" class="type-message">
|
||||||
<ion-textarea *ngIf="allowTyping" autocomplete="on" autocorrect="on" spellcheck="true" clearOnEdit="true" placeholder="Escrever uma mensagem" auto-grow class="message-input" rows="1" [(ngModel)]="ChatSystemService.getGroupRoom(roomId).message" (ionChange)="ChatSystemService.getGroupRoom(roomId).sendTyping()"></ion-textarea>
|
<ion-textarea *ngIf="allowTyping" autocomplete="on" autocorrect="on" spellcheck="true" clearOnEdit="true"
|
||||||
|
placeholder="Escrever uma mensagem" auto-grow class="message-input" rows="1"
|
||||||
|
[(ngModel)]="ChatSystemService.getGroupRoom(roomId).message"
|
||||||
|
(ionChange)="ChatSystemService.getGroupRoom(roomId).sendTyping()"></ion-textarea>
|
||||||
</div>
|
</div>
|
||||||
<div *ngIf="recording" class="d-flex align-items-center justify-content-center">
|
<div *ngIf="recording" class="d-flex align-items-center justify-content-center">
|
||||||
<button (click)="stopRecording()" class="btn-no-color d-flex align-items-center justify-content-center">
|
<button (click)="stopRecording()" class="btn-no-color d-flex align-items-center justify-content-center">
|
||||||
@@ -265,17 +318,25 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<button #recordbtn *ngIf="!ChatSystemService.getGroupRoom(roomId).message && !lastAudioRecorded" (click)="startRecording()" class="btn-no-color">
|
<button #recordbtn *ngIf="!ChatSystemService.getGroupRoom(roomId).message && !lastAudioRecorded"
|
||||||
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " class="chat-icon-send" src="assets/icon/theme/default/icons-chat-record-audio.svg"></ion-icon>
|
(click)="startRecording()" class="btn-no-color">
|
||||||
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' " class="chat-icon-send" src="assets/icon/theme/gov/icons-chat-record-audio.svg"></ion-icon>
|
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " class="chat-icon-send"
|
||||||
|
src="assets/icon/theme/default/icons-chat-record-audio.svg"></ion-icon>
|
||||||
|
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' " class="chat-icon-send"
|
||||||
|
src="assets/icon/theme/gov/icons-chat-record-audio.svg"></ion-icon>
|
||||||
</button>
|
</button>
|
||||||
<button *ngIf="ChatSystemService.getGroupRoom(roomId).message" class="btn-no-color" (click)="sendMessage()">
|
<button *ngIf="ChatSystemService.getGroupRoom(roomId).message" class="btn-no-color" (click)="sendMessage()">
|
||||||
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " class="chat-icon-send" src="assets/icon/icons-chat-send.svg"></ion-icon>
|
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " class="chat-icon-send"
|
||||||
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' " class="chat-icon-send" src="assets/icon/theme/gov/icons-chat-send.svg"></ion-icon>
|
src="assets/icon/icons-chat-send.svg"></ion-icon>
|
||||||
|
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' " class="chat-icon-send"
|
||||||
|
src="assets/icon/theme/gov/icons-chat-send.svg"></ion-icon>
|
||||||
</button>
|
</button>
|
||||||
<button *ngIf="!ChatSystemService.getGroupRoom(roomId).message && lastAudioRecorded" class="btn-no-color" (click)="sendAudio(lastAudioRecorded)">
|
<button *ngIf="!ChatSystemService.getGroupRoom(roomId).message && lastAudioRecorded" class="btn-no-color"
|
||||||
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " class="chat-icon-send" src="assets/icon/theme/gov/icons-chat-send.svg"></ion-icon>
|
(click)="sendAudio(lastAudioRecorded)">
|
||||||
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' " class="chat-icon-send" src="assets/icon/theme/gov/icons-chat-send.svg"></ion-icon>
|
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " class="chat-icon-send"
|
||||||
|
src="assets/icon/theme/gov/icons-chat-send.svg"></ion-icon>
|
||||||
|
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' " class="chat-icon-send"
|
||||||
|
src="assets/icon/theme/gov/icons-chat-send.svg"></ion-icon>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ import { FileOpener } from '@awesome-cordova-plugins/file-opener/ngx';
|
|||||||
import { SessionStore } from 'src/app/store/session.service';
|
import { SessionStore } from 'src/app/store/session.service';
|
||||||
import { ViewMediaPage } from 'src/app/modals/view-media/view-media.page';
|
import { ViewMediaPage } from 'src/app/modals/view-media/view-media.page';
|
||||||
import { Camera, CameraResultType, CameraSource } from '@capacitor/camera';
|
import { Camera, CameraResultType, CameraSource } from '@capacitor/camera';
|
||||||
|
import { RouteService } from 'src/app/services/route.service';
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-group-messages',
|
selector: 'app-group-messages',
|
||||||
templateUrl: './group-messages.page.html',
|
templateUrl: './group-messages.page.html',
|
||||||
@@ -102,6 +103,7 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
|||||||
private sanitiser: DomSanitizer,
|
private sanitiser: DomSanitizer,
|
||||||
private file: File,
|
private file: File,
|
||||||
private fileOpener: FileOpener,
|
private fileOpener: FileOpener,
|
||||||
|
public RouteService: RouteService,
|
||||||
) {
|
) {
|
||||||
this.ChatSystemService.getUser()
|
this.ChatSystemService.getUser()
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<ion-header class="ion-no-border">
|
<ion-header class="ion-no-border" *ngIf="ChatSystemService.getDmRoom(roomId)">
|
||||||
<ion-toolbar class="header-toolbar">
|
<ion-toolbar class="header-toolbar">
|
||||||
<div class="main-header">
|
<div class="main-header">
|
||||||
<div class="header-top">
|
<div class="header-top">
|
||||||
@@ -11,7 +11,8 @@
|
|||||||
<div class="middle-container" *ngIf="!showMessageOptions">
|
<div class="middle-container" *ngIf="!showMessageOptions">
|
||||||
<div class="middle">
|
<div class="middle">
|
||||||
<ion-label class="title">{{ChatSystemService.getDmRoom(roomId).name}}</ion-label>
|
<ion-label class="title">{{ChatSystemService.getDmRoom(roomId).name}}</ion-label>
|
||||||
<span><ion-icon *ngIf="RochetChatConnectorService.isLogin" class="{{ ChatSystemService.getDmRoom(this.roomId).online }}" name="ellipse"></ion-icon></span>
|
<span><ion-icon *ngIf="RochetChatConnectorService.isLogin"
|
||||||
|
class="{{ ChatSystemService.getDmRoom(this.roomId).online }}" name="ellipse"></ion-icon></span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -41,16 +42,16 @@
|
|||||||
</ion-toolbar>
|
</ion-toolbar>
|
||||||
</ion-header>
|
</ion-header>
|
||||||
|
|
||||||
<ion-content>
|
<ion-content *ngIf="ChatSystemService.getDmRoom(roomId)">
|
||||||
<div (click)="handleClick()" class="message-attachments messages" #scrollMe>
|
<div (click)="handleClick()" class="message-attachments messages" #scrollMe>
|
||||||
|
|
||||||
<div class="messages-list-item-wrapper container-width-100 file"
|
<div class="messages-list-item-wrapper container-width-100 file" (dragover)="onDragOver($event)"
|
||||||
(dragover)="onDragOver($event)"
|
|
||||||
(dragleave)="onDragLeave($event)"
|
(dragleave)="onDragLeave($event)"
|
||||||
*ngFor="let msg of ChatSystemService.getDmRoom(this.roomId).messages; let last = last"
|
*ngFor="let msg of ChatSystemService.getDmRoom(this.roomId).messages; let last = last"
|
||||||
[class.messages-list-item-wrapper-active]="msg._id == selectedMsgId">
|
[class.messages-list-item-wrapper-active]="msg._id == selectedMsgId">
|
||||||
<div (press)="handlePress(msg._id)" class='file message-container incoming-{{msg.u.username!=sessionStore.user.UserName}}'
|
<div (press)="handlePress(msg._id)"
|
||||||
*ngIf="msg.msg !=''" [class.dateLabel]="msg.dateLabel">
|
class='file message-container incoming-{{msg.u.username!=sessionStore.user.UserName}}' *ngIf="msg.msg !=''"
|
||||||
|
[class.dateLabel]="msg.dateLabel">
|
||||||
<div class="title file" *ngIf="!msg.dateLabel">
|
<div class="title file" *ngIf="!msg.dateLabel">
|
||||||
<ion-label>{{msg.u.name}}</ion-label>
|
<ion-label>{{msg.u.name}}</ion-label>
|
||||||
<span class="time">{{msg.time}}</span>
|
<span class="time">{{msg.time}}</span>
|
||||||
@@ -58,13 +59,15 @@
|
|||||||
<div>
|
<div>
|
||||||
<div class="file">
|
<div class="file">
|
||||||
|
|
||||||
<pre *ngIf="msg.delate == false" class="message-box text ma-0 font-13-rem" style="font-size: 0.8125rem !important;" >{{msg.msg}}</pre>
|
<pre *ngIf="msg.delate == false" class="message-box text ma-0 font-13-rem"
|
||||||
|
style="font-size: 0.8125rem !important;">{{msg.msg}}</pre>
|
||||||
<!-- <ion-label *ngIf="msg.delate == false" class="message-box">{{msg.msg}} </ion-label> -->
|
<!-- <ion-label *ngIf="msg.delate == false" class="message-box">{{msg.msg}} </ion-label> -->
|
||||||
<ion-label *ngIf="msg.delate == true" class="flex-0">Apagou a mensagem</ion-label>
|
<ion-label *ngIf="msg.delate == true" class="flex-0">Apagou a mensagem</ion-label>
|
||||||
|
|
||||||
<ion-label class="float-status-all float-status" *ngIf="msg.u.username==sessionStore.user.UserName">
|
<ion-label class="float-status-all float-status" *ngIf="msg.u.username==sessionStore.user.UserName">
|
||||||
|
|
||||||
<span *ngIf="msg.online == true && !msg.manualRetry && msg.viewed == 0" class="enviado pl-10"> Enviado</span>
|
<span *ngIf="msg.online == true && !msg.manualRetry && msg.viewed == 0" class="enviado pl-10">
|
||||||
|
Enviado</span>
|
||||||
<!-- <ion-icon *ngIf="msg.messageSend == false && !msg.manualRetry" src="assets/images/clock-regular.svg"></ion-icon> -->
|
<!-- <ion-icon *ngIf="msg.messageSend == false && !msg.manualRetry" src="assets/images/clock-regular.svg"></ion-icon> -->
|
||||||
<!-- <ion-icon *ngIf="msg.messageSend == true && msg.received.length == 0 && msg.viewed.length == 0" src="assets/images/check-solid.svg"></ion-icon> -->
|
<!-- <ion-icon *ngIf="msg.messageSend == true && msg.received.length == 0 && msg.viewed.length == 0" src="assets/images/check-solid.svg"></ion-icon> -->
|
||||||
<!-- <ion-icon *ngIf="msg.messageSend && msg.received.length >= 1 && msg.viewed.length == 0" src="assets/images/check-double-solid.svg"></ion-icon> -->
|
<!-- <ion-icon *ngIf="msg.messageSend && msg.received.length >= 1 && msg.viewed.length == 0" src="assets/images/check-double-solid.svg"></ion-icon> -->
|
||||||
@@ -79,7 +82,9 @@
|
|||||||
|
|
||||||
|
|
||||||
<div *ngIf="msg.file && msg.delate == false">
|
<div *ngIf="msg.file && msg.delate == false">
|
||||||
<div (press)="handlePress(msg._id)" class='message-container incoming-{{msg.u.username!=sessionStore.user.UserName}}' *ngIf="msg.file.type != 'application/meeting'">
|
<div (press)="handlePress(msg._id)"
|
||||||
|
class='message-container incoming-{{msg.u.username!=sessionStore.user.UserName}}'
|
||||||
|
*ngIf="msg.file.type != 'application/meeting'">
|
||||||
<div class="title">
|
<div class="title">
|
||||||
<ion-label>{{msg.u.name}}</ion-label>
|
<ion-label>{{msg.u.name}}</ion-label>
|
||||||
<span class="time">{{msg.time}}</span>
|
<span class="time">{{msg.time}}</span>
|
||||||
@@ -92,15 +97,24 @@
|
|||||||
<ion-item class="add-attachment-bg-color" shape="round" lines="none" type="button">
|
<ion-item class="add-attachment-bg-color" shape="round" lines="none" type="button">
|
||||||
<ion-icon name="image" class="file-icon"></ion-icon>
|
<ion-icon name="image" class="file-icon"></ion-icon>
|
||||||
<ion-label>{{"Imagem"}}</ion-label>
|
<ion-label>{{"Imagem"}}</ion-label>
|
||||||
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' && msg.downloadLoader == false && msg.uploadingFile == false && msg.downloadAttachmentsTemp == 0" class="icon-download" src="assets/icon/theme/{{ThemeService.currentTheme}}/icons-download.svg" slot="end"></ion-icon>
|
<ion-icon
|
||||||
<ion-icon *ngIf="( msg.downloadLoader == true || msg.uploadingFile == true )" class="icon-download" src="assets/gif/theme/{{ThemeService.currentTheme}}/Blocks-loader.svg" slot="end"></ion-icon>
|
*ngIf="ThemeService.currentTheme == 'gov' && msg.downloadLoader == false && msg.uploadingFile == false && msg.downloadAttachmentsTemp == 0"
|
||||||
<ion-icon *ngIf="msg.downloadAttachments == false && msg.downloadAttachmentsTemp >= 1 && msg.downloadLoader == false" src="assets/images/retry-svgrepo-com.svg" class="icon-download font-12"> </ion-icon>
|
class="icon-download" src="assets/icon/theme/{{ThemeService.currentTheme}}/icons-download.svg"
|
||||||
|
slot="end"></ion-icon>
|
||||||
|
<ion-icon *ngIf="( msg.downloadLoader == true || msg.uploadingFile == true )"
|
||||||
|
class="icon-download" src="assets/gif/theme/{{ThemeService.currentTheme}}/Blocks-loader.svg"
|
||||||
|
slot="end"></ion-icon>
|
||||||
|
<ion-icon
|
||||||
|
*ngIf="msg.downloadAttachments == false && msg.downloadAttachmentsTemp >= 1 && msg.downloadLoader == false"
|
||||||
|
src="assets/images/retry-svgrepo-com.svg" class="icon-download font-12"> </ion-icon>
|
||||||
</ion-item>
|
</ion-item>
|
||||||
</div>
|
</div>
|
||||||
<img class="d-block width-100" *ngIf="msg.attachments[0].image_url" src="{{msg.attachments[0].image_url}}" alt="image">
|
<img class="d-block width-100" *ngIf="msg.attachments[0].image_url"
|
||||||
|
src="{{msg.attachments[0].image_url}}" alt="image">
|
||||||
|
|
||||||
<ion-label class="float-status-all float-status" *ngIf="msg.u.username==sessionStore.user.UserName">
|
<ion-label class="float-status-all float-status" *ngIf="msg.u.username==sessionStore.user.UserName">
|
||||||
<span *ngIf="msg.online == true && !msg.manualRetry && msg.viewed == 0" class="enviado pl-10"> Enviado</span>
|
<span *ngIf="msg.online == true && !msg.manualRetry && msg.viewed == 0" class="enviado pl-10">
|
||||||
|
Enviado</span>
|
||||||
<!-- <ion-icon *ngIf="msg.messageSend == false && !msg.manualRetry" src="assets/images/clock-regular.svg"></ion-icon> -->
|
<!-- <ion-icon *ngIf="msg.messageSend == false && !msg.manualRetry" src="assets/images/clock-regular.svg"></ion-icon> -->
|
||||||
<!-- <ion-icon *ngIf="msg.messageSend == true && msg.received.length == 0 && msg.viewed.length == 0" src="assets/images/check-solid.svg"></ion-icon> -->
|
<!-- <ion-icon *ngIf="msg.messageSend == true && msg.received.length == 0 && msg.viewed.length == 0" src="assets/images/check-solid.svg"></ion-icon> -->
|
||||||
<!-- <ion-icon *ngIf="msg.messageSend && msg.received.length >= 1 && msg.viewed.length == 0" src="assets/images/check-double-solid.svg"></ion-icon> -->
|
<!-- <ion-icon *ngIf="msg.messageSend && msg.received.length >= 1 && msg.viewed.length == 0" src="assets/images/check-double-solid.svg"></ion-icon> -->
|
||||||
@@ -112,25 +126,38 @@
|
|||||||
</div>
|
</div>
|
||||||
<div *ngIf="msg.file.type != 'application/img'">
|
<div *ngIf="msg.file.type != 'application/img'">
|
||||||
<div class="file add-attachment-bg-color" *ngIf="msg.file.type != 'application/audio'">
|
<div class="file add-attachment-bg-color" *ngIf="msg.file.type != 'application/audio'">
|
||||||
<div (click)="docIndex(i); openPreview(msg)" class="file-details add-ellipsis cursor-pointer" *ngIf="msg.file">
|
<div (click)="docIndex(i); openPreview(msg)" class="file-details add-ellipsis cursor-pointer"
|
||||||
|
*ngIf="msg.file">
|
||||||
|
|
||||||
<div *ngIf="!msg.attachments[0].image_url">
|
<div *ngIf="!msg.attachments[0].image_url">
|
||||||
<ion-item class="add-attachment-bg-color" shape="round" lines="none" type="button">
|
<ion-item class="add-attachment-bg-color" shape="round" lines="none" type="button">
|
||||||
|
|
||||||
<ion-icon *ngIf="msg.attachments[0].type != 'webtrix'" name="document" class="file-icon"></ion-icon>
|
<ion-icon *ngIf="msg.attachments[0].type != 'webtrix'" name="document"
|
||||||
<ion-icon *ngIf="msg.attachments[0].type == 'webtrix'" src="assets/icon/webtrix.svg" class="file-icon"></ion-icon>
|
class="file-icon"></ion-icon>
|
||||||
|
<ion-icon *ngIf="msg.attachments[0].type == 'webtrix'" src="assets/icon/webtrix.svg"
|
||||||
|
class="file-icon"></ion-icon>
|
||||||
<ion-label>{{ file.title}}</ion-label>
|
<ion-label>{{ file.title}}</ion-label>
|
||||||
<ion-icon *ngIf="ThemeService.currentTheme == 'default' && msg.attachments[0].type != 'webtrix' && !( msg.downloadLoader == true || msg.uploadingFile == true ) " class="icon-download" src="assets/icon/theme/default/icons-download.svg" slot="end"></ion-icon>
|
<ion-icon
|
||||||
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' && msg.attachments[0].type != 'webtrix' && !( msg.downloadLoader == true || msg.uploadingFile == true ) " class="icon-download" src="assets/icon/theme/gov/icons-download.svg" slot="end"></ion-icon>
|
*ngIf="ThemeService.currentTheme == 'default' && msg.attachments[0].type != 'webtrix' && !( msg.downloadLoader == true || msg.uploadingFile == true ) "
|
||||||
<ion-icon *ngIf="( msg.downloadLoader == true || msg.uploadingFile == true )" class="icon-download" src="assets/gif/theme/{{ThemeService.currentTheme}}/Blocks-loader.svg" slot="end"></ion-icon>
|
class="icon-download" src="assets/icon/theme/default/icons-download.svg"
|
||||||
|
slot="end"></ion-icon>
|
||||||
|
<ion-icon
|
||||||
|
*ngIf="ThemeService.currentTheme == 'gov' && msg.attachments[0].type != 'webtrix' && !( msg.downloadLoader == true || msg.uploadingFile == true ) "
|
||||||
|
class="icon-download" src="assets/icon/theme/gov/icons-download.svg" slot="end"></ion-icon>
|
||||||
|
<ion-icon *ngIf="( msg.downloadLoader == true || msg.uploadingFile == true )"
|
||||||
|
class="icon-download" src="assets/gif/theme/{{ThemeService.currentTheme}}/Blocks-loader.svg"
|
||||||
|
slot="end"></ion-icon>
|
||||||
|
|
||||||
</ion-item>
|
</ion-item>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div *ngIf="msg.attachments[0].image_url">
|
<div *ngIf="msg.attachments[0].image_url">
|
||||||
<span *ngIf="msg.file.type">
|
<span *ngIf="msg.file.type">
|
||||||
<fa-icon *ngIf="msg.file.type == 'application/pdf'" icon="file-pdf" class="pdf-icon"></fa-icon>
|
<fa-icon *ngIf="msg.file.type == 'application/pdf'" icon="file-pdf"
|
||||||
<fa-icon *ngIf="msg.file.type == 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'" icon="file-word" class="word-icon"></fa-icon>
|
class="pdf-icon"></fa-icon>
|
||||||
|
<fa-icon
|
||||||
|
*ngIf="msg.file.type == 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'"
|
||||||
|
icon="file-word" class="word-icon"></fa-icon>
|
||||||
<fa-icon *ngIf="msg.file.type == 'application/word'" icon="file-word" class="word-icon">
|
<fa-icon *ngIf="msg.file.type == 'application/word'" icon="file-word" class="word-icon">
|
||||||
</fa-icon>
|
</fa-icon>
|
||||||
<fa-icon
|
<fa-icon
|
||||||
@@ -144,13 +171,21 @@
|
|||||||
<!-- <ion-progress-bar [type]="'indeterminate'" *ngIf="downloadLoader"></ion-progress-bar> -->
|
<!-- <ion-progress-bar [type]="'indeterminate'" *ngIf="downloadLoader"></ion-progress-bar> -->
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div (click)="audioPreview(msg)" class="audio-contentainer" *ngIf="msg.file.type == 'application/audio' && !file.title_link">
|
<div (click)="audioPreview(msg)" class="audio-contentainer"
|
||||||
|
*ngIf="msg.file.type == 'application/audio' && !file.title_link">
|
||||||
<ion-item class="add-attachment-bg-color" shape="round" lines="none" type="button">
|
<ion-item class="add-attachment-bg-color" shape="round" lines="none" type="button">
|
||||||
<ion-icon name="mic-outline" class="file-icon"></ion-icon>
|
<ion-icon name="mic-outline" class="file-icon"></ion-icon>
|
||||||
<ion-label>{{"Mensagem de voz"}}</ion-label>
|
<ion-label>{{"Mensagem de voz"}}</ion-label>
|
||||||
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' && msg.downloadLoader == false && msg.uploadingFile == false && msg.downloadAttachmentsTemp == 0" class="icon-download" src="assets/icon/theme/{{ThemeService.currentTheme}}/icons-download.svg" slot="end"></ion-icon>
|
<ion-icon
|
||||||
<ion-icon *ngIf="( msg.downloadLoader == true || msg.uploadingFile == true )" class="icon-download" src="assets/gif/theme/{{ThemeService.currentTheme}}/Blocks-loader.svg" slot="end"></ion-icon>
|
*ngIf="ThemeService.currentTheme == 'gov' && msg.downloadLoader == false && msg.uploadingFile == false && msg.downloadAttachmentsTemp == 0"
|
||||||
<ion-icon *ngIf="msg.downloadAttachments == false && msg.downloadAttachmentsTemp >= 1 && msg.downloadLoader == false" src="assets/images/retry-svgrepo-com.svg" class="icon-download font-12"> </ion-icon>
|
class="icon-download" src="assets/icon/theme/{{ThemeService.currentTheme}}/icons-download.svg"
|
||||||
|
slot="end"></ion-icon>
|
||||||
|
<ion-icon *ngIf="( msg.downloadLoader == true || msg.uploadingFile == true )"
|
||||||
|
class="icon-download" src="assets/gif/theme/{{ThemeService.currentTheme}}/Blocks-loader.svg"
|
||||||
|
slot="end"></ion-icon>
|
||||||
|
<ion-icon
|
||||||
|
*ngIf="msg.downloadAttachments == false && msg.downloadAttachmentsTemp >= 1 && msg.downloadLoader == false"
|
||||||
|
src="assets/images/retry-svgrepo-com.svg" class="icon-download font-12"> </ion-icon>
|
||||||
</ion-item>
|
</ion-item>
|
||||||
</div>
|
</div>
|
||||||
<div class="file audio-contentainer" *ngIf="msg.file.type == 'application/audio' && file.title_link">
|
<div class="file audio-contentainer" *ngIf="msg.file.type == 'application/audio' && file.title_link">
|
||||||
@@ -166,7 +201,8 @@
|
|||||||
|
|
||||||
<ion-label class="float-status-all float-status" *ngIf="msg.u.username==sessionStore.user.UserName">
|
<ion-label class="float-status-all float-status" *ngIf="msg.u.username==sessionStore.user.UserName">
|
||||||
|
|
||||||
<span *ngIf="msg.online == true && !msg.manualRetry && msg.viewed == 0" class="enviado pl-10"> Enviado</span>
|
<span *ngIf="msg.online == true && !msg.manualRetry && msg.viewed == 0" class="enviado pl-10">
|
||||||
|
Enviado</span>
|
||||||
<!-- <ion-icon *ngIf="msg.messageSend == false && !msg.manualRetry" src="assets/images/clock-regular.svg"></ion-icon> -->
|
<!-- <ion-icon *ngIf="msg.messageSend == false && !msg.manualRetry" src="assets/images/clock-regular.svg"></ion-icon> -->
|
||||||
<!-- <ion-icon *ngIf="msg.messageSend == true && msg.received.length == 0 && msg.viewed.length == 0" src="assets/images/check-solid.svg"></ion-icon> -->
|
<!-- <ion-icon *ngIf="msg.messageSend == true && msg.received.length == 0 && msg.viewed.length == 0" src="assets/images/check-solid.svg"></ion-icon> -->
|
||||||
<!-- <ion-icon *ngIf="msg.messageSend && msg.received.length >= 1 && msg.viewed.length == 0" src="assets/images/check-double-solid.svg"></ion-icon> -->
|
<!-- <ion-icon *ngIf="msg.messageSend && msg.received.length >= 1 && msg.viewed.length == 0" src="assets/images/check-double-solid.svg"></ion-icon> -->
|
||||||
@@ -213,7 +249,7 @@
|
|||||||
|
|
||||||
</ion-content>
|
</ion-content>
|
||||||
|
|
||||||
<ion-footer (click)="ChatSystemService.getDmRoom(roomId).sendReadMessage()">
|
<ion-footer *ngIf="ChatSystemService.getDmRoom(roomId)" (click)="ChatSystemService.getDmRoom(roomId).sendReadMessage()">
|
||||||
|
|
||||||
<div class="typing" *ngIf="ChatSystemService.getDmRoom(roomId).otherUserType == true">
|
<div class="typing" *ngIf="ChatSystemService.getDmRoom(roomId).otherUserType == true">
|
||||||
<ngx-letters-avatar [avatarName]="ChatSystemService.getGroupRoom(roomId).name" [width]="30" [circular]="true"
|
<ngx-letters-avatar [avatarName]="ChatSystemService.getGroupRoom(roomId).name" [width]="30" [circular]="true"
|
||||||
|
|||||||
@@ -118,6 +118,9 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
|||||||
private router: Router,
|
private router: Router,
|
||||||
public RochetChatConnectorService: RochetChatConnectorService,
|
public RochetChatConnectorService: RochetChatConnectorService,
|
||||||
) {
|
) {
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
this.loggedUser = SessionStore.user.ChatData['data'];
|
this.loggedUser = SessionStore.user.ChatData['data'];
|
||||||
this.roomId = this.navParams.get('roomId');
|
this.roomId = this.navParams.get('roomId');
|
||||||
|
|
||||||
@@ -136,11 +139,15 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
|||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.scrollToBottomClicked()
|
this.scrollToBottomClicked()
|
||||||
}, 150)
|
}, 150)
|
||||||
|
} catch (error) {
|
||||||
|
//alert(error)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
|
try {
|
||||||
console.log(this.router.url);
|
console.log(this.router.url);
|
||||||
this.createDirectoryImage()
|
this.createDirectoryImage()
|
||||||
// this.chatService.refreshtoken();
|
// this.chatService.refreshtoken();
|
||||||
@@ -151,6 +158,10 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
|||||||
})
|
})
|
||||||
|
|
||||||
this.getChatMembers();
|
this.getChatMembers();
|
||||||
|
} catch (error) {
|
||||||
|
//alert(error)
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -114,8 +114,11 @@ export class ChatSystemService {
|
|||||||
document.addEventListener('resume', () => {
|
document.addEventListener('resume', () => {
|
||||||
this.RochetChatConnectorService.setStatus('online')
|
this.RochetChatConnectorService.setStatus('online')
|
||||||
if (this._dm?.length == 0 && this._group?.length == 0) {
|
if (this._dm?.length == 0 && this._group?.length == 0) {
|
||||||
|
if (SessionStore.user?.ChatData?.data) {
|
||||||
this.getAllRooms();
|
this.getAllRooms();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!this.platform.is('desktop')) {
|
if (!this.platform.is('desktop')) {
|
||||||
@@ -124,11 +127,15 @@ export class ChatSystemService {
|
|||||||
// The app is in the foreground.
|
// The app is in the foreground.
|
||||||
console.log('App is in the foreground');
|
console.log('App is in the foreground');
|
||||||
|
|
||||||
|
if (SessionStore.user?.ChatData?.data) {
|
||||||
this.currentRoom?.loadHistory({ forceUpdate: true })
|
this.currentRoom?.loadHistory({ forceUpdate: true })
|
||||||
|
}
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
|
if (SessionStore.user?.ChatData?.data) {
|
||||||
this.subscribeToRoom()
|
this.subscribeToRoom()
|
||||||
this.RochetChatConnectorService.setStatus('online')
|
this.RochetChatConnectorService.setStatus('online')
|
||||||
|
}
|
||||||
}, 1000);
|
}, 1000);
|
||||||
|
|
||||||
/* this.reloadComponent(true) */
|
/* this.reloadComponent(true) */
|
||||||
@@ -150,6 +157,7 @@ export class ChatSystemService {
|
|||||||
|
|
||||||
private async ReLoadChat() {
|
private async ReLoadChat() {
|
||||||
|
|
||||||
|
if (SessionStore.user?.ChatData?.data) {
|
||||||
this.getUserStatus();
|
this.getUserStatus();
|
||||||
await this.chatService.refreshtoken();
|
await this.chatService.refreshtoken();
|
||||||
|
|
||||||
@@ -158,7 +166,7 @@ export class ChatSystemService {
|
|||||||
await this.restoreRooms();
|
await this.restoreRooms();
|
||||||
await this.getAllRooms();
|
await this.getAllRooms();
|
||||||
this.subscribeToRoom();
|
this.subscribeToRoom();
|
||||||
|
}
|
||||||
//
|
//
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -263,90 +271,23 @@ export class ChatSystemService {
|
|||||||
|
|
||||||
for (let roomData of this.sortArrayISODate(_rooms)) {
|
for (let roomData of this.sortArrayISODate(_rooms)) {
|
||||||
|
|
||||||
|
|
||||||
const roomId = this.getRoomId(roomData);
|
const roomId = this.getRoomId(roomData);
|
||||||
|
|
||||||
if (roomData.t == 'd') {
|
if (roomData.t == 'd') {
|
||||||
|
|
||||||
let error = false
|
|
||||||
let res;
|
|
||||||
|
|
||||||
try {
|
|
||||||
res = await this.chatService.getMembers(roomId).toPromise();
|
|
||||||
} catch (e) {
|
|
||||||
await this.chatService.refreshtoken();
|
|
||||||
error = true
|
|
||||||
}
|
|
||||||
|
|
||||||
if (error) {
|
|
||||||
res = await this.chatService.getMembers(roomId).toPromise();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
const members = res['members'];
|
|
||||||
const users = members.filter(data => data.username != this.sessionStore.user.UserName);
|
|
||||||
_rooms[index]['members'] = members
|
|
||||||
_rooms[index]['membersExcludeMe'] = users
|
|
||||||
|
|
||||||
await this.prepareRoom(roomData);
|
await this.prepareRoom(roomData);
|
||||||
} else {
|
} else {
|
||||||
if (roomData.t === 'p') {
|
if (roomData.t === 'p') {
|
||||||
let error = false
|
|
||||||
let res;
|
|
||||||
|
|
||||||
try {
|
|
||||||
res = await this.chatService.getGroupMembers(roomId).toPromise()
|
|
||||||
} catch (e) {
|
|
||||||
await this.chatService.refreshtoken();
|
|
||||||
error = true
|
|
||||||
}
|
|
||||||
|
|
||||||
if (error) {
|
|
||||||
res = await this.chatService.getGroupMembers(roomId).toPromise()
|
|
||||||
}
|
|
||||||
|
|
||||||
const members = res['members'];
|
|
||||||
const users = members.filter(data => data.username != this.sessionStore.user.UserName);
|
|
||||||
|
|
||||||
_rooms[index]['members'] = members
|
|
||||||
_rooms[index]['membersExcludeMe'] = users
|
|
||||||
|
|
||||||
await this.prepareRoom(roomData);
|
await this.prepareRoom(roomData);
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
let error = false
|
|
||||||
let res;
|
|
||||||
|
|
||||||
try {
|
|
||||||
res = await this.chatService.getChannelMembers(roomId).toPromise()
|
|
||||||
|
|
||||||
} catch (e) {
|
|
||||||
await this.chatService.refreshtoken();
|
|
||||||
error = true
|
|
||||||
}
|
|
||||||
|
|
||||||
if (error) {
|
|
||||||
res = await this.chatService.getChannelMembers(roomId).toPromise()
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
const members = res['members'];
|
|
||||||
const users = members.filter(data => data.username != this.sessionStore.user.UserName);
|
|
||||||
|
|
||||||
_rooms[index]['members'] = members
|
|
||||||
_rooms[index]['membersExcludeMe'] = users
|
|
||||||
await this.prepareRoom(roomData);
|
await this.prepareRoom(roomData);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (roomId == roomIdCallback) {
|
if (roomId == roomIdCallback) {
|
||||||
callback()
|
callback()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
index++;
|
index++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -362,7 +303,6 @@ export class ChatSystemService {
|
|||||||
async getRoom(_rooms: any) {
|
async getRoom(_rooms: any) {
|
||||||
this.loadingWholeList = true
|
this.loadingWholeList = true
|
||||||
|
|
||||||
|
|
||||||
let index = 0
|
let index = 0
|
||||||
|
|
||||||
if (_rooms) {
|
if (_rooms) {
|
||||||
@@ -374,80 +314,17 @@ export class ChatSystemService {
|
|||||||
|
|
||||||
for (let roomData of this.sortArrayISODate(_rooms)) {
|
for (let roomData of this.sortArrayISODate(_rooms)) {
|
||||||
|
|
||||||
|
|
||||||
const roomId = this.getRoomId(roomData);
|
|
||||||
|
|
||||||
if (roomData.t == 'd') {
|
if (roomData.t == 'd') {
|
||||||
|
|
||||||
let error = false
|
|
||||||
let res;
|
|
||||||
|
|
||||||
try {
|
|
||||||
res = await this.chatService.getMembers(roomId).toPromise();
|
|
||||||
} catch (e) {
|
|
||||||
await this.chatService.refreshtoken();
|
|
||||||
error = true
|
|
||||||
}
|
|
||||||
|
|
||||||
if (error) {
|
|
||||||
res = await this.chatService.getMembers(roomId).toPromise();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
const members = res['members'];
|
|
||||||
const users = members.filter(data => data.username != this.sessionStore.user.UserName);
|
|
||||||
_rooms[index]['members'] = members
|
|
||||||
_rooms[index]['membersExcludeMe'] = users
|
|
||||||
|
|
||||||
await this.prepareRoom(roomData);
|
await this.prepareRoom(roomData);
|
||||||
} else {
|
} else {
|
||||||
if (roomData.t === 'p') {
|
if (roomData.t === 'p') {
|
||||||
let error = false
|
|
||||||
let res;
|
|
||||||
|
|
||||||
try {
|
|
||||||
res = await this.chatService.getGroupMembers(roomId).toPromise()
|
|
||||||
} catch (e) {
|
|
||||||
await this.chatService.refreshtoken();
|
|
||||||
error = true
|
|
||||||
}
|
|
||||||
|
|
||||||
if (error) {
|
|
||||||
res = await this.chatService.getGroupMembers(roomId).toPromise()
|
|
||||||
}
|
|
||||||
|
|
||||||
const members = res['members'];
|
|
||||||
const users = members.filter(data => data.username != this.sessionStore.user.UserName);
|
|
||||||
|
|
||||||
_rooms[index]['members'] = members
|
|
||||||
_rooms[index]['membersExcludeMe'] = users
|
|
||||||
|
|
||||||
await this.prepareRoom(roomData);
|
await this.prepareRoom(roomData);
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
let error = false
|
|
||||||
let res;
|
|
||||||
|
|
||||||
try {
|
|
||||||
res = await this.chatService.getChannelMembers(roomId).toPromise()
|
|
||||||
|
|
||||||
} catch (e) {
|
|
||||||
await this.chatService.refreshtoken();
|
|
||||||
error = true
|
|
||||||
}
|
|
||||||
|
|
||||||
if (error) {
|
|
||||||
res = await this.chatService.getChannelMembers(roomId).toPromise()
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
const members = res['members'];
|
|
||||||
const users = members.filter(data => data.username != this.sessionStore.user.UserName);
|
|
||||||
|
|
||||||
_rooms[index]['members'] = members
|
|
||||||
_rooms[index]['membersExcludeMe'] = users
|
|
||||||
await this.prepareRoom(roomData);
|
await this.prepareRoom(roomData);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -477,6 +354,8 @@ export class ChatSystemService {
|
|||||||
*/
|
*/
|
||||||
subscribeToRoom() {
|
subscribeToRoom() {
|
||||||
|
|
||||||
|
if (SessionStore.user?.ChatData?.data) {
|
||||||
|
|
||||||
for (const id in this.dm) {
|
for (const id in this.dm) {
|
||||||
this.defaultSubtribe(id)
|
this.defaultSubtribe(id)
|
||||||
}
|
}
|
||||||
@@ -488,6 +367,13 @@ export class ChatSystemService {
|
|||||||
this.RochetChatConnectorService.streamNotifyLogged().then((subscription => { }))
|
this.RochetChatConnectorService.streamNotifyLogged().then((subscription => { }))
|
||||||
|
|
||||||
this.RochetChatConnectorService.subStreamMessageUser().then((subscription => { }))
|
this.RochetChatConnectorService.subStreamMessageUser().then((subscription => { }))
|
||||||
|
} else {
|
||||||
|
|
||||||
|
setTimeout(() => {
|
||||||
|
throw ('No chat data');
|
||||||
|
}, 1000)
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -576,13 +462,20 @@ export class ChatSystemService {
|
|||||||
lastMessage: this.getRoomLastMessage(roomData),
|
lastMessage: this.getRoomLastMessage(roomData),
|
||||||
_updatedAt: new Date(roomData._updatedAt || roomData._updatedAt['$date']),
|
_updatedAt: new Date(roomData._updatedAt || roomData._updatedAt['$date']),
|
||||||
u: roomData.u || {},
|
u: roomData.u || {},
|
||||||
members: roomData.members,
|
members: [],
|
||||||
membersExcludeMe: roomData.membersExcludeMe
|
membersExcludeMe: []
|
||||||
}
|
}
|
||||||
|
|
||||||
let roomId = this.getRoomId(roomData);
|
let roomId = this.getRoomId(roomData);
|
||||||
|
|
||||||
if (setData.name != 'Rocket Cat' && setData.name != 'general') {
|
let chat = false
|
||||||
|
if (roomData?.usernames) {
|
||||||
|
if (roomData?.usernames?.includes("chat.admin")) {
|
||||||
|
chat = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (setData.name != 'Rocket Cat' && setData.name != 'general' && chat == false) {
|
||||||
// create room
|
// create room
|
||||||
if (!this.roomExist(roomId)) {
|
if (!this.roomExist(roomId)) {
|
||||||
let room: RoomService = new RoomService(this.RochetChatConnectorService, new MessageService(this.NfService, this.RochetChatConnectorService, this.ChatMethodsService, this.AESEncrypt, this.AttachmentsService, this.NetworkServiceService, this, this.notificationService), this.storage, this.platform, this.sqlservice, this.NativeNotificationService, this.sortService, this.ChatService, this.NfService, this.ChatMethodsService, this.AESEncrypt, this.AttachmentsService, this.NetworkServiceService, this, this.ViewedMessageService, this.notificationService)
|
let room: RoomService = new RoomService(this.RochetChatConnectorService, new MessageService(this.NfService, this.RochetChatConnectorService, this.ChatMethodsService, this.AESEncrypt, this.AttachmentsService, this.NetworkServiceService, this, this.notificationService), this.storage, this.platform, this.sqlservice, this.NativeNotificationService, this.sortService, this.ChatService, this.NfService, this.ChatMethodsService, this.AESEncrypt, this.AttachmentsService, this.NetworkServiceService, this, this.ViewedMessageService, this.notificationService)
|
||||||
@@ -755,25 +648,32 @@ export class ChatSystemService {
|
|||||||
getRoomName(roomData: room): string {
|
getRoomName(roomData: room): string {
|
||||||
if (this.isIndividual(roomData)) {
|
if (this.isIndividual(roomData)) {
|
||||||
const names: String[] = roomData.usernames
|
const names: String[] = roomData.usernames
|
||||||
const roomName = names.filter((name, index) => {
|
|
||||||
return name != SessionStore.user.UserName
|
|
||||||
})[0]
|
|
||||||
|
|
||||||
if (roomName) {
|
|
||||||
|
if (roomData.t == 'd') {
|
||||||
|
|
||||||
|
const username = roomData.usernames.find(e => e != SessionStore.user.UserName)
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const firstName = capitalizeTxt(roomName.split('.')[0])
|
const firstName = capitalizeTxt(username.split('.')[0])
|
||||||
const lastName = capitalizeTxt(roomName.split('.')[1])
|
const lastName = capitalizeTxt(username.split('.')[1])
|
||||||
|
|
||||||
return firstName + ' ' + lastName
|
return firstName + ' ' + lastName
|
||||||
} catch (e) {
|
} catch (error) {
|
||||||
return roomData['membersExcludeMe'][0].name
|
const username = roomData.usernames.find(e => e != SessionStore.user.UserName)
|
||||||
|
|
||||||
|
const firstName = capitalizeTxt(username.split('.')[0])
|
||||||
|
return firstName
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (roomData.name) {
|
|
||||||
return roomData.name
|
|
||||||
} else {
|
} else {
|
||||||
return 'Sem nome'
|
if (roomData.t === 'p') {
|
||||||
|
return 'Loading'
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return 'Loading'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
return roomData.fname
|
return roomData.fname
|
||||||
@@ -849,12 +749,10 @@ export class ChatSystemService {
|
|||||||
|
|
||||||
async createGroup(name) {
|
async createGroup(name) {
|
||||||
const res: any = await this.createPrivateRoom(name, SessionStore.user.UserName, {});
|
const res: any = await this.createPrivateRoom(name, SessionStore.user.UserName, {});
|
||||||
console.log('room is created', res)
|
|
||||||
if (res?.result?.rid) {
|
if (res?.result?.rid) {
|
||||||
try {
|
try {
|
||||||
await this.getAllRooms();
|
await this.getAllRooms();
|
||||||
} catch (e) { }
|
} catch (e) { }
|
||||||
console.log('room is loaded')
|
|
||||||
return res
|
return res
|
||||||
} else {
|
} else {
|
||||||
return res
|
return res
|
||||||
|
|||||||
@@ -80,7 +80,8 @@ export class RochetChatConnectorService {
|
|||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
//
|
//
|
||||||
this.ws.registerCallback({type:'Onmessage', funx:(message)=>{
|
this.ws.registerCallback({
|
||||||
|
type: 'Onmessage', funx: (message) => {
|
||||||
//
|
//
|
||||||
if (message.id == requestId) { // same request send
|
if (message.id == requestId) { // same request send
|
||||||
//
|
//
|
||||||
@@ -107,7 +108,8 @@ export class RochetChatConnectorService {
|
|||||||
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}})
|
}
|
||||||
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -127,12 +129,14 @@ export class RochetChatConnectorService {
|
|||||||
this.ws.send({ message, requestId })
|
this.ws.send({ message, requestId })
|
||||||
|
|
||||||
return new Promise<Rooms>((resolve, reject) => {
|
return new Promise<Rooms>((resolve, reject) => {
|
||||||
this.ws.registerCallback({type:'Onmessage', funx:(message)=>{
|
this.ws.registerCallback({
|
||||||
|
type: 'Onmessage', funx: (message) => {
|
||||||
if (message.id == requestId) { // same request send
|
if (message.id == requestId) { // same request send
|
||||||
resolve(message)
|
resolve(message)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}})
|
}
|
||||||
|
})
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -151,12 +155,14 @@ export class RochetChatConnectorService {
|
|||||||
this.ws.send({ message, requestId })
|
this.ws.send({ message, requestId })
|
||||||
|
|
||||||
return new Promise<Rooms>((resolve, reject) => {
|
return new Promise<Rooms>((resolve, reject) => {
|
||||||
this.ws.registerCallback({type:'Onmessage', funx:(message)=>{
|
this.ws.registerCallback({
|
||||||
|
type: 'Onmessage', funx: (message) => {
|
||||||
if (message.id == requestId) { // same request send
|
if (message.id == requestId) { // same request send
|
||||||
resolve(message)
|
resolve(message)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}})
|
}
|
||||||
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -182,12 +188,14 @@ export class RochetChatConnectorService {
|
|||||||
this.ws.send({ message, requestId })
|
this.ws.send({ message, requestId })
|
||||||
|
|
||||||
return new Promise<Rooms>((resolve, reject) => {
|
return new Promise<Rooms>((resolve, reject) => {
|
||||||
this.ws.registerCallback({type:'Onmessage', funx:(message)=>{
|
this.ws.registerCallback({
|
||||||
|
type: 'Onmessage', funx: (message) => {
|
||||||
if (message.id == requestId) { // same request send
|
if (message.id == requestId) { // same request send
|
||||||
resolve(message)
|
resolve(message)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}})
|
}
|
||||||
|
})
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -220,12 +228,14 @@ export class RochetChatConnectorService {
|
|||||||
this.ws.send({ message, requestId });
|
this.ws.send({ message, requestId });
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
this.ws.registerCallback({type:'Onmessage', funx:(message)=>{
|
this.ws.registerCallback({
|
||||||
|
type: 'Onmessage', funx: (message) => {
|
||||||
if (message.id == requestId) { // same request send
|
if (message.id == requestId) { // same request send
|
||||||
resolve({ message, requestId })
|
resolve({ message, requestId })
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}})
|
}
|
||||||
|
})
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -243,12 +253,14 @@ export class RochetChatConnectorService {
|
|||||||
this.ws.send({ message, requestId });
|
this.ws.send({ message, requestId });
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
this.ws.registerCallback({type:'Onmessage', funx:(message)=>{
|
this.ws.registerCallback({
|
||||||
|
type: 'Onmessage', funx: (message) => {
|
||||||
if (message.id == requestId) { // same request send
|
if (message.id == requestId) { // same request send
|
||||||
resolve({ message, requestId })
|
resolve({ message, requestId })
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}})
|
}
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -269,12 +281,14 @@ export class RochetChatConnectorService {
|
|||||||
this.ws.send({ message, requestId });
|
this.ws.send({ message, requestId });
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
this.ws.registerCallback({type:'Onmessage', funx:(message)=>{
|
this.ws.registerCallback({
|
||||||
|
type: 'Onmessage', funx: (message) => {
|
||||||
if (message.id == requestId) { // same request send
|
if (message.id == requestId) { // same request send
|
||||||
resolve(message)
|
resolve(message)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}})
|
}
|
||||||
|
})
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -295,12 +309,14 @@ export class RochetChatConnectorService {
|
|||||||
this.ws.send({ message, requestId });
|
this.ws.send({ message, requestId });
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
this.ws.registerCallback({type:'Onmessage', funx:(message)=>{
|
this.ws.registerCallback({
|
||||||
|
type: 'Onmessage', funx: (message) => {
|
||||||
if (message.id == requestId) { // same request send
|
if (message.id == requestId) { // same request send
|
||||||
resolve(message)
|
resolve(message)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}})
|
}
|
||||||
|
})
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -318,14 +334,16 @@ export class RochetChatConnectorService {
|
|||||||
this.ws.send({ message, requestId });
|
this.ws.send({ message, requestId });
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
this.ws.registerCallback({type:'Onmessage', funx:(message)=>{
|
this.ws.registerCallback({
|
||||||
|
type: 'Onmessage', funx: (message) => {
|
||||||
if (message.id == requestId) { // same request send
|
if (message.id == requestId) { // same request send
|
||||||
resolve(message)
|
resolve(message)
|
||||||
//
|
//
|
||||||
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}})
|
}
|
||||||
|
})
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -344,12 +362,14 @@ export class RochetChatConnectorService {
|
|||||||
this.ws.send({ message, requestId });
|
this.ws.send({ message, requestId });
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
this.ws.registerCallback({type:'Onmessage', funx:(message) =>{
|
this.ws.registerCallback({
|
||||||
|
type: 'Onmessage', funx: (message) => {
|
||||||
if (message.id == requestId) {
|
if (message.id == requestId) {
|
||||||
resolve(message)
|
resolve(message)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}})
|
}
|
||||||
|
})
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -375,12 +395,14 @@ export class RochetChatConnectorService {
|
|||||||
this.ws.send({ message, requestId });
|
this.ws.send({ message, requestId });
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
this.ws.registerCallback({type:'Onmessage', funx:(message)=>{
|
this.ws.registerCallback({
|
||||||
|
type: 'Onmessage', funx: (message) => {
|
||||||
if (message.id == requestId) { // same request send
|
if (message.id == requestId) { // same request send
|
||||||
resolve(message)
|
resolve(message)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}})
|
}
|
||||||
|
})
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -402,12 +424,14 @@ export class RochetChatConnectorService {
|
|||||||
this.ws.send({ message, requestId })
|
this.ws.send({ message, requestId })
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
this.ws.registerCallback({type:'Onmessage', funx:(message)=>{
|
this.ws.registerCallback({
|
||||||
|
type: 'Onmessage', funx: (message) => {
|
||||||
if (message.id == requestId) { // same request send
|
if (message.id == requestId) { // same request send
|
||||||
resolve(message)
|
resolve(message)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}})
|
}
|
||||||
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -431,12 +455,14 @@ export class RochetChatConnectorService {
|
|||||||
this.ws.send({ message, requestId })
|
this.ws.send({ message, requestId })
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
this.ws.registerCallback({type:'Onmessage', funx:(message)=>{
|
this.ws.registerCallback({
|
||||||
|
type: 'Onmessage', funx: (message) => {
|
||||||
if (message.id == requestId) { // same request send
|
if (message.id == requestId) { // same request send
|
||||||
resolve(message)
|
resolve(message)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}})
|
}
|
||||||
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -460,12 +486,14 @@ export class RochetChatConnectorService {
|
|||||||
this.ws.send({ message, requestId })
|
this.ws.send({ message, requestId })
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
this.ws.registerCallback({type:'Onmessage', funx:(message)=>{
|
this.ws.registerCallback({
|
||||||
|
type: 'Onmessage', funx: (message) => {
|
||||||
if (message.id == requestId) { // same request send
|
if (message.id == requestId) { // same request send
|
||||||
resolve(message)
|
resolve(message)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}})
|
}
|
||||||
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -473,7 +501,7 @@ export class RochetChatConnectorService {
|
|||||||
subStreamMessageUser(param?: any) {
|
subStreamMessageUser(param?: any) {
|
||||||
|
|
||||||
const requestId = uuidv4()
|
const requestId = uuidv4()
|
||||||
|
try {
|
||||||
let message = {
|
let message = {
|
||||||
msg: "sub",
|
msg: "sub",
|
||||||
id: requestId,
|
id: requestId,
|
||||||
@@ -488,14 +516,18 @@ export class RochetChatConnectorService {
|
|||||||
this.ws.send({ message, requestId })
|
this.ws.send({ message, requestId })
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
this.ws.registerCallback({type:'Onmessage', funx:(message)=>{
|
this.ws.registerCallback({
|
||||||
|
type: 'Onmessage', funx: (message) => {
|
||||||
if (message.id == requestId) { // same request send
|
if (message.id == requestId) { // same request send
|
||||||
resolve(message)
|
resolve(message)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}})
|
}
|
||||||
|
})
|
||||||
});
|
});
|
||||||
|
} catch (error) {
|
||||||
|
throw (SessionStore)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
receiveStreamNotifyRoom(funx: Function) {
|
receiveStreamNotifyRoom(funx: Function) {
|
||||||
@@ -506,7 +538,8 @@ export class RochetChatConnectorService {
|
|||||||
if (message.collection == "stream-notify-room" && message.msg == 'changed') {
|
if (message.collection == "stream-notify-room" && message.msg == 'changed') {
|
||||||
funx(message)
|
funx(message)
|
||||||
}
|
}
|
||||||
}})
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -543,13 +576,15 @@ export class RochetChatConnectorService {
|
|||||||
this.ws.send({ message, requestId: 'loadHistory' })
|
this.ws.send({ message, requestId: 'loadHistory' })
|
||||||
|
|
||||||
return new Promise<chatHistory>((resolve, reject) => {
|
return new Promise<chatHistory>((resolve, reject) => {
|
||||||
this.ws.registerCallback({type:'Onmessage', funx:(message)=>{
|
this.ws.registerCallback({
|
||||||
|
type: 'Onmessage', funx: (message) => {
|
||||||
//
|
//
|
||||||
if (message.id == requestId) { // same request send
|
if (message.id == requestId) { // same request send
|
||||||
resolve(message)
|
resolve(message)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}})
|
}
|
||||||
|
})
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -587,12 +622,14 @@ export class RochetChatConnectorService {
|
|||||||
this.ws.send({ message, requestId });
|
this.ws.send({ message, requestId });
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
this.ws.registerCallback({type:'Onmessage', funx:(message)=>{
|
this.ws.registerCallback({
|
||||||
|
type: 'Onmessage', funx: (message) => {
|
||||||
if (message.msg == 'ready' || deepFind(message, 'subs.0') == requestId) { // same request send
|
if (message.msg == 'ready' || deepFind(message, 'subs.0') == requestId) { // same request send
|
||||||
resolve(message)
|
resolve(message)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}})
|
}
|
||||||
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -633,14 +670,16 @@ export class RochetChatConnectorService {
|
|||||||
this.ws.send({ message, requestId });
|
this.ws.send({ message, requestId });
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
this.ws.registerCallback({type:'Onmessage', funx:(message) => {
|
this.ws.registerCallback({
|
||||||
|
type: 'Onmessage', funx: (message) => {
|
||||||
|
|
||||||
|
|
||||||
if (message.id == requestId || message?.subs?.[0] == requestId) { // same request send
|
if (message.id == requestId || message?.subs?.[0] == requestId) { // same request send
|
||||||
resolve(message)
|
resolve(message)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}})
|
}
|
||||||
|
})
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -661,12 +700,14 @@ export class RochetChatConnectorService {
|
|||||||
this.ws.send({ message, requestId });
|
this.ws.send({ message, requestId });
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
this.ws.registerCallback({type:'Onmessage', funx:(message)=>{
|
this.ws.registerCallback({
|
||||||
|
type: 'Onmessage', funx: (message) => {
|
||||||
if (message.id == requestId) { // same request send
|
if (message.id == requestId) { // same request send
|
||||||
resolve(message)
|
resolve(message)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}})
|
}
|
||||||
|
})
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -688,12 +729,14 @@ export class RochetChatConnectorService {
|
|||||||
this.ws.send({ message, requestId })
|
this.ws.send({ message, requestId })
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
this.ws.registerCallback({type:'Onmessage', funx:(message)=>{
|
this.ws.registerCallback({
|
||||||
|
type: 'Onmessage', funx: (message) => {
|
||||||
if (message.id == requestId) { // same request send
|
if (message.id == requestId) { // same request send
|
||||||
resolve(message)
|
resolve(message)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}})
|
}
|
||||||
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -715,12 +758,14 @@ export class RochetChatConnectorService {
|
|||||||
this.ws.send({ message, requestId })
|
this.ws.send({ message, requestId })
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
this.ws.registerCallback({type:'Onmessage', funx:(message)=>{
|
this.ws.registerCallback({
|
||||||
|
type: 'Onmessage', funx: (message) => {
|
||||||
if (message.id == requestId) { // same request send
|
if (message.id == requestId) { // same request send
|
||||||
resolve(message)
|
resolve(message)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}})
|
}
|
||||||
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -162,6 +162,7 @@ export class RoomService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setDataOnce = false
|
||||||
setData({ membersExcludeMe, members, u, customFields = {}, id, name, t, lastMessage = new MessageService(this.NfService, this.RochetChatConnectorService, this.ChatMethodsService, this.AESEncrypt, this.AttachmentsService, this.NetworkServiceService, this.ChatSystemService, this.notificationService), _updatedAt }) {
|
setData({ membersExcludeMe, members, u, customFields = {}, id, name, t, lastMessage = new MessageService(this.NfService, this.RochetChatConnectorService, this.ChatMethodsService, this.AESEncrypt, this.AttachmentsService, this.NetworkServiceService, this.ChatSystemService, this.notificationService), _updatedAt }) {
|
||||||
this.customFields = customFields
|
this.customFields = customFields
|
||||||
this.id = id
|
this.id = id
|
||||||
@@ -170,9 +171,6 @@ export class RoomService {
|
|||||||
this.lastMessage = lastMessage
|
this.lastMessage = lastMessage
|
||||||
this._updatedAt = _updatedAt
|
this._updatedAt = _updatedAt
|
||||||
this.u = u
|
this.u = u
|
||||||
this.members = members
|
|
||||||
this.membersExcludeMe = membersExcludeMe
|
|
||||||
|
|
||||||
this.calDateDuration();
|
this.calDateDuration();
|
||||||
|
|
||||||
|
|
||||||
@@ -180,6 +178,11 @@ export class RoomService {
|
|||||||
this.countDownDate(this.customFields.countDownDate);
|
this.countDownDate(this.customFields.countDownDate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.setDataOnce == false) {
|
||||||
|
this.setDataOnce = true
|
||||||
|
this.updateContacts()
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
updateInfo() {
|
updateInfo() {
|
||||||
@@ -946,7 +949,7 @@ export class RoomService {
|
|||||||
|
|
||||||
this.localMessages = this.messages.map(e => e._id)
|
this.localMessages = this.messages.map(e => e._id)
|
||||||
|
|
||||||
if(chatHistory?.result?.messages) {
|
if (Array.isArray(chatHistory?.result?.messages)) {
|
||||||
|
|
||||||
const users = this.getUsersByStatus('online')
|
const users = this.getUsersByStatus('online')
|
||||||
|
|
||||||
@@ -1222,6 +1225,9 @@ export class RoomService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
setTimeout(() => {
|
||||||
|
console.log("getGroupMembers", this.membersExcludeMe)
|
||||||
|
}, 500)
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -1238,6 +1244,9 @@ export class RoomService {
|
|||||||
res = await this.chatService.getChannelMembers(this.id).toPromise()
|
res = await this.chatService.getChannelMembers(this.id).toPromise()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setTimeout(() => {
|
||||||
|
console.log("getChannelMembers", this.membersExcludeMe)
|
||||||
|
}, 500)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -367,13 +367,19 @@ export class NotificationsService {
|
|||||||
|
|
||||||
let navigationExtras: NavigationExtras = { queryParams: { "roomId": notification.notification.data.IdObject, } };
|
let navigationExtras: NavigationExtras = { queryParams: { "roomId": notification.notification.data.IdObject, } };
|
||||||
|
|
||||||
|
if (window.location.search.includes("roomId")) {
|
||||||
this.zone.run(() => this.router.navigate(['/home/chat']));
|
this.zone.run(() => this.router.navigate(['/home/chat']));
|
||||||
|
}
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.zone.run(() => this.router.navigate(['/home/chat'], navigationExtras));
|
this.zone.run(() => this.router.navigate(['/home/chat'], navigationExtras));
|
||||||
}, 200);
|
}, 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// (() => {
|
||||||
|
// this.zone.run(() => this.NotificationHolderService.PhoneClickNotification(notification));
|
||||||
|
// })()
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { Injectable, NgZone } from '@angular/core';
|
import { Injectable, NgZone } from '@angular/core';
|
||||||
import { StorageService } from '../services/storage.service';
|
import { StorageService } from '../services/storage.service';
|
||||||
import { v4 as uuidv4 } from 'uuid'
|
import { v4 as uuidv4 } from 'uuid'
|
||||||
|
import { SHA1 } from 'crypto-js';
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
})
|
})
|
||||||
@@ -40,17 +41,13 @@ export class NotificationHolderService {
|
|||||||
this.storageService.store("Notifications", this._notificationList)
|
this.storageService.store("Notifications", this._notificationList)
|
||||||
}
|
}
|
||||||
|
|
||||||
addNotification(notification) {
|
notificationObject(notification) {
|
||||||
|
|
||||||
const element = notification
|
const element = notification
|
||||||
const i = this._notificationList.length + 1
|
|
||||||
|
|
||||||
let notificationObject;
|
let notificationObject;
|
||||||
if (element.notification) {
|
if (element.notification) {
|
||||||
|
|
||||||
notificationObject = {
|
notificationObject = {
|
||||||
id: notification?.id || uuidv4(),
|
id: notification?.id,
|
||||||
index: i,
|
|
||||||
title: element.notification.title,
|
title: element.notification.title,
|
||||||
Service: element.data.Service,
|
Service: element.data.Service,
|
||||||
Object: element.data.Object,
|
Object: element.data.Object,
|
||||||
@@ -68,8 +65,7 @@ export class NotificationHolderService {
|
|||||||
|
|
||||||
} else if (element.data) {
|
} else if (element.data) {
|
||||||
notificationObject = {
|
notificationObject = {
|
||||||
id: notification?.id || uuidv4(),
|
id: notification?.id,
|
||||||
index: i,
|
|
||||||
title: element.title,
|
title: element.title,
|
||||||
Service: element.data.Service,
|
Service: element.data.Service,
|
||||||
Object: element.data.Object,
|
Object: element.data.Object,
|
||||||
@@ -88,25 +84,38 @@ export class NotificationHolderService {
|
|||||||
} else {
|
} else {
|
||||||
{
|
{
|
||||||
notificationObject = {
|
notificationObject = {
|
||||||
id: notification?.id || uuidv4(),
|
id: notification?.id,
|
||||||
FolderId: element.FolderId,
|
|
||||||
IdObject: element.IdObject,
|
|
||||||
Location: element.Location,
|
|
||||||
Object: element.Object,
|
|
||||||
Role: element.Role,
|
|
||||||
Service: element.Service,
|
|
||||||
Status: element.Status,
|
|
||||||
TypeAgenda: element.TypeAgenda,
|
|
||||||
body: element.body,
|
|
||||||
dateEnd: element.dateEnd,
|
|
||||||
dateInit: element.dateInit,
|
|
||||||
index: element.index,
|
|
||||||
title: element.title,
|
title: element.title,
|
||||||
|
Service: element.Service,
|
||||||
|
Object: element.Object,
|
||||||
|
IdObject: element.IdObject,
|
||||||
|
FolderId: element.FolderId,
|
||||||
|
body: element.body,
|
||||||
|
dateInit: element.dateInit,
|
||||||
|
dateEnd: element.dateEnd,
|
||||||
|
Location: element.Location,
|
||||||
|
TypeAgenda: element.TypeAgenda,
|
||||||
|
Role: element.Role,
|
||||||
|
Status: element.Status,
|
||||||
read: false,
|
read: false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
notificationObject.hashCode = (SHA1(notification)).toString()
|
||||||
|
|
||||||
|
return notificationObject
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
addNotification(notification) {
|
||||||
|
|
||||||
|
let notificationObject = this.notificationObject(notification)
|
||||||
|
|
||||||
|
//alert("add notification")
|
||||||
|
//alert(JSON.stringify(notificationObject))
|
||||||
|
|
||||||
if (!this.notificationExist(notificationObject)) {
|
if (!this.notificationExist(notificationObject)) {
|
||||||
this._notificationList.push(notificationObject)
|
this._notificationList.push(notificationObject)
|
||||||
|
|
||||||
@@ -115,14 +124,11 @@ export class NotificationHolderService {
|
|||||||
this.save()
|
this.save()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
console.log('duplicate', notification, this._notificationList)
|
console.log('duplicate', notification, this._notificationList)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
notificationExist(notificationObject) {
|
notificationExist(notificationObject) {
|
||||||
const notification = this._notificationList.find(item => {
|
const notification = this._notificationList.find(item => {
|
||||||
return item.id === notificationObject.id;
|
return item.id === notificationObject.id;
|
||||||
@@ -166,4 +172,36 @@ export class NotificationHolderService {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
PhoneClickNotification(ClickedNotificationObject) {
|
||||||
|
//alert("PhoneClickNotification")
|
||||||
|
|
||||||
|
//alert(JSON.stringify(ClickedNotificationObject))
|
||||||
|
const { hashCode, id } = this.notificationObject(ClickedNotificationObject)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//alert(id)
|
||||||
|
//alert(JSON.stringify(this._notificationList))
|
||||||
|
// let foundNotification = this._notificationList.find( (e) => {
|
||||||
|
// return e.hashCode == hashCode
|
||||||
|
// })
|
||||||
|
|
||||||
|
//if(foundNotification) {
|
||||||
|
// this.removeNotification(foundNotification)
|
||||||
|
//} else {
|
||||||
|
console.log({ ClickedNotificationObject, list: this._notificationList })
|
||||||
|
|
||||||
|
let foundNotification = this._notificationList.find((e) => {
|
||||||
|
return e.id == id
|
||||||
|
})
|
||||||
|
|
||||||
|
if (foundNotification) {
|
||||||
|
this.removeNotification(foundNotification)
|
||||||
|
} else {
|
||||||
|
console.log({ ClickedNotificationObject, list: this._notificationList })
|
||||||
|
}
|
||||||
|
//}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user