This commit is contained in:
Peter Maquiran
2023-08-29 16:45:29 +01:00
39 changed files with 606 additions and 105 deletions
@@ -252,7 +252,7 @@
<div class="list-people flex-grow-1">
<ion-item lines="none">
<ion-list>
<ion-label *ngIf="taskParticipants?.length < 1" class="list-people-title">Adicionar intervenientes*</ion-label>
<ion-label *ngIf="taskParticipants?.length < 1" class="list-people-title">Adicionar Participantes*</ion-label>
<ion-label *ngFor="let participant of taskParticipants">{{participant.Name}}</ion-label>
</ion-list>
</ion-item>
@@ -275,7 +275,7 @@
<div class="list-people flex-grow-1">
<ion-item lines="none">
<ion-list>
<ion-label *ngIf="taskParticipantsCc?.length < 1" class="list-people-title">Adicionar intervenientes*</ion-label>
<ion-label *ngIf="taskParticipantsCc?.length < 1" class="list-people-title">Adicionar Participantes*</ion-label>
<ion-label *ngFor="let participant of taskParticipantsCc">{{participant.Name}}</ion-label>
</ion-list>
</ion-item>
@@ -209,7 +209,7 @@
<div class="list-people">
<ion-item lines="none">
<ion-list>
<ion-label *ngIf="taskParticipants?.length < 1" class="list-people-title">Adicionar intervenientes*</ion-label>
<ion-label *ngIf="taskParticipants?.length < 1" class="list-people-title">Adicionar Participantes*</ion-label>
<ion-label *ngFor="let participant of taskParticipants">{{participant.Name}}</ion-label>
</ion-list>
</ion-item>
@@ -69,7 +69,7 @@
<div class="line"></div>
<div class="middle-content">
<div *ngIf="loadedEvent.Attendees">
<h5 class="font-17-rem">Intervenientes</h5>
<h5 class="font-17-rem">Participantes</h5>
<ion-item class="ion-no-margin ion-no-padding">
<ion-label>
<div *ngFor="let attendee of loadedEvent.Attendees">
@@ -647,7 +647,18 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
source: CameraSource.Camera
});
const imageBase64 = 'data:image/jpeg;base64,' + file.base64String
var imageBase64 = 'data:image/jpeg;base64,' + file.base64String
const compressedImage = await this.compressImageBase64(
imageBase64,
800, // maxWidth
800, // maxHeight
0.9 // quality
).then((picture) => {
console.log('Selected: ', picture)
imageBase64 = picture
});
const blob = this.dataURItoBlob(imageBase64)
console.log(imageBase64)
@@ -699,7 +710,19 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
//const imageData = await this.fileToBase64Service.convert(file)
//
const imageBase64 = 'data:image/jpeg;base64,' + file.base64String
var imageBase64 = 'data:image/jpeg;base64,' + file.base64String
const compressedImage = await this.compressImageBase64(
imageBase64,
800, // maxWidth
800, // maxHeight
0.9 // quality
).then((picture) => {
console.log('Selected: ', picture)
imageBase64 = picture
});
const response = await fetch(imageBase64);
const blob = await response.blob();
@@ -1183,5 +1206,41 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
return blob;
}
async compressImageBase64(base64String: string, maxWidth: number, maxHeight: number, quality: number): Promise<string> {
return new Promise((resolve, reject) => {
const image = new (window as any).Image();
image.src = base64String;
image.onload = async () => {
const canvas = document.createElement('canvas');
let newWidth = image.width;
let newHeight = image.height;
if (newWidth > maxWidth) {
newHeight *= maxWidth / newWidth;
newWidth = maxWidth;
}
if (newHeight > maxHeight) {
newWidth *= maxHeight / newHeight;
newHeight = maxHeight;
}
canvas.width = newWidth;
canvas.height = newHeight;
const context = canvas.getContext('2d');
context?.drawImage(image, 0, 0, newWidth, newHeight);
const compressedBase64 = canvas.toDataURL('image/jpeg', quality);
resolve(compressedBase64);
};
image.onerror = (error) => {
reject(error);
};
});
}
}
+64 -5
View File
@@ -630,10 +630,21 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
source: CameraSource.Camera
});
const imageBase64 = 'data:image/jpeg;base64,' + file.base64String
const blob = this.dataURItoBlob(imageBase64)
var imageBase64 = 'data:image/jpeg;base64,' + file.base64String
const compressedImage = await this.compressImageBase64(
imageBase64,
800, // maxWidth
800, // maxHeight
0.9 // quality
).then((picture) => {
console.log('Selected: ', picture)
imageBase64 = picture
});
console.log(imageBase64)
const blob = this.dataURItoBlob(imageBase64)
const formData = new FormData();
formData.append("blobFile", blob);
@@ -748,12 +759,24 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
//const imageData = await this.fileToBase64Service.convert(file)
//
const imageBase64 = 'data:image/jpeg;base64,' + file.base64String
const response = await fetch(imageBase64);
const blob = await response.blob();
var imageBase64 = 'data:image/jpeg;base64,' + file.base64String
const compressedImage = await this.compressImageBase64(
imageBase64,
800, // maxWidth
800, // maxHeight
0.9 // quality
).then((picture) => {
console.log('Selected: ', picture)
imageBase64 = picture
});
console.log(imageBase64)
const response = await fetch(imageBase64);
const blob = await response.blob();
const formData = new FormData();
formData.append("blobFile", blob);
@@ -1146,6 +1169,42 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
});
}
async compressImageBase64(base64String: string, maxWidth: number, maxHeight: number, quality: number): Promise<string> {
return new Promise((resolve, reject) => {
const image = new (window as any).Image();
image.src = base64String;
image.onload = async () => {
const canvas = document.createElement('canvas');
let newWidth = image.width;
let newHeight = image.height;
if (newWidth > maxWidth) {
newHeight *= maxWidth / newWidth;
newWidth = maxWidth;
}
if (newHeight > maxHeight) {
newWidth *= maxHeight / newHeight;
newHeight = maxHeight;
}
canvas.width = newWidth;
canvas.height = newHeight;
const context = canvas.getContext('2d');
context?.drawImage(image, 0, 0, newWidth, newHeight);
const compressedBase64 = canvas.toDataURL('image/jpeg', quality);
resolve(compressedBase64);
};
image.onerror = (error) => {
reject(error);
};
});
}
}
@@ -36,7 +36,7 @@
<div class="overflow-y-auto">
<div class="middle-content" >
<div *ngIf="intervenientes.length > 0">
<h5 >Intervenientes</h5>
<h5 >Participantes</h5>
<ion-item class="ion-no-margin ion-no-padding">
<ion-label *ngIf="intervenientes">
<div *ngFor="let interveniente of intervenientes">
@@ -35,7 +35,7 @@
<div class="overflow-y-auto" style="margin-right: -20px; margin-right: -20px;">
<div class="middle-content">
<h5 *ngIf="intervenientes">Intervenientes</h5>
<h5 *ngIf="intervenientes">Participantes</h5>
<ion-item class="ion-no-margin ion-no-padding">
<ion-label>
<div *ngFor="let task of intervenientes">
@@ -37,7 +37,7 @@
</div>
<div class="line"></div>
<div class="middle-content">
<h5 *ngIf="intervenientes">Intervenientes</h5>
<h5 *ngIf="intervenientes">Participantes</h5>
<ion-item class="ion-no-margin ion-no-padding">
<ion-label>
<div *ngFor="let interveniente of intervenientes">
@@ -74,7 +74,7 @@
</div>
<div *ngIf="loadedEvent.workflowInstanceDataFields.Participants" class="middle-content">
<div *ngIf="loadedEvent.workflowInstanceDataFields.Participants">
<h5 class="font-17-rem">Intervenientes</h5>
<h5 class="font-17-rem">Participantes</h5>
<div *ngFor="let att of loadedEvent.workflowInstanceDataFields.ParticipantsList">
<ion-label>{{att.Name}}</ion-label>
</div>
@@ -73,7 +73,7 @@
<div class="overflow-y-auto">
<div class="middle-content">
<div *ngIf="loadedEvent.workflowInstanceDataFields.ParticipantsList">
<h5 class="font-17-rem">Intervenientes</h5>
<h5 class="font-17-rem">Participantes</h5>
<div *ngFor="let att of loadedEvent.workflowInstanceDataFields.ParticipantsList">
<ion-label>{{att.Name}}</ion-label>
</div>
@@ -213,7 +213,7 @@
<div class="list-people">
<ion-item lines="none">
<ion-list>
<ion-label *ngIf="taskParticipants?.length < 1" class="list-people-title">Adicionar intervenientes*</ion-label>
<ion-label *ngIf="taskParticipants?.length < 1" class="list-people-title">Adicionar Participantes*</ion-label>
<ion-label *ngFor="let participant of taskParticipants">{{participant.Name}}</ion-label>
</ion-list>
</ion-item>
@@ -140,7 +140,7 @@
<div class="list-people">
<ion-item lines="none">
<ion-list>
<ion-label *ngIf="taskParticipants?.length < 1" class="list-people-title">Adicionar intervenientes*</ion-label>
<ion-label *ngIf="taskParticipants?.length < 1" class="list-people-title">Adicionar Participantes*</ion-label>
<ion-label *ngFor="let participant of taskParticipants">{{participant.Name}}</ion-label>
</ion-list>
</ion-item>
@@ -44,7 +44,7 @@
<div class="overflow-y-auto">
<div class="middle-content">
<!-- <h5 *ngIf="intervenientes">Intervenientes</h5>
<!-- <h5 *ngIf="intervenientes">Participantes</h5>
<ion-item class="ion-no-margin ion-no-padding">
<ion-label>
<div *ngFor="let interveniente of intervenientes">
@@ -37,7 +37,7 @@
<div class="overflow-y-auto">
<div class="middle-content">
<h5 *ngIf="intervenientes">Intervenientes</h5>
<h5 *ngIf="intervenientes">Participantes</h5>
<ion-item class="ion-no-margin ion-no-padding">
<ion-label>
<div *ngFor="let interveniente of intervenientes">
+6 -2
View File
@@ -19,6 +19,8 @@ import { Platform } from '@ionic/angular';
import { FirstEnterService } from '../../services/first-enter.service';
import { Storage } from '@ionic/storage';
import { CPSession } from 'src/app/store/documentManagement';
import { StorageService } from 'src/app/services/storage.service';
@Component({
selector: 'app-login',
templateUrl: './login.page.html',
@@ -55,6 +57,7 @@ export class LoginPage implements OnInit {
private platform: Platform,
private FirstEnterService: FirstEnterService,
private storage:Storage,
private storageService: StorageService,
) {}
ngOnInit() {}
@@ -140,7 +143,8 @@ export class LoginPage implements OnInit {
}
this.changeProfileService.runLogin();
/* this.getToken(); */
this.getToken();
SessionStore.setInativity(true);
this.goback();
@@ -169,7 +173,7 @@ export class LoginPage implements OnInit {
this.ChatService.setheader();
this.ChatSystemService.loadChat();
}
this.storageService.remove("Notifications")
this.getToken();
if(!this.platform.is('desktop') && !this.platform.is('mobileweb')) {
@@ -125,24 +125,48 @@ export class NewPublicationPage implements OnInit {
// in use
async takePicture() {
const capturedImage = await Camera.getPhoto({
quality: 50,
// allowEditing: true,
resultType: CameraResultType.Uri,
resultType: CameraResultType.Base64,
source: CameraSource.Camera
});
const response = await fetch(capturedImage.webPath!);
const blob = await response.blob();
this.capturedImage = 'data:image/jpeg;base64,' +capturedImage.base64String;
this.capturedImageTitle = 'foto';
const compressedImage = await this.compressImageBase64(
this.capturedImage,
800, // maxWidth
800, // maxHeight
0.9 // quality
).then((picture) => {
console.log('taked: ', picture)
this.capturedImage = picture
});
}
this.convertBlobToBase64Worker.postMessage(blob);
this.convertBlobToBase64Worker.onmessage = async (oEvent)=> {
this.capturedImage = oEvent.data
this.capturedImageTitle = 'foto'
async laodPicture() {
const capturedImage = await Camera.getPhoto({
quality: 90,
resultType: CameraResultType.Base64,
source: CameraSource.Photos
});
this.capturedImage = 'data:image/jpeg;base64,' +capturedImage.base64String;
this.capturedImageTitle = 'foto';
const compressedImage = await this.compressImageBase64(
this.capturedImage,
800, // maxWidth
800, // maxHeight
0.9 // quality
).then((picture) => {
console.log('Selected: ', picture)
this.capturedImage = picture
});
}
}
imageSize(image) {
var canvas = document.createElement('canvas');
@@ -165,7 +189,7 @@ export class NewPublicationPage implements OnInit {
});
// in use
/* // in use
async laodPicture() {
const capturedImage = await Camera.getPhoto({
@@ -185,7 +209,7 @@ export class NewPublicationPage implements OnInit {
}
}
} */
@@ -374,4 +398,41 @@ export class NewPublicationPage implements OnInit {
deletePublicationImage() {
this.publication.FileBase64 = ""
}
async compressImageBase64(base64String: string, maxWidth: number, maxHeight: number, quality: number): Promise<string> {
return new Promise((resolve, reject) => {
const image = new (window as any).Image();
image.src = base64String;
image.onload = async () => {
const canvas = document.createElement('canvas');
let newWidth = image.width;
let newHeight = image.height;
if (newWidth > maxWidth) {
newHeight *= maxWidth / newWidth;
newWidth = maxWidth;
}
if (newHeight > maxHeight) {
newWidth *= maxHeight / newHeight;
newHeight = maxHeight;
}
canvas.width = newWidth;
canvas.height = newHeight;
const context = canvas.getContext('2d');
context?.drawImage(image, 0, 0, newWidth, newHeight);
const compressedBase64 = canvas.toDataURL('image/jpeg', quality);
resolve(compressedBase64);
};
image.onerror = (error) => {
reject(error);
};
});
}
}