diff --git a/src/app/home/home.page.html b/src/app/home/home.page.html index eaeeb0def..13403de01 100644 --- a/src/app/home/home.page.html +++ b/src/app/home/home.page.html @@ -1,6 +1,6 @@ - - + + diff --git a/src/app/models/user.model.ts b/src/app/models/user.model.ts index bdb400bda..24f420637 100644 --- a/src/app/models/user.model.ts +++ b/src/app/models/user.model.ts @@ -40,6 +40,7 @@ export class UserSession { Authorization: string; Email: string FullName: string + ManagerName: string OwnerCalendars: { CalendarId: string CalendarName: "Oficial" | "Pessoal"; diff --git a/src/app/pages/chat/messages/messages.page.ts b/src/app/pages/chat/messages/messages.page.ts index eaca74db8..d9ffdb793 100644 --- a/src/app/pages/chat/messages/messages.page.ts +++ b/src/app/pages/chat/messages/messages.page.ts @@ -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'; @@ -135,13 +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 alertController: AlertController, - private document: DocumentViewer + // private document: DocumentViewer ) { this.loggedUser = authService.ValidatedUserChat['data']; this.roomId = this.navParams.get('roomId'); @@ -151,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({})); @@ -989,27 +986,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 { diff --git a/src/app/pages/login/login.page.ts b/src/app/pages/login/login.page.ts index a89589370..4ed0d7480 100644 --- a/src/app/pages/login/login.page.ts +++ b/src/app/pages/login/login.page.ts @@ -113,7 +113,6 @@ export class LoginPage implements OnInit { if(this.p.userPermission(this.permissionList.Chat.access)){ - alert('RC IN') await this.authService.loginChat(); await this.authService.loginToChatWs(); } diff --git a/src/app/shared/chat/group-messages/group-messages.module.ts b/src/app/shared/chat/group-messages/group-messages.module.ts index bdbe70cc8..929170a0d 100644 --- a/src/app/shared/chat/group-messages/group-messages.module.ts +++ b/src/app/shared/chat/group-messages/group-messages.module.ts @@ -15,6 +15,7 @@ import { FontAwesomeModule } from '@fortawesome/angular-fontawesome'; import {MatMenuModule} from '@angular/material/menu'; import { LettersAvatarModule } from "ngx-letters-avatar"; import { PipesModule } from 'src/app/pipes/pipes.module'; +import { SafehtmlPipe } from 'src/app/pipes/safehtml.pipe'; @NgModule({ imports: [ @@ -33,4 +34,4 @@ import { PipesModule } from 'src/app/pipes/pipes.module'; schemas: [CUSTOM_ELEMENTS_SCHEMA], declarations: [GroupMessagesPage] }) -export class GroupMessagesPageModule {} +export class GroupMessagesPageModule {} \ No newline at end of file diff --git a/src/app/shared/chat/group-messages/group-messages.page.ts b/src/app/shared/chat/group-messages/group-messages.page.ts index 6e1af03a9..d3e9dab13 100644 --- a/src/app/shared/chat/group-messages/group-messages.page.ts +++ b/src/app/shared/chat/group-messages/group-messages.page.ts @@ -300,49 +300,25 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe } - async checkAudioPermission() { - const permissionStatus = await navigator.permissions.query({ name: 'microphone' } as any) - - console.log('permission', permissionStatus.state); // granted, denied, prompt - - this.audioPermissionStatus = permissionStatus.state - - permissionStatus.onchange = (data : any) => { - // console.log("Permission changed to " + data.state); - // console.log('permission', permissionStatus.state); // granted, denied, prompt - } - - } - async startRecording() { - - await this.checkAudioPermission(); - - if(this.audioPermissionStatus == 'granted') { - if (this.recording) { - return; - } - - this.recording = true; - VoiceRecorder.startRecording(); - this.calculateDuration(); - } else { - - const alertPopup = await this.alertController.create({ - cssClass: 'my-custom-class', - header: 'Necessita de permissão para gravar áudio', - buttons: [{ - text: 'Ok', - handler: () => { - + if(await VoiceRecorder.canDeviceVoiceRecord().then((result: GenericResponse) =>{return result.value})){ + if(await VoiceRecorder.requestAudioRecordingPermission().then((result: GenericResponse) => {return result.value})){ + //if(await this.hasAudioRecordingPermission()){ + if (this.recording) { + return; } - }] - }); - - await alertPopup.present(); - + this.recording = true; + VoiceRecorder.startRecording(); + this.calculateDuration(); + //} + } + else{ + this.toastService._badRequest('Para gravar uma mensagem de voz, permita o acesso do Gabinete Digital ao seu microfone.'); + } + } + else{ + this.toastService._badRequest('Este dispositivo não tem capacidade para gravação de áudio!'); } - } stopRecording() { @@ -924,7 +900,7 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe const formData = new FormData(); formData.append("blobFile", blob); - this.wsChatMethodsService.getDmRoom(roomId).send({ + this.wsChatMethodsService.getGroupRoom(roomId).send({ file: { "type": file.type, "guid": '', diff --git a/src/app/shared/chat/messages/messages.module.ts b/src/app/shared/chat/messages/messages.module.ts index 574c55e8a..6cec6a4e2 100644 --- a/src/app/shared/chat/messages/messages.module.ts +++ b/src/app/shared/chat/messages/messages.module.ts @@ -13,6 +13,7 @@ import { MatButtonModule } from '@angular/material/button'; import {MatMenuModule} from '@angular/material/menu'; import { LettersAvatarModule } from "ngx-letters-avatar"; import { PipesModule } from 'src/app/pipes/pipes.module'; +import { SafehtmlPipe } from 'src/app/pipes/safehtml.pipe'; @NgModule({ imports: [ @@ -25,9 +26,8 @@ import { PipesModule } from 'src/app/pipes/pipes.module'; MatMenuModule, LettersAvatarModule, PipesModule, - ], exports: [MessagesPage], declarations: [MessagesPage] }) -export class MessagesPageModule {} +export class MessagesPageModule {} \ No newline at end of file diff --git a/src/app/shared/header/header.page.html b/src/app/shared/header/header.page.html index 06d76d173..093146e7d 100644 --- a/src/app/shared/header/header.page.html +++ b/src/app/shared/header/header.page.html @@ -64,7 +64,7 @@ -
+
diff --git a/src/app/store/session.service.ts b/src/app/store/session.service.ts index a32b647d9..eff78096c 100644 --- a/src/app/store/session.service.ts +++ b/src/app/store/session.service.ts @@ -109,7 +109,7 @@ class SessionService { get getManagerInitials() { - let names = this._user.FullName.split(' ') || ' ', + let names = this._user.ManagerName.split(' ') || ' ', initials = names[0].substring(0, 1).toUpperCase(); if (names.length > 1) { initials += names[names.length - 1].substring(0, 1).toUpperCase();