add implementation

This commit is contained in:
Peter Maquiran
2023-09-11 21:57:14 +01:00
parent 680f57313f
commit c04fc2a15f
12 changed files with 529 additions and 140 deletions
+2 -2
View File
@@ -1,4 +1,4 @@
#!/usr/bin/env sh #!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh" # . "$(dirname -- "$0")/_/husky.sh"
npm run build:version && git add version/git-version.ts #npm run build:version && git add version/git-version.ts
@@ -52,8 +52,8 @@
<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" *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)"> <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"> <div class="title" *ngIf="!msg.dateLabel">
<ion-label>{{msg.u.name ?? ""}}</ion-label> <ion-label>{{msg.u.name ?? ""}}</ion-label>
<span class="time">{{msg.duration}}</span> <span class="time">{{msg.duration}}</span>
</div> </div>
@@ -64,7 +64,7 @@
<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> -->
<!-- <ion-icon *ngIf="msg.viewed.length >= 1" src="assets/images/check-double-solid -viewed.svg"></ion-icon> --> <!-- <ion-icon *ngIf="msg.viewed.length >= 1" src="assets/images/check-double-solid -viewed.svg"></ion-icon> -->
<span class="lido pl-10" *ngIf="msg.viewed.length >= 1" > Lido</span> <span class="lido pl-10" *ngIf="msg.viewed.length >= 1" > Lido</span>
@@ -102,7 +102,7 @@
<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> -->
<!-- <ion-icon *ngIf="msg.viewed.length >= 1" src="assets/images/check-double-solid -viewed.svg"></ion-icon> --> <!-- <ion-icon *ngIf="msg.viewed.length >= 1" src="assets/images/check-double-solid -viewed.svg"></ion-icon> -->
<span class="lido pl-10" *ngIf="msg.viewed.length >= 1" > Lido</span> <span class="lido pl-10" *ngIf="msg.viewed.length >= 1" > Lido</span>
@@ -122,7 +122,7 @@
<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="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-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">
@@ -153,13 +153,13 @@
<ion-label *ngIf="msg.file && msg.file != ''"> <ion-label *ngIf="msg.file && msg.file != ''">
<span *ngIf="file.description">{{file.description}}</span> <span *ngIf="file.description">{{file.description}}</span>
<span *ngIf="file.description && msg.file.type != 'application/webtrix'"></span> <span *ngIf="file.description && msg.file.type != 'application/webtrix'"></span>
</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> -->
<!-- <ion-icon *ngIf="msg.viewed.length >= 1" src="assets/images/check-double-solid -viewed.svg"></ion-icon> --> <!-- <ion-icon *ngIf="msg.viewed.length >= 1" src="assets/images/check-double-solid -viewed.svg"></ion-icon> -->
<span class="lido pl-10" *ngIf="msg.viewed.length >= 1" > Lido</span> <span class="lido pl-10" *ngIf="msg.viewed.length >= 1" > Lido</span>
@@ -425,4 +425,13 @@ ion-footer {
.font-40-rem { .font-40-rem {
font-size: 2.5rem !important; font-size: 2.5rem !important;
} }
.dateLabel {
background: #ebebeb !important;
float: unset !important;
margin: 0px auto !important;
width: 110px;
text-align: center;
}
+10 -10
View File
@@ -50,8 +50,8 @@
*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)" class='file message-container incoming-{{msg.u.username!=sessionStore.user.UserName}}'
*ngIf="msg.msg !=''"> *ngIf="msg.msg !=''" [class.dateLabel]="msg.dateLabel">
<div class="title file"> <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.duration}}</span> <span class="time">{{msg.duration}}</span>
</div> </div>
@@ -64,7 +64,7 @@
<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> -->
<!-- <ion-icon *ngIf="msg.viewed.length >= 1" src="assets/images/check-double-solid -viewed.svg"></ion-icon> --> <!-- <ion-icon *ngIf="msg.viewed.length >= 1" src="assets/images/check-double-solid -viewed.svg"></ion-icon> -->
<span class="lido pl-10" *ngIf="msg.viewed.length >= 1" > Lido</span> <span class="lido pl-10" *ngIf="msg.viewed.length >= 1" > Lido</span>
@@ -96,17 +96,17 @@
</ion-item> </ion-item>
</div> </div>
<img *ngIf="msg.attachments[0].image_url" src="{{msg.attachments[0].image_url}}" alt="image"> <img *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> -->
<!-- <ion-icon *ngIf="msg.viewed.length >= 1" src="assets/images/check-double-solid -viewed.svg"></ion-icon> --> <!-- <ion-icon *ngIf="msg.viewed.length >= 1" src="assets/images/check-double-solid -viewed.svg"></ion-icon> -->
<span class="lido pl-10" *ngIf="msg.viewed.length >= 1" > Lido</span> <span class="lido pl-10" *ngIf="msg.viewed.length >= 1" > Lido</span>
<div *ngIf="msg.manualRetry" class="try pl-10" (click)="msg.send()">Tentar</div> <div *ngIf="msg.manualRetry" class="try pl-10" (click)="msg.send()">Tentar</div>
</ion-label> </ion-label>
</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'">
@@ -159,20 +159,20 @@
<ion-label *ngIf="msg.file && msg.file != ''"> <ion-label *ngIf="msg.file && msg.file != ''">
<span *ngIf="file.description">{{file.description}}</span> <span *ngIf="file.description">{{file.description}}</span>
<span *ngIf="file.description && msg.file.type != 'application/webtrix'"></span> <span *ngIf="file.description && msg.file.type != 'application/webtrix'"></span>
</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> -->
<!-- <ion-icon *ngIf="msg.viewed.length >= 1" src="assets/images/check-double-solid -viewed.svg"></ion-icon> --> <!-- <ion-icon *ngIf="msg.viewed.length >= 1" src="assets/images/check-double-solid -viewed.svg"></ion-icon> -->
<span class="lido pl-10" *ngIf="msg.viewed.length >= 1" > Lido</span> <span class="lido pl-10" *ngIf="msg.viewed.length >= 1" > Lido</span>
<div *ngIf="msg.manualRetry" class="try pl-10" (click)="msg.send()">Tentar</div> <div *ngIf="msg.manualRetry" class="try pl-10" (click)="msg.send()">Tentar</div>
</ion-label> </ion-label>
</div> </div>
</div> </div>
</div> </div>
+10 -1
View File
@@ -406,4 +406,13 @@ button::-moz-focus-inner {
.font-40-rem { .font-40-rem {
font-size: 2.5rem !important; font-size: 2.5rem !important;
} }
.dateLabel {
background: #ebebeb !important;
float: unset !important;
margin: 0px auto !important;
width: 110px;
text-align: center;
}
+318 -30
View File
@@ -47,7 +47,7 @@ export class MessageService {
uploadingFile = false uploadingFile = false
errorUploadingAttachment = false errorUploadingAttachment = false
loadHistory = false loadHistory = false
from: 'Offline'|'History'|'stream'| 'send' from: 'Offline'|'History'|'stream'| 'send'
duration = '' duration = ''
localReference = null localReference = null
viewed: string[] = [] viewed: string[] = []
@@ -67,6 +67,8 @@ export class MessageService {
messageModelInstance: MessageModel messageModelInstance: MessageModel
attachmentsModelData: any attachmentsModelData: any
dateLabel = false
constructor( constructor(
private NfService: NfService, private NfService: NfService,
@@ -177,7 +179,7 @@ export class MessageService {
return firstName + ' ' + lastName return firstName + ' ' + lastName
} catch (error) { } catch (error) {
return username return username
} }
} }
@@ -193,9 +195,9 @@ export class MessageService {
if(!this.hasFile) { if(!this.hasFile) {
const params = { const params = {
roomId:this.rid, roomId:this.rid,
msg:this.msg, msg:this.msg,
localReference: this.localReference localReference: this.localReference
} }
@@ -226,7 +228,7 @@ export class MessageService {
this.RochetChatConnectorService.registerCallback({ this.RochetChatConnectorService.registerCallback({
type: 'reConnect', type: 'reConnect',
funx: async ()=> { funx: async ()=> {
await this.send().catch((error) => { await this.send().catch((error) => {
console.error(error) console.error(error)
}) })
@@ -257,10 +259,10 @@ export class MessageService {
try { try {
await this.getFileFromDB() await this.getFileFromDB()
} catch (error) {} } catch (error) {}
} }
if(!this.instanceHasTemporaryData) { if(!this.instanceHasTemporaryData) {
await this.generateTemporaryData() await this.generateTemporaryData()
} }
@@ -277,14 +279,14 @@ export class MessageService {
this.saveChanges() this.saveChanges()
} catch (error) { } catch (error) {
this.uploadingFile = false this.uploadingFile = false
this.errorUploadingAttachment = true this.errorUploadingAttachment = true
this.UploadAttachmentsTemp++ this.UploadAttachmentsTemp++
this.saveChanges() this.saveChanges()
} }
} }
return uploadSuccessfully return uploadSuccessfully
@@ -305,7 +307,7 @@ export class MessageService {
(ChatMessage: any) => { (ChatMessage: any) => {
ChatMessage = ChatMessage.message.result ChatMessage = ChatMessage.message.result
clearTimeout(this.functionTimer); clearTimeout(this.functionTimer);
this.redefinedMessage(ChatMessage) this.redefinedMessage(ChatMessage)
} }
).catch((error) => { ).catch((error) => {
@@ -320,16 +322,16 @@ export class MessageService {
(ChatMessage: any) => { (ChatMessage: any) => {
ChatMessage = ChatMessage.message.result ChatMessage = ChatMessage.message.result
clearTimeout(this.functionTimer); clearTimeout(this.functionTimer);
this.redefinedMessage(ChatMessage) this.redefinedMessage(ChatMessage)
} }
).catch((error) => { ).catch((error) => {
clearTimeout(this.functionTimer); clearTimeout(this.functionTimer);
console.error(error) console.error(error)
}) })
} }
this.functionTimer = setTimeout(() => { this.functionTimer = setTimeout(() => {
this.RochetChatConnectorService.registerCallback({ this.RochetChatConnectorService.registerCallback({
type:'Onmessage', type:'Onmessage',
@@ -395,7 +397,7 @@ export class MessageService {
this.notificationService.ChatSendMessageNotificationGrup(usersNames,ChatMessage.u.name,ChatMessage.msg,this.rid) this.notificationService.ChatSendMessageNotificationGrup(usersNames,ChatMessage.u.name,ChatMessage.msg,this.rid)
} }
await this.saveChanges() await this.saveChanges()
} }
@@ -415,7 +417,7 @@ export class MessageService {
} else if (this.file.type != "application/img") { } else if (this.file.type != "application/img") {
downloadFile = new Uint8Array(event.body).reduce((data, byte) => data + String.fromCharCode(byte), ''); downloadFile = new Uint8Array(event.body).reduce((data, byte) => data + String.fromCharCode(byte), '');
} }
this.attachments[0] = { this.attachments[0] = {
@@ -462,7 +464,7 @@ export class MessageService {
return true return true
} }
} }
return false return false
} }
@@ -525,21 +527,21 @@ export class MessageService {
} }
earlySave = false earlySave = false
async addMessageDB() { async addMessageDB() {
if(!this.addToDb && this.save) { if(!this.addToDb && this.save) {
this.addToDb = true this.addToDb = true
const message = this.getChatObj() const message = this.getChatObj()
if(this.instanceHasAttachment) { if(this.instanceHasAttachment) {
this.hasFile = true this.hasFile = true
} }
delete message.id delete message.id
const createdMessage = await MessageModel.create(message) const createdMessage = await MessageModel.create(message)
if(this.instanceHasAttachment) { if(this.instanceHasAttachment) {
this.addFileToDb() this.addFileToDb()
} }
this.messageModelInstance = createdMessage this.messageModelInstance = createdMessage
@@ -556,7 +558,7 @@ export class MessageService {
if(!this.messageModelInstance) { if(!this.messageModelInstance) {
this.messageModelInstance = await this.getRowInstance() this.messageModelInstance = await this.getRowInstance()
} }
const createdMessage: any = this.messageModelInstance const createdMessage: any = this.messageModelInstance
try { try {
@@ -566,7 +568,7 @@ export class MessageService {
if(this.attachmentsModelData) { if(this.attachmentsModelData) {
file = {image_url: this.attachmentsModelData?.fileBase64} file = {image_url: this.attachmentsModelData?.fileBase64}
} }
await attachments.create({messageId: createdMessage.id, attachments: this.attachments, file: Object.assign(this.file, file) }) await attachments.create({messageId: createdMessage.id, attachments: this.attachments, file: Object.assign(this.file, file) })
} catch (error) { } catch (error) {
console.log(error) console.log(error)
@@ -578,8 +580,8 @@ export class MessageService {
if(!this.messageModelInstance) { if(!this.messageModelInstance) {
this.messageModelInstance = await this.getRowInstance() this.messageModelInstance = await this.getRowInstance()
} }
const data = await this.messageModelInstance.getAttachments() const data = await this.messageModelInstance.getAttachments()
console.log('data', data); console.log('data', data);
@@ -590,7 +592,7 @@ export class MessageService {
async generateTemporaryData () { async generateTemporaryData () {
const blob: any = await this.base64StringToBlob(this.file.image_url) const blob: any = await this.base64StringToBlob(this.file.image_url)
const formData = new FormData(); const formData = new FormData();
formData.append("blobFile", blob); formData.append("blobFile", blob);
this.temporaryData = formData this.temporaryData = formData
@@ -651,7 +653,7 @@ export class MessageService {
if(!message.id) { if(!message.id) {
delete message.id delete message.id
} }
if (this.localReference) { if (this.localReference) {
a = await MessageModel.get({localReference: this.localReference}) a = await MessageModel.get({localReference: this.localReference})
} else if (this._id) { } else if (this._id) {
@@ -662,7 +664,7 @@ export class MessageService {
return a return a
} }
} }
async saveChanges() { async saveChanges() {
@@ -683,13 +685,299 @@ export class MessageService {
this.messageModelInstance[name] = value this.messageModelInstance[name] = value
} catch (error) {} } catch (error) {}
} }
await this.messageModelInstance.save() await this.messageModelInstance.save()
} else { } else {
this.earlySave = true this.earlySave = true
} }
}
decryptMessage() {
try {
// this.msg = this.AESEncrypt.decrypt(this.msg, SessionStore.user.UserName)
} catch (error) {}
}
UIdata() {
this.incomingFromCurrentUser = this.u.username!= SessionStore.user.UserName
this.hasMessage = this.msg !=''
}
incomingFromCurrentUser = false
hasMessage = false
}
export class MessageServiceDateLabel {
customFields
channels = []
mentions = []
msg = ''
rid = ''
ts = {}
u = {
name: '',
username: '',
_id: ""
}
t = ''
_id = ''
id = '' // table id
_updatedAt
file
attachments
displayType = ''
temporaryData: any
hasFile = false
hasSendAttachment = false
sendAttempt = 0
uploadingFile = false
errorUploadingAttachment = false
loadHistory = false
from: 'Offline'|'History'|'stream'| 'send'
duration = ''
localReference = null
viewed: string[] = []
received: string[]= []
addToDb = false
messageSend = false
delate = false
delateRequest = false
downloadLoader: boolean = false
downloadAttachments = false;
downloadAttachmentsTemp = 0;
UploadAttachmentsTemp = 0;
manualRetry = false
origin: 'history' | 'stream' | 'local'
messageModelInstance: MessageModel
attachmentsModelData: any
ChatSystemService
dateLabel = false
constructor() {}
setData({customFields = {}, channels, mentions, msg ,rid ,ts, u, t, _id, id, _updatedAt, file, attachments, temporaryData, localReference = 'out-'+uuidv4() , viewed = [], received = [], delate = false, delateRequest =false, from, sendAttempt = 0, origin, attachmentsModelData, hasFile = false, UploadAttachmentsTemp = 0 }:Message) {
this.channels = []
this.mentions = []
this.rid = rid
this.ts = ts
this.u = u || { name: this.usernameToDisplayName(SessionStore.user.UserName), username: SessionStore.user.UserName, _id: ""}
this.t = t
this._id = ""
this._updatedAt = _updatedAt || new Date().getTime()
this.file = file
this.temporaryData = temporaryData
this.localReference = localReference || null
this.id = id
this.delate = delate
this.delateRequest = delateRequest
this.sendAttempt = 0
this.origin = origin
this.attachmentsModelData = attachmentsModelData
this.UploadAttachmentsTemp = UploadAttachmentsTemp
if(this.attachments?.length >= 1 && attachments?.length >= 1) {
this.attachments[0] = Object.assign(this.attachments[0], attachments[0])
} else {
this.attachments = attachments
}
this.viewed = [];
this.received = [];
this.messageSend = true
this.hasFile = hasFile
this.hasFile = false
if(!this.u.name && this.u.username) {
const user = this.ChatSystemService.users.find((u)=> u.username == this.u.username)
if(user) {
this.u.name = user.name
} else if( this.u.username == SessionStore.user.UserName) {
this.u.name = SessionStore.user.FullName
} else {
}
}
this.calDateDuration()
}
get offline () {
if(!this._id) {
return true
}
if(!this.ts) {
return true
}
return false
}
/**
* Message is on the server
*/
get online() {
return !this.offline
}
/**
* if Message is already saved on database
*/
get save() {
return this.id != ''
}
private usernameToDisplayName(username) {
try {
const firstName = capitalizeTxt(username.split('.')[0])
const lastName = capitalizeTxt(username.split('.')[1])
return firstName + ' ' + lastName
} catch (error) {
return username
}
}
async send(): Promise<any> {
}
functionTimer = null;
async sendRequestAttachment() {
}
async sendRequest(params) {
}
async redefinedMessage(ChatMessage , update = true) {
}
sendNotificaton
downloadFileMsg() {
}
private calDateDuration(date = null) {
this.duration = showDateDuration(date || this._updatedAt);
}
async delateStatusFalse() {
}
addViewed(id: string) {
}
addReceived(id: string) {
}
async delateDB() {
}
isSenderIsNotMe(ChatMessage) {
return SessionStore.user.ChatData.data.userId != ChatMessage.u._id
}
messageOwner() {
return SessionStore.user.ChatData.data.userId == this.u._id
}
getChatObj() {
}
earlySave = false
async addMessageDB() {
}
async addFileToDb() {
}
async getFileFromDB() {
}
async generateTemporaryData () {
}
get instanceHasAttachment() {
return false
}
get instanceHasAttachmentBase64() {
if (this.file) {
if(this.file.type) {
if(this.file?.image_url) {
return true
}
}
}
return false
}
get instanceHasTemporaryData() {
if (!this.temporaryData) {
return false
}
return true
}
base64StringToBlob(base64Data) {
}
async getRowInstance () {
}
async saveChanges() {
} }
decryptMessage() { decryptMessage() {
+113 -54
View File
@@ -1,6 +1,6 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { RochetChatConnectorService } from 'src/app/services/chat/rochet-chat-connector.service'; import { RochetChatConnectorService } from 'src/app/services/chat/rochet-chat-connector.service';
import { MessageService } from 'src/app/services/chat/message.service'; import { MessageService, MessageServiceDateLabel } from 'src/app/services/chat/message.service';
import { showDateDuration } from 'src/plugin/showDateDuration'; import { showDateDuration } from 'src/plugin/showDateDuration';
import { chatHistory } from 'src/app/models/chatMethod'; import { chatHistory } from 'src/app/models/chatMethod';
import { Storage } from '@ionic/storage'; import { Storage } from '@ionic/storage';
@@ -187,7 +187,7 @@ export class RoomService {
} }
get online() { get online() {
if(!this.isGroup) { if(!this.isGroup) {
for(let user of this.ChatSystemService.users) { for(let user of this.ChatSystemService.users) {
@@ -196,7 +196,7 @@ export class RoomService {
return user.status return user.status
} }
} }
} }
} }
@@ -244,7 +244,7 @@ export class RoomService {
}); });
} }
else { else {
this.chatService.deleteChannel(body).subscribe(res=>{ this.chatService.deleteChannel(body).subscribe(res=>{
this.ChatSystemService.deleteRoom(this.id); this.ChatSystemService.deleteRoom(this.id);
this.ChatSystemService.getAllRooms(); this.ChatSystemService.getAllRooms();
this.chatServiceDeleteRoom(this.id); this.chatServiceDeleteRoom(this.id);
@@ -281,7 +281,7 @@ export class RoomService {
if (typeof args[1] != 'object') { if (typeof args[1] != 'object') {
this.userThatIsTyping = this.usernameToDisplayName(args[0]) this.userThatIsTyping = this.usernameToDisplayName(args[0])
this.isTyping = args[1] this.isTyping = args[1]
this.otherUserType = args[1] this.otherUserType = args[1]
@@ -298,9 +298,9 @@ export class RoomService {
} }
} else if(args[0]?.method == 'deleteMessage' || args[1]?.method == 'deleteMessage') { } else if(args[0]?.method == 'deleteMessage' || args[1]?.method == 'deleteMessage') {
this.deleteMessage(args[1]?.method?._id) this.deleteMessage(args[1]?.method?._id)
} else { } else {
} }
@@ -316,13 +316,13 @@ export class RoomService {
let ChatMessage : ChatMessageInterface = this.fix_updatedAt(IncomingChatMessageArgs) let ChatMessage : ChatMessageInterface = this.fix_updatedAt(IncomingChatMessageArgs)
let found = this.findMessageBy_id(ChatMessage._id) || let found = this.findMessageBy_id(ChatMessage._id) ||
this.findMessageBy_localReference(ChatMessage?.localReference) this.findMessageBy_localReference(ChatMessage?.localReference)
// || await this.findMessageInDBByData({_id:ChatMessage._id, localReference:ChatMessage.localReference }) // || await this.findMessageInDBByData({_id:ChatMessage._id, localReference:ChatMessage.localReference })
if(!found) { if(!found) {
ChatMessage.origin = 'stream' ChatMessage.origin = 'stream'
const message = await this.prepareCreate({message: ChatMessage, save: false}); const message = await this.prepareCreate({message: ChatMessage, save: false});
this.registerSendMessage(message) this.registerSendMessage(message)
@@ -342,7 +342,7 @@ export class RoomService {
title: this.name title: this.name
}); */ }); */
} }
if(this.hasLoadHistory == true) { if(this.hasLoadHistory == true) {
this.messages.push(message) this.messages.push(message)
await message.addMessageDB() await message.addMessageDB()
@@ -350,14 +350,12 @@ export class RoomService {
this.messagesBeforeOfflineAPI.push(message) this.messagesBeforeOfflineAPI.push(message)
} }
if(this.chatOpen == false) { this.messageUnread = true
this.messageUnread = true
}
setTimeout(() => { setTimeout(() => {
this.scrollDown() this.scrollDown()
}, 50) }, 50)
} }
if(ChatMessage?.t == "au" || ChatMessage?.t == "ru" || ChatMessage?.t == "ul") { if(ChatMessage?.t == "au" || ChatMessage?.t == "ru" || ChatMessage?.t == "ul") {
@@ -389,7 +387,7 @@ export class RoomService {
} catch(error) { } catch(error) {
return [] return []
} }
} }
getAllMemberThatIsNotOffline(): string[] { getAllMemberThatIsNotOffline(): string[] {
@@ -432,18 +430,18 @@ export class RoomService {
async deleteMessageToReceive(userId) { async deleteMessageToReceive(userId) {
const allDeleteMessages = await DeleteMessageModel.filter({rid: this.id}).execute() const allDeleteMessages = await DeleteMessageModel.filter({rid: this.id}).execute()
for(let message_ of allDeleteMessages) { for(let message_ of allDeleteMessages) {
if(message_.needToReceiveBy.includes(userId)) { if(message_.needToReceiveBy.includes(userId)) {
message_.needToReceiveBy = message_.needToReceiveBy.filter((e)=> e != userId) message_.needToReceiveBy = message_.needToReceiveBy.filter((e)=> e != userId)
this.sendFalseTypingReadMessage('deleteMessage',{_id:message_.messageId}) this.sendFalseTypingReadMessage('deleteMessage',{_id:message_.messageId})
if(message_.needToReceiveBy.length == 0) { if(message_.needToReceiveBy.length == 0) {
const deleteMessage = await DeleteMessageModel.get({messageId: message_.messageId}) const deleteMessage = await DeleteMessageModel.get({messageId: message_.messageId})
await deleteMessage.delete() await deleteMessage.delete()
@@ -452,10 +450,10 @@ export class RoomService {
} }
} }
} }
} }
async receiveMessageDelete() { async receiveMessageDelete() {
@@ -470,7 +468,7 @@ export class RoomService {
if(message.delate == false) { if(message.delate == false) {
this.deleteMessage(DeletedMessageId) this.deleteMessage(DeletedMessageId)
} }
} }
) )
} }
@@ -480,17 +478,17 @@ export class RoomService {
* @param id message ID * @param id message ID
*/ */
async deleteMessage(_id) { async deleteMessage(_id) {
const id = _id const id = _id
for (let i =0; i <= this.messages.length; i++) { for (let i =0; i <= this.messages.length; i++) {
if(this.messages[i]?._id == id ) { if(this.messages[i]?._id == id ) {
if (SessionStore.user.UserName == this.messages[i]?.u?.username) { if (SessionStore.user.UserName == this.messages[i]?.u?.username) {
const allMemberThatIsOffline = this.getAllMemberThatIsOffline() const allMemberThatIsOffline = this.getAllMemberThatIsOffline()
DeleteMessageModel.create({ DeleteMessageModel.create({
messageId: this.messages[i]._id, messageId: this.messages[i]._id,
rid: this.messages[i].rid, rid: this.messages[i].rid,
@@ -499,7 +497,7 @@ export class RoomService {
needToReceiveBy: allMemberThatIsOffline needToReceiveBy: allMemberThatIsOffline
}) })
} }
this.messages[i]?.delateDB() this.messages[i]?.delateDB()
this.messages.splice(i, 1) this.messages.splice(i, 1)
@@ -516,7 +514,7 @@ export class RoomService {
return true return true
} else { } else {
// //
} }
} }
@@ -532,7 +530,7 @@ export class RoomService {
} }
async delateMessageToSendToOthers(userId) { async delateMessageToSendToOthers(userId) {
const deleteMessage = await DeleteMessageModel.all(); const deleteMessage = await DeleteMessageModel.all();
const toSend = deleteMessage.filter((DeleteMessage:string[])=> ! DeleteMessage.includes(userId)) const toSend = deleteMessage.filter((DeleteMessage:string[])=> ! DeleteMessage.includes(userId))
@@ -546,7 +544,7 @@ export class RoomService {
await message.delateStatusFalse() await message.delateStatusFalse()
if(this.NetworkServiceService.getCurrentNetworkStatus() == ConnectionStatus.Online) { if(this.NetworkServiceService.getCurrentNetworkStatus() == ConnectionStatus.Online) {
this.RochetChatConnectorService.deleteMessage(msgId).then(async() => { this.RochetChatConnectorService.deleteMessage(msgId).then(async() => {
message.delateRequest = true message.delateRequest = true
await message.saveChanges(); await message.saveChanges();
@@ -557,7 +555,7 @@ export class RoomService {
this.RochetChatConnectorService.registerCallback({ this.RochetChatConnectorService.registerCallback({
type: 'reConnect', type: 'reConnect',
funx: async ()=> { funx: async ()=> {
this.sendDeleteRequest(msgId) this.sendDeleteRequest(msgId)
return true return true
} }
@@ -575,7 +573,7 @@ export class RoomService {
if(file && this.message) { if(file && this.message) {
this.send({}) this.send({})
} }
const localReference = uuidv4(); const localReference = uuidv4();
let offlineChatMessage = { let offlineChatMessage = {
@@ -593,20 +591,20 @@ export class RoomService {
console.log('offlineChatMessage', offlineChatMessage) console.log('offlineChatMessage', offlineChatMessage)
this.message= '' this.message= ''
const message: MessageService = await this.prepareCreate({message:offlineChatMessage, save: environment.chatOffline}) const message: MessageService = await this.prepareCreate({message:offlineChatMessage, save: environment.chatOffline})
this.registerSendMessage(message) this.registerSendMessage(message)
if(this.hasLoadHistory == true) { if(this.hasLoadHistory == true) {
await message.addMessageDB() await message.addMessageDB()
} }
message.send() message.send()
message.from = 'send' message.from = 'send'
message.loadHistory = this.hasLoadHistory message.loadHistory = this.hasLoadHistory
if (environment.chatOffline) { if (environment.chatOffline) {
setTimeout(() => { setTimeout(() => {
this.scrollDown() this.scrollDown()
}, 150) }, 150)
@@ -708,17 +706,68 @@ export class RoomService {
} }
sortArrayISODate(messages: any): any[] {
return messages.sort((a,b) =>
new Date(b._updatedAt ).getTime()
-
new Date(a._updatedAt).getTime())
}
restoreOnce = false restoreOnce = false
labelDates = []
goshPush(ChatMessage) {
let currentDateMessage = new Date(ChatMessage._updatedAt).toLocaleDateString()
if(currentDateMessage) {
if(!this.labelDates.find( e => e == currentDateMessage)) {
this.labelDates.push(currentDateMessage)
const newMessage = this.fix_updatedAt({...ChatMessage})
newMessage.msg = currentDateMessage
const cloneMessage = new MessageServiceDateLabel()
cloneMessage.ChatSystemService = this.ChatSystemService
cloneMessage.setData({...newMessage} as any)
//
cloneMessage._id = ""
cloneMessage._updatedAt = ""
cloneMessage.msg = currentDateMessage
cloneMessage.dateLabel = true
cloneMessage.delate = false
if(new Date().toLocaleDateString() == currentDateMessage) {
cloneMessage.msg = "hoje"
} else {
cloneMessage.msg = currentDateMessage
}
this.messages.push(cloneMessage as any)
console.log(currentDateMessage)
}
}
}
async restoreMessageFromDB() { async restoreMessageFromDB() {
if(environment.chatOffline && this.restoreOnce == false) { if(environment.chatOffline && this.restoreOnce == false) {
this.restoreOnce = true this.restoreOnce = true
const messages = await MessageModel.filter({rid:this.id}).execute() const messages = this.sortArrayISODate(await MessageModel.filter({rid:this.id}).execute()).reverse()
console.log('MessageModel', messages) console.log('MessageModel', messages)
for (let ChatMessage of messages) { for (let ChatMessage of messages) {
this.goshPush(ChatMessage)
const wewMessage = await this.simplePrepareMessage(ChatMessage) const wewMessage = await this.simplePrepareMessage(ChatMessage)
wewMessage.from = 'Offline' wewMessage.from = 'Offline'
wewMessage.loadHistory = this.hasLoadHistory wewMessage.loadHistory = this.hasLoadHistory
@@ -731,9 +780,9 @@ export class RoomService {
message.loadHistory = this.hasLoadHistory message.loadHistory = this.hasLoadHistory
wewMessage.messageModelInstance = ChatMessage wewMessage.messageModelInstance = ChatMessage
message?.decryptMessage() message?.decryptMessage()
} else { } else {
const offlineMessage = await this.prepareCreate({message:ChatMessage}) const offlineMessage = await this.prepareCreate({message:ChatMessage})
offlineMessage.from = 'Offline' offlineMessage.from = 'Offline'
@@ -751,10 +800,10 @@ export class RoomService {
} }
if(!this.lastMessage) { if(!this.lastMessage) {
this.lastMessage = messages.pop(); this.lastMessage = messages.pop();
} }
setTimeout(() => { setTimeout(() => {
this.scrollDown() this.scrollDown()
}, 50) }, 50)
@@ -790,7 +839,7 @@ export class RoomService {
messagesToSave.received = users.map((user) => user._id) messagesToSave.received = users.map((user) => user._id)
messagesToSave.addMessageDB() messagesToSave.addMessageDB()
} }
} }
@@ -799,7 +848,10 @@ export class RoomService {
if(messagesToSave != null) { if(messagesToSave != null) {
messagesToSave.received = users.map((user) => user._id) messagesToSave.received = users.map((user) => user._id)
messagesToSave.addMessageDB()
this.goshPush(messagesToSave)
this.addMessageDB.push(messagesToSave)
} }
} }
this.messagesBeforeOfflineAPI = [] this.messagesBeforeOfflineAPI = []
@@ -807,11 +859,11 @@ export class RoomService {
setTimeout(() => { setTimeout(() => {
this.scrollDown() this.scrollDown()
}, 50) }, 50)
} }
if(chatHistory?.result?.messages) { if(chatHistory?.result?.messages) {
if(!this.lastMessage) { if(!this.lastMessage) {
this.lastMessage = chatHistory?.result?.messages.pop() as any this.lastMessage = chatHistory?.result?.messages.pop() as any
} }
@@ -820,6 +872,13 @@ export class RoomService {
} }
addMessageDB = FIFOProcessQueue(async ({messagesToSave}, callback) => {
await messagesToSave.addMessageDB()
callback()
})
async readAllMessage() { async readAllMessage() {
this.ViewedMessageService.requestReadAll(this) this.ViewedMessageService.requestReadAll(this)
@@ -856,11 +915,11 @@ export class RoomService {
const wewMessage = new MessageService(this.NfService, this.RochetChatConnectorService, this.ChatMethodsService, this.AESEncrypt, this.AttachmentsService, this.NetworkServiceService, this.ChatSystemService,this.notificationService) const wewMessage = new MessageService(this.NfService, this.RochetChatConnectorService, this.ChatMethodsService, this.AESEncrypt, this.AttachmentsService, this.NetworkServiceService, this.ChatSystemService,this.notificationService)
wewMessage.setData(message) wewMessage.setData(message)
wewMessage.loadHistory = this.hasLoadHistory wewMessage.loadHistory = this.hasLoadHistory
if(save) { if(save) {
this.messages.push(wewMessage) this.messages.push(wewMessage)
} }
return wewMessage return wewMessage
} }
@@ -881,7 +940,7 @@ export class RoomService {
return true return true
} }
} }
return false return false
} }
@@ -897,7 +956,7 @@ export class RoomService {
private async findMessageInDBByLocalReference({localReference}) { private async findMessageInDBByLocalReference({localReference}) {
const a = await MessageModel.get({localReference: localReference}) const a = await MessageModel.get({localReference: localReference})
return typeof a.id == 'number' return typeof a.id == 'number'
} }
@@ -907,7 +966,7 @@ export class RoomService {
} }
private async findMessageInDBByData({localReference, _id}) { private async findMessageInDBByData({localReference, _id}) {
const a = await MessageModel.filter({localReference: localReference}).execute() const a = await MessageModel.filter({localReference: localReference}).execute()
if(a.length >= 1) { if(a.length >= 1) {
@@ -976,7 +1035,7 @@ export class RoomService {
} }
async addContacts(userId:any) { async addContacts(userId:any) {
let body = { let body = {
"roomId": this.id, "roomId": this.id,
"userId": userId, "userId": userId,
@@ -988,12 +1047,12 @@ export class RoomService {
async updateContacts() { async updateContacts() {
let res let res
let error = false let error = false
if(this.t == 'd') { if(this.t == 'd') {
try { try {
res = await this.chatService.getMembers(this.id).toPromise(); res = await this.chatService.getMembers(this.id).toPromise();
} catch (e) { } catch (e) {
@@ -1035,7 +1094,7 @@ export class RoomService {
if(error) { if(error) {
res = await this.chatService.getChannelMembers(this.id).toPromise() res = await this.chatService.getChannelMembers(this.id).toPromise()
} }
} }
} }
@@ -42,14 +42,14 @@
</div> </div>
<div class="messages-list-item-wrapper container-width-100" *ngFor="let msg of ChatSystemService.getGroupRoom(roomId).messages; let last = last"> <div class="messages-list-item-wrapper container-width-100" *ngFor="let msg of ChatSystemService.getGroupRoom(roomId).messages; let last = last">
<div class="message-item incoming-{{msg.u.username!=sessionStore.user.UserName}} max-width-45" *ngIf="msg.t != 'r' && msg.t != 'ul' && msg.t != 'au' && msg.t != 'ru' && msg.msg !=''" > <div class="message-item incoming-{{msg.u.username!=sessionStore.user.UserName}} max-width-45" *ngIf="msg.t != 'r' && msg.t != 'ul' && msg.t != 'au' && msg.t != 'ru' && msg.msg !=''" [class.dateLabel]="msg.dateLabel">
<div class="message-item-options d-flex justify-content-end"> <div class="message-item-options d-flex justify-content-end" *ngIf="!msg.dateLabel">
<fa-icon [matMenuTriggerFor]="beforeMenu" icon="chevron-down" class="message-options-icon cursor-pointer"></fa-icon> <fa-icon [matMenuTriggerFor]="beforeMenu" icon="chevron-down" class="message-options-icon cursor-pointer"></fa-icon>
<mat-menu #beforeMenu="matMenu" xPosition="before"> <mat-menu #beforeMenu="matMenu" xPosition="before">
<button (click)="deleteMessage(msg._id)" class="menuButton">Apagar mensagem</button> <button (click)="deleteMessage(msg._id)" class="menuButton">Apagar mensagem</button>
</mat-menu> </mat-menu>
</div> </div>
<div class="title d-flex"> <div class="title d-flex" *ngIf="!msg.dateLabel">
<ion-label>{{msg.u.name}}</ion-label> <ion-label>{{msg.u.name}}</ion-label>
<span class="time">{{msg.duration}}</span> <span class="time">{{msg.duration}}</span>
</div> </div>
@@ -61,7 +61,7 @@
<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> -->
<!-- <ion-icon *ngIf="msg.viewed.length >= 1" src="assets/images/check-double-solid -viewed.svg"></ion-icon> --> <!-- <ion-icon *ngIf="msg.viewed.length >= 1" src="assets/images/check-double-solid -viewed.svg"></ion-icon> -->
<span class="lido pl-10" *ngIf="msg.viewed.length >= 1" > Lido</span> <span class="lido pl-10" *ngIf="msg.viewed.length >= 1" > Lido</span>
@@ -107,7 +107,7 @@
<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> -->
<!-- <ion-icon *ngIf="msg.viewed.length >= 1" src="assets/images/check-double-solid -viewed.svg"></ion-icon> --> <!-- <ion-icon *ngIf="msg.viewed.length >= 1" src="assets/images/check-double-solid -viewed.svg"></ion-icon> -->
<span class="lido pl-10" *ngIf="msg.viewed.length >= 1" >Lido</span> <span class="lido pl-10" *ngIf="msg.viewed.length >= 1" >Lido</span>
@@ -120,7 +120,7 @@
<div (click)="openPreview(msg)" class="file-details add-ellipsis cursor-pointer" *ngIf="msg.file"> <div (click)="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" class="file-icon"></ion-icon>
<ion-icon *ngIf="msg.attachments[0].type == 'webtrix'" src="assets/icon/webtrix.svg" 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>
@@ -164,7 +164,7 @@
<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> -->
<!-- <ion-icon *ngIf="msg.viewed.length >= 1" src="assets/images/check-double-solid -viewed.svg"></ion-icon> --> <!-- <ion-icon *ngIf="msg.viewed.length >= 1" src="assets/images/check-double-solid -viewed.svg"></ion-icon> -->
<span class="lido pl-10" *ngIf="msg.viewed.length >= 1" > Lido</span> <span class="lido pl-10" *ngIf="msg.viewed.length >= 1" > Lido</span>
@@ -328,4 +328,13 @@
padding: 6px; padding: 6px;
border-radius: 10px; border-radius: 10px;
cursor: pointer; cursor: pointer;
} }
.dateLabel {
background: #ebebeb !important;
float: unset !important;
margin: 0px auto !important;
width: 110px;
text-align: center;
}
+17 -16
View File
@@ -33,21 +33,22 @@
<ion-progress-bar type="indeterminate" *ngIf="showLoader"></ion-progress-bar> <ion-progress-bar type="indeterminate" *ngIf="showLoader"></ion-progress-bar>
<ion-refresher-content> <ion-refresher-content>
</ion-refresher-content> </ion-refresher-content>
</ion-refresher> </ion-refresher>
<div class="messages" #scrollMe> <div class="messages" #scrollMe>
<ion-list> <ion-list>
<div class="messages-list-item-wrapper container-width-100" <div class="messages-list-item-wrapper container-width-100"
*ngFor="let msg of ChatSystemService.getDmRoom(roomId).messages; index as i; let last = last"> *ngFor="let msg of ChatSystemService.getDmRoom(roomId).messages; index as i; let last = last" >
<div class='message-item incoming-{{msg.u.username!=sessionStore.user.UserName}} max-width-45' *ngIf="msg.msg !=''">
<div class="message-item-options d-flex justify-content-end"> <div class='message-item incoming-{{msg.u.username!=sessionStore.user.UserName}} max-width-45' *ngIf="msg.msg !=''" [class.dateLabel]="msg.dateLabel">
<div class="message-item-options d-flex justify-content-end" *ngIf="!msg.dateLabel">
<fa-icon [matMenuTriggerFor]="beforeMenu" icon="chevron-down" class="message-options-icon cursor-pointer"> <fa-icon [matMenuTriggerFor]="beforeMenu" icon="chevron-down" class="message-options-icon cursor-pointer">
</fa-icon> </fa-icon>
<mat-menu #beforeMenu="matMenu" xPosition="before"> <mat-menu #beforeMenu="matMenu" xPosition="before">
<button (click)="deleteMessage(msg._id, msg)" class="menuButton">Apagar mensagem</button> <button (click)="deleteMessage(msg._id, msg)" class="menuButton">Apagar mensagem</button>
</mat-menu> </mat-menu>
</div> </div>
<div class="title d-flex"> <div class="title d-flex" *ngIf="!msg.dateLabel">
<ion-label >{{msg.u.name}}</ion-label> <ion-label >{{msg.u.name}}</ion-label>
<span class="time">{{msg.duration}}</span> <span class="time">{{msg.duration}}</span>
</div> </div>
@@ -57,11 +58,11 @@
<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> -->
<!-- <ion-icon *ngIf="msg.viewed.length >= 1" src="assets/images/check-double-solid -viewed.svg"></ion-icon> --> <!-- <ion-icon *ngIf="msg.viewed.length >= 1" src="assets/images/check-double-solid -viewed.svg"></ion-icon> -->
<span class="lido pl-10" *ngIf="msg.viewed.length >= 1" > Lido</span> <span class="lido pl-10" *ngIf="msg.viewed.length >= 1" > Lido</span>
@@ -102,10 +103,10 @@
</div> </div>
<img *ngIf="msg.attachments[0].image_url" src={{msg.attachments[0].image_url}} alt="image"> <img *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> -->
<!-- <ion-icon *ngIf="msg.viewed.length >= 1" src="assets/images/check-double-solid -viewed.svg"></ion-icon> --> <!-- <ion-icon *ngIf="msg.viewed.length >= 1" src="assets/images/check-double-solid -viewed.svg"></ion-icon> -->
<span class="lido pl-10" *ngIf="msg.viewed.length >= 1" > Lido</span> <span class="lido pl-10" *ngIf="msg.viewed.length >= 1" > Lido</span>
@@ -118,7 +119,7 @@
<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" class="file-icon"></ion-icon>
<ion-icon *ngIf="msg.attachments[0].type == 'webtrix'" src="assets/icon/webtrix.svg" 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>
@@ -130,7 +131,7 @@
</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" class="pdf-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">
@@ -166,13 +167,13 @@
<ion-label *ngIf="msg.file"> <ion-label *ngIf="msg.file">
<span *ngIf="file.description">{{file.description}}</span> <span *ngIf="file.description">{{file.description}}</span>
<span *ngIf="file.description && msg.file.type != 'application/webtrix'"></span> <span *ngIf="file.description && msg.file.type != 'application/webtrix'"></span>
</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> -->
<!-- <ion-icon *ngIf="msg.viewed.length >= 1" src="assets/images/check-double-solid -viewed.svg"></ion-icon> --> <!-- <ion-icon *ngIf="msg.viewed.length >= 1" src="assets/images/check-double-solid -viewed.svg"></ion-icon> -->
<span class="lido pl-10" *ngIf="msg.viewed.length >= 1" > Lido</span> <span class="lido pl-10" *ngIf="msg.viewed.length >= 1" > Lido</span>
@@ -210,7 +211,7 @@
</div> </div>
</ion-list> </ion-list>
</div> </div>
@@ -409,4 +409,13 @@ ion-footer {
.lido, .enviado { .lido, .enviado {
font-size: rem(11); font-size: rem(11);
} }
.dateLabel {
background: #ebebeb !important;
float: unset !important;
margin: 0px auto !important;
width: 110px;
text-align: center;
}
+14 -9
View File
@@ -678,13 +678,13 @@ td.monthview-secondary-with-event, td.monthview-secondary-with-event[_ngcontent-
outline: 0; outline: 0;
} }
.btn-no-color { .btn-no-color {
ion-icon { ion-icon {
font-size: rem(35); font-size: rem(35);
} }
} }
// center // center
app-diploma-assinar ion-content .main-content, app-diploma-assinar ion-content .main-content,
@@ -1159,7 +1159,7 @@ background: rgb(92, 92, 92);
// .mat-select-value { // .mat-select-value {
// display: table-cell; // display: table-cell;
// max-width: unset !important; // max-width: unset !important;
// width: 100% !important; // width: 100% !important;
// /* text-overflow: ellipsis; */ // /* text-overflow: ellipsis; */
// /* white-space: nowrap; */ // /* white-space: nowrap; */
@@ -1477,7 +1477,7 @@ ngx-mat-datetime-content .actions {
position: relative; position: relative;
top: -66px; top: -66px;
margin-bottom: -44px; margin-bottom: -44px;
button { button {
z-index: 11111111; z-index: 11111111;
} }
@@ -1522,7 +1522,7 @@ ion-textarea.heigh-200 textarea {
font-size: rem(12); font-size: rem(12);
color: red; color: red;
} }
.new-task { .new-task {
border-radius: 20px; border-radius: 20px;
background: #efefef; background: #efefef;
@@ -1591,7 +1591,7 @@ ion-textarea.heigh-200 textarea {
app-tiny-mce { app-tiny-mce {
justify-content: flex-start !important; justify-content: flex-start !important;
} }
@@ -1603,11 +1603,11 @@ app-tiny-mce {
@media only screen and (min-width: 100px) { @media only screen and (min-width: 100px) {
html, body, .viewport-font-size { html, body, .viewport-font-size {
font-size: 14px; font-size: 14px;
} }
} }
@media only screen and (min-width: 500px) { @media only screen and (min-width: 500px) {
@@ -1654,3 +1654,8 @@ h5, .buttons{
.lowercase { .lowercase {
text-transform: lowercase; text-transform: lowercase;
} }
.welcome-text {
margin-bottom: 15px;
}