ChatStorage Done Done!

This commit is contained in:
Eudes Inácio
2022-01-21 16:55:05 +01:00
86 changed files with 458 additions and 622 deletions
@@ -748,6 +748,11 @@ downloadFileMsg(msg) {
this.downloadFile = 'data:image/jpeg;base64,' + btoa(new Uint8Array(event.body).reduce((data, byte) => data + String.fromCharCode(byte), ''));
console.log('FILE TYPE 44', this.downloadFile)
msg.file = {
guid: msg.file.guid,
image_url: this.downloadFile,
type: msg.file.type
}
this.sqlservice.updateChatMsg(msg._id, this.downloadFile);
}
});
@@ -755,22 +760,24 @@ downloadFileMsg(msg) {
}
}
async openPreview(msg) {
if(msg.image_url != null) {
const modal = await this.modalController.create({
component: ViewMediaPage,
cssClass: 'modal modal-desktop',
componentProps: {
image: msg.image_url,
username: msg.u.name,
_updatedAt: msg._updatedAt,
}
});
modal.present();
} else {
this.downloadFileMsg(msg);
}
async openPreview(msg) {
if (msg.file.image_url === null || msg.file.image_url === '' ) {
this.downloadFileMsg(msg)
} else {
const modal = await this.modalController.create({
component: ViewMediaPage,
cssClass: 'modal modal-desktop',
componentProps: {
image: msg.file.image_url,
username: msg.u.name,
_updatedAt: msg._updatedAt
}
});
modal.present();
}
}
}