mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-20 05:16:07 +00:00
performace
This commit is contained in:
@@ -58,8 +58,8 @@
|
||||
<span class="time">{{msg.time}}</span>
|
||||
</div>
|
||||
<div class="message">
|
||||
<pre *ngIf="msg.delate == false" class="message-box text ma-0 font-13-rem" style="font-size: 0.8125rem !important;" >{{msg.msg}} </pre>
|
||||
<pre *ngIf="msg.delate == true" class="message-box text ma-0 font-13-rem" style="font-size: 0.8125rem !important;" >{{msg.msg}} </pre>
|
||||
<pre *ngIf="msg.delate == false" class="message-box text ma-0 font-13-rem" style="font-size: 0.8125rem !important;" >{{msg.msg}}</pre>
|
||||
<pre *ngIf="msg.delate == true" class="message-box text ma-0 font-13-rem" style="font-size: 0.8125rem !important;" >{{msg.msg}}</pre>
|
||||
|
||||
|
||||
<ion-label class="float-status-all float-status" *ngIf="msg.u.username==sessionStore.user.UserName">
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
<div class="middle-container" *ngIf="!showMessageOptions">
|
||||
<div class="middle">
|
||||
<ion-label class="title">{{ChatSystemService.getDmRoom(roomId).name}}</ion-label>
|
||||
<span><ion-icon class="{{ ChatSystemService.getDmRoom(this.roomId).online }}" name="ellipse"></ion-icon></span>
|
||||
<span><ion-icon *ngIf="RochetChatConnectorService.isLogin" class="{{ ChatSystemService.getDmRoom(this.roomId).online }}" name="ellipse"></ion-icon></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -58,7 +58,7 @@
|
||||
<div>
|
||||
<div class="file">
|
||||
|
||||
<pre *ngIf="msg.delate == false" class="message-box text ma-0 font-13-rem" style="font-size: 0.8125rem !important;" >{{msg.msg}} </pre>
|
||||
<pre *ngIf="msg.delate == false" class="message-box text ma-0 font-13-rem" style="font-size: 0.8125rem !important;" >{{msg.msg}}</pre>
|
||||
<!-- <ion-label *ngIf="msg.delate == false" class="message-box">{{msg.msg}} </ion-label> -->
|
||||
<ion-label *ngIf="msg.delate == true" class="flex-0">Apagou a mensagem</ion-label>
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ import { FileOpener } from '@awesome-cordova-plugins/file-opener/ngx';
|
||||
import { Filesystem, Directory } from '@capacitor/filesystem';
|
||||
import { NewEventPage } from '../../agenda/new-event/new-event.page';
|
||||
import { NotificationsService } from 'src/app/services/notifications.service';
|
||||
|
||||
import { RochetChatConnectorService } from 'src/app/services/chat/rochet-chat-connector.service'
|
||||
|
||||
const IMAGE_DIR = 'stored-images';
|
||||
|
||||
@@ -115,7 +115,8 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
// private document: DocumentViewer
|
||||
private file: File,
|
||||
private fileOpener: FileOpener,
|
||||
private router: Router
|
||||
private router: Router,
|
||||
public RochetChatConnectorService: RochetChatConnectorService,
|
||||
) {
|
||||
this.loggedUser = SessionStore.user.ChatData['data'];
|
||||
this.roomId = this.navParams.get('roomId');
|
||||
@@ -140,7 +141,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
console.log(this.router.url);
|
||||
console.log(this.router.url);
|
||||
this.createDirectoryImage()
|
||||
// this.chatService.refreshtoken();
|
||||
this.ChatSystemService.getUserOfRoom(this.roomId).then((value) => {
|
||||
@@ -151,7 +152,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
|
||||
this.getChatMembers();
|
||||
}
|
||||
|
||||
|
||||
|
||||
ngAfterViewInit() {
|
||||
this.scrollChangeCallback = () => this.onContentScrolled(event);
|
||||
@@ -324,7 +325,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
}
|
||||
|
||||
async goToEvent(event: any) {
|
||||
|
||||
|
||||
let classs;
|
||||
if (window.innerWidth < 701) {
|
||||
classs = 'modal modal-desktop'
|
||||
@@ -384,7 +385,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
} else if (msg.u.username == this.members[0].username) {
|
||||
this.notificationService.ChatSendMessageNotification(this.members[1].username,this.members[1].name,lastMsg.msg,this.roomId)
|
||||
}
|
||||
|
||||
|
||||
})
|
||||
} */
|
||||
|
||||
@@ -593,7 +594,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
cssClass: 'modal modal-desktop',
|
||||
backdropDismiss: false
|
||||
});
|
||||
|
||||
|
||||
modal.onDidDismiss().then((data) => {
|
||||
if (data?.data && data.data.id) {
|
||||
|
||||
@@ -631,7 +632,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
});
|
||||
|
||||
var imageBase64 = 'data:image/jpeg;base64,' + file.base64String
|
||||
|
||||
|
||||
|
||||
const compressedImage = await this.compressImageBase64(
|
||||
imageBase64,
|
||||
@@ -671,25 +672,25 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
// convert base64 to raw binary data held in a string
|
||||
// doesn't handle URLEncoded DataURIs - see SO answer #6850276 for code that does this
|
||||
var byteString = atob(dataURI.split(',')[1]);
|
||||
|
||||
|
||||
// separate out the mime component
|
||||
var mimeString = dataURI.split(',')[0].split(':')[1].split(';')[0]
|
||||
|
||||
|
||||
// write the bytes of the string to an ArrayBuffer
|
||||
var ab = new ArrayBuffer(byteString.length);
|
||||
|
||||
|
||||
// create a view into the buffer
|
||||
var ia = new Uint8Array(ab);
|
||||
|
||||
|
||||
// set the bytes of the buffer to the correct values
|
||||
for (var i = 0; i < byteString.length; i++) {
|
||||
ia[i] = byteString.charCodeAt(i);
|
||||
}
|
||||
|
||||
|
||||
// write the ArrayBuffer to a blob, and you're done
|
||||
var blob = new Blob([ab], {type: mimeString});
|
||||
return blob;
|
||||
|
||||
|
||||
}
|
||||
|
||||
async addImageMobile() {
|
||||
@@ -761,7 +762,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
//
|
||||
|
||||
var imageBase64 = 'data:image/jpeg;base64,' + file.base64String
|
||||
|
||||
|
||||
|
||||
const compressedImage = await this.compressImageBase64(
|
||||
imageBase64,
|
||||
@@ -1054,7 +1055,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
} else {
|
||||
pathFile = this.file.externalRootDirectory
|
||||
}
|
||||
|
||||
|
||||
console.log(pathFile)
|
||||
|
||||
await Filesystem.writeFile({
|
||||
@@ -1192,32 +1193,32 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
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);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user