Merge branch 'developer' of bitbucket.org:equilibriumito/gabinete-digital into developer

This commit is contained in:
tiago.kayaya
2022-04-07 15:44:31 +01:00
41 changed files with 1417 additions and 345 deletions
@@ -65,6 +65,14 @@
<div class="message">
<ion-label *ngIf="msg.delate == false">{{msg.msg}}</ion-label>
<ion-label *ngIf="msg.delate == true">{{msg.msg}}</ion-label>
<ion-label class="float-status-all float-status" >
<ion-icon *ngIf="msg.messageSend == false" src="assets/images/clock-regular.svg"></ion-icon>
<ion-icon *ngIf="msg.messageSend == true && msg.received.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.viewed.length >= 1" src="assets/images/check-double-solid -viewed.svg"></ion-icon>
</ion-label>
{{last ? scrollToBottom() : ''}}
</div>
</div>
@@ -108,6 +116,12 @@
<div *ngIf="msg.file.type == 'application/img' && msg.attachments[0].image_url" (click)="openPreview(msg)">
<img *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-label class="float-status-all float-status" >
<ion-icon *ngIf="msg.messageSend == false" src="assets/images/clock-regular.svg"></ion-icon>
<ion-icon *ngIf="msg.messageSend == true && msg.received.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.viewed.length >= 1" src="assets/images/check-double-solid -viewed.svg"></ion-icon>
</ion-label>
</div>
<div *ngIf="msg.file.type != 'application/img'">
<div class="file add-attachment-bg-color" *ngIf="msg.file.type != 'application/audio'">
@@ -115,6 +129,7 @@
<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/word'" icon="file-word" class="word-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/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>
@@ -138,6 +153,13 @@
<span *ngIf="file.description && msg.file.type != 'application/webtrix'"></span>
<span *ngIf="msg.file.type != 'application/webtrix' && msg.file.type != 'application/audio'">{{msg.displayType}}</span>
</ion-label>
<ion-label class="float-status-all float-status" >
<ion-icon *ngIf="msg.messageSend == false" src="assets/images/clock-regular.svg"></ion-icon>
<ion-icon *ngIf="msg.messageSend == true && msg.received.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.viewed.length >= 1" src="assets/images/check-double-solid -viewed.svg"></ion-icon>
</ion-label>
</div>
</div>
</div>
@@ -359,3 +359,31 @@
.typing ngx-letters-avatar {
padding-right: 5px;
}
.float-status{
position: relative !important;
float: right;
display: flex;
align-items: self-end;
}
.float-status-image{
position: relative !important;
float: right;
display: flex;
align-items: self-end;
top: -15px;
}
.float-status-webtrix {
position: relative !important;
top: 0px !important;
float: right;
display: flex;
align-items: self-end;
}
.float-status-all {
font-size: 10pt !important;
}
@@ -36,6 +36,7 @@ import { VoiceRecorder, VoiceRecorderPlugin, RecordingData, GenericResponse, Cur
import { Filesystem, Directory, Encoding } from '@capacitor/filesystem';
import { DomSanitizer } from '@angular/platform-browser';
import { MessageService } from 'src/app/services/chat/message.service';
import { AlertController } from '@ionic/angular';
import { File } from '@awesome-cordova-plugins/file/ngx';
import { FileOpener } from '@awesome-cordova-plugins/file-opener/ngx';
@@ -87,6 +88,7 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
durationDisplay = '';
duration = 0;
showAvatar = true;
audioPermissionStatus: 'granted'| 'denied' | 'prompt' | null = null
constructor(
private menu: MenuController,
@@ -113,6 +115,7 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
private processesService: ProcessesService,
private CameraService: CameraService,
private sanitiser: DomSanitizer,
private alertController: AlertController,
private file: File,
private fileOpener: FileOpener,
) {
@@ -165,9 +168,9 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
message: '',
status: status,
}
this.chatService.setUserStatus(body).subscribe(res => {
console.log(res);
})
// this.chatService.setUserStatus(body).subscribe(res => {
// console.log(res);
// })
}
deleteMessage(msgId: string) {
@@ -374,15 +377,15 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
getRoomInfo() {
this.showLoader = true;
this.chatService.getRoomInfo(this.roomId).subscribe(room => {
this.room = room['room'];
this.roomName = this.room.name.split('-').join(' ');
if (this.room.customFields.countDownDate) {
this.roomCountDownDate = this.timeService.countDownDateTimer(this.room.customFields.countDownDate, this.room._id);
}
this.getGroupContacts(this.room);
this.showLoader = false;
});
// this.chatService.getRoomInfo(this.roomId).subscribe(room => {
// this.room = room['room'];
// this.roomName = this.room.name.split('-').join(' ');
// if (this.room.customFields.countDownDate) {
// this.roomCountDownDate = this.timeService.countDownDateTimer(this.room.customFields.countDownDate, this.room._id);
// }
// this.getGroupContacts(this.room);
// this.showLoader = false;
// });
}
async getChatMembers() {
+22 -7
View File
@@ -46,11 +46,6 @@
<ion-content>
<!-- <ion-refresher name="refresher" slot="fixed" (ionRefresh)="doRefresh($event)">
<ion-progress-bar type="indeterminate" *ngIf="showLoader"></ion-progress-bar>
<ion-refresher-content>
</ion-refresher-content>
</ion-refresher> -->
<div (click)="handleClick()" class="messages" #scrollMe>
<div class="messages-list-item-wrapper container-width-100"
*ngFor="let msg of wsChatMethodsService.getDmRoom(this.roomId).messages; let last = last"
@@ -62,8 +57,13 @@
<span class="time">{{msg.duration}}</span>
</div>
<div>
<ion-label *ngIf="msg.delate == false">{{msg.msg}}</ion-label>
<ion-label *ngIf="msg.delate == true">{{msg.msg}}</ion-label>
<ion-label class="float-status-all float-status" >
<ion-icon *ngIf="msg.messageSend == false" src="assets/images/clock-regular.svg"></ion-icon>
<ion-icon *ngIf="msg.messageSend == true && msg.received.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.viewed.length >= 1" src="assets/images/check-double-solid -viewed.svg"></ion-icon>
</ion-label>
{{last ? scrollToBottom() : ''}}
</div>
</div>
@@ -80,6 +80,12 @@
<div *ngFor="let file of msg.attachments let i = index">
<div *ngIf="msg.file.type == 'application/img'" (click)="openPreview(msg)">
<img *ngIf="msg.attachments[0].image_url" src="{{msg.attachments[0].image_url}}" alt="image">
<ion-label class="float-status-all float-status" >
<ion-icon *ngIf="msg.messageSend == false" src="assets/images/clock-regular.svg"></ion-icon>
<ion-icon *ngIf="msg.messageSend == true && msg.received.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.viewed.length >= 1" src="assets/images/check-double-solid -viewed.svg"></ion-icon>
</ion-label>
<ion-icon *ngIf="msg.attachments[0].image_url == null" name="download-outline"></ion-icon>
</div>
<div *ngIf="msg.file.type != 'application/img'">
@@ -118,6 +124,15 @@
<span
*ngIf="msg.file.type != 'application/webtrix' && msg.file.type != 'application/audio'">{{msg.displayType}}</span>
</ion-label>
<ion-label class="float-status-all float-status" >
<ion-icon *ngIf="msg.messageSend == false" src="assets/images/clock-regular.svg"></ion-icon>
<ion-icon *ngIf="msg.messageSend == true && msg.received.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.viewed.length >= 1" src="assets/images/check-double-solid -viewed.svg"></ion-icon>
</ion-label>
</div>
</div>
</div>
@@ -328,3 +328,31 @@ button::-moz-focus-inner {
padding: 0px;
border: 0px;
}
.float-status{
position: relative !important;
float: right;
display: flex;
align-items: self-end;
}
.float-status-image{
position: relative !important;
float: right;
display: flex;
align-items: self-end;
top: -15px;
}
.float-status-webtrix {
position: relative !important;
top: 0px !important;
float: right;
display: flex;
align-items: self-end;
}
.float-status-all {
font-size: 10pt !important;
}
+29 -28
View File
@@ -1,6 +1,6 @@
import { AfterViewChecked, AfterViewInit, ChangeDetectorRef, Component, ElementRef, OnDestroy, OnInit, ViewChild } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router'
import { GestureController, Gesture, ModalController, NavParams, PopoverController, Platform } from '@ionic/angular';
import { GestureController, Gesture, ModalController, NavParams, PopoverController, Platform, AlertController } from '@ionic/angular';
import { map } from 'rxjs/operators';
import { ViewDocumentPage } from 'src/app/modals/view-document/view-document.page';
import { EventPerson } from 'src/app/models/eventperson.model';
@@ -41,7 +41,6 @@ import { Storage } from '@ionic/storage';
import { FileToBase64Service } from 'src/app/services/file/file-to-base64.service';
import { Camera, CameraResultType, CameraSource } from '@capacitor/camera';
import { Plugins, Capacitor } from '@capacitor/core';
import { MultipleDocumentsPicker } from '@awesome-cordova-plugins/multiple-document-picker/ngx';
import { DomSanitizer } from '@angular/platform-browser';
import { StringDecoder } from 'string_decoder';
import { File } from '@awesome-cordova-plugins/file/ngx';
@@ -109,6 +108,8 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
base64File: string;
downloadProgess: number;
audioPermissionStatus: 'granted'| 'denied' | 'prompt' | null = null
constructor(
public popoverController: PopoverController,
private modalController: ModalController,
@@ -133,12 +134,11 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
private processesService: ProcessesService,
private storage: Storage,
private fileToBase64Service: FileToBase64Service,
private multipleDocumentsPicker: MultipleDocumentsPicker,
private sant: DomSanitizer,
private file: File,
private fileOpener: FileOpener,
//private fileOpener: FileOpener,
private sanitiser: DomSanitizer,
private document: DocumentViewer
private alertController: AlertController,
// private document: DocumentViewer
) {
this.loggedUser = authService.ValidatedUserChat['data'];
this.roomId = this.navParams.get('roomId');
@@ -148,7 +148,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
if (window.innerWidth > 701) {
this.modalController.dismiss();
}
};
}
console.log(this.wsChatMethodsService.getDmRoom(this.roomId).loadHistory({}));
@@ -160,6 +160,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
this.scrollToBottomClicked()
}, 150)
}
ngOnInit() {
@@ -956,27 +957,27 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
}
openFile(pdfString, filename, type) {
const blob = this.b64toBlob(pdfString, type)
let pathFile = ''
const fileName = filename
const contentFile = blob
if (this.platform.is('ios')) {
pathFile = this.file.documentsDirectory
} else {
pathFile = this.file.externalRootDirectory
}
console.log(pdfString)
console.log(pathFile)
console.log(contentFile)
this.file
.writeFile(pathFile, fileName, contentFile, { replace: true })
.then(success => {
this.fileOpener
.open(pathFile + fileName, type)
.then(() => console.log('File is opened'))
.catch(e => console.log('Error opening file', e));
})
.catch(e => console.log('Error writing file', e))
// const blob = this.b64toBlob(pdfString, type)
// let pathFile = ''
// const fileName = filename
// const contentFile = blob
// if (this.platform.is('ios')) {
// pathFile = this.file.documentsDirectory
// } else {
// pathFile = this.file.externalRootDirectory
// }
// console.log(pdfString)
// console.log(pathFile)
// console.log(contentFile)
// this.file
// .writeFile(pathFile, fileName, contentFile, { replace: true })
// .then(success => {
// this.fileOpener
// .open(pathFile + fileName, type)
// .then(() => console.log('File is opened'))
// .catch(e => console.log('Error opening file', e));
// })
// .catch(e => console.log('Error writing file', e))
}
downloadFileFromBrowser(fileName: string, data: any): void {