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

This commit is contained in:
Peter Maquiran
2022-02-08 17:44:31 +01:00
12 changed files with 93 additions and 44 deletions
+44 -1
View File
@@ -38,6 +38,7 @@ import { FileType } from 'src/app/models/fileType';
import { SearchPage } from 'src/app/pages/search/search.page';
import { Storage } from '@ionic/storage';
import { FileToBase64Service } from 'src/app/services/file/file-to-base64.service';
import { Camera, CameraResultType, CameraSource } from '@capacitor/camera';
const IMAGE_DIR = 'stored-images';
@@ -551,6 +552,10 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
})
}
async addImageMobile() {
this.addFileToChatMobile(['image/apng', 'image/jpeg', 'image/png'])
}
async addImage() {
this.addFileToChat(['image/apng', 'image/jpeg', 'image/png'])
@@ -604,13 +609,51 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
});
}
async addFileToChatMobile(types: typeof FileType[] ) {
const roomId = this.roomId
const file = await Camera.getPhoto({
quality: 90,
// allowEditing: true,
resultType: CameraResultType.Base64,
source: CameraSource.Photos
});
console.log('ADDFILECHAT', file)
//const imageData = await this.fileToBase64Service.convert(file)
//console.log('ADDFILECHAT', imageData)
const response = await fetch('data:image/jpeg;base64,'+ file.base64String!);
const blob = await response.blob();
const formData = new FormData();
formData.append("blobFile", blob);
this.wsChatMethodsService.getDmRoom(roomId).send({
file: {
"type": "application/img",
"guid": '',
"image_url": 'data:image/jpeg;base64,' +file.base64String
},
temporaryData: formData,
attachments: [{
"title": file.path ,
"image_url": 'data:image/jpeg;base64,' +file.base64String,
"text": "description",
"title_link_download": false,
}]
})
}
async addFileToChat(types: typeof FileType[] ) {
const roomId = this.roomId
const file: any = await this.fileService.getFileFromDevice(types);
console.log('ADDFILECHAT', file)
const imageData = await this.fileToBase64Service.convert(file)
console.log('ADDFILECHAT', imageData)
const formData = new FormData();
formData.append("blobFile", file);
@@ -656,7 +699,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
this.takePicture()
}
else if (res['data'] == 'add-picture') {
this.addImage()
this.addImageMobile()
}
else if (res['data'] == 'add-document') {
this.addFile()
@@ -261,7 +261,6 @@ export class BookMeetingModalPage implements OnInit {
}
if(this.task.FsId == '8') {
alert('Chegou')
const loader = this.toastService.loading()
try {
switch (this.loggeduser.Profile) {
+10 -10
View File
@@ -36,11 +36,11 @@ export class InactivityPage implements OnInit {
loop = false
ngOnInit() {
// window.addEventListener('resize', (event) => {
// if(this.router.url != '/login') return false
// if(this.loop == false) {
// this.loop = true
// this.runloop()
@@ -54,7 +54,7 @@ export class InactivityPage implements OnInit {
// const containerHeight = 651
// let circleHeight = document.querySelector('.circle')['offsetHeight']
// let circleWidth = document.querySelector('.circle')['offsetWidth']
// let circleWidth = document.querySelector('.circle')['offsetWidth']
// console.log(window.innerHeight, ' < ', containerHeight)
// console.log(circleHeight)
@@ -64,7 +64,7 @@ export class InactivityPage implements OnInit {
// e['style']['width'] = (circleWidth -1 )+'px'
// })
// if( window.innerHeight< containerHeight) {
// setTimeout(()=>{
// this.runloop()
@@ -114,14 +114,14 @@ export class InactivityPage implements OnInit {
let attempt = await this.authService.login(this.userattempt, {saveSession: false})
if (attempt) {
// if current attemp is equal to the current user
if (attempt.UserId == SessionStore.user.UserId) {
await this.authService.SetSession(attempt, this.userattempt);
this.authService.loginChat(this.userattempt);
this.authService.loginChat();
this.getToken();
SessionStore.setInativity(true)
this.goback()
} else {
SessionStore.delete()
@@ -174,10 +174,10 @@ export class InactivityPage implements OnInit {
const code = this.code.join('')
if( SessionStore.validatePin(code)) {
SessionStore.setInativity(true)
this.goback()
setTimeout(()=>{
this.clearCode()
}, 1000)
@@ -196,7 +196,7 @@ export class InactivityPage implements OnInit {
} else {
this.router.navigate(['/home/events'], {replaceUrl: true});
}
}
storePin() {
+2 -3
View File
@@ -100,10 +100,9 @@ export class LoginPage implements OnInit {
// login to API successfully
if (attempt) {
if (attempt.UserId == SessionStore.user.UserId) {
await this.authService.SetSession(attempt, this.userattempt);
await this.authService.loginChat(this.userattempt);
await this.authService.loginChat();
this.getToken();
SessionStore.setInativity(true);
@@ -117,7 +116,7 @@ export class LoginPage implements OnInit {
await this.authService.SetSession(attempt, this.userattempt);
this.changeProfileService.run()
await this.authService.loginChat(this.userattempt);
await this.authService.loginChat();
this.getToken();
this.router.navigateByUrl('/pin', { replaceUrl: true });
}