mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-20 05:16:07 +00:00
Storage add suceffuly to chat
This commit is contained in:
@@ -60,7 +60,7 @@
|
||||
<ion-label>{{msg.msg}}</ion-label>
|
||||
<div *ngIf="msg.attachments" class="message-attachments">
|
||||
<div *ngFor="let file of msg.attachments let i = index">
|
||||
<div (click)="downloadFileMsg(msg)">
|
||||
<div (click)="openPreview(msg)">
|
||||
<img *ngIf="msg.image_url" src={{msg.image_url}} alt="image">
|
||||
</div>
|
||||
<div>
|
||||
|
||||
@@ -789,53 +789,27 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
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)
|
||||
|
||||
console.log('TRY ARRAY BUFFER NAME', name);
|
||||
console.log('TRY ARRAY BUFFER', this.downloadFile);
|
||||
|
||||
this.sqlservice.updateChatMsg(msg._id, this.downloadFile);
|
||||
|
||||
await Filesystem.writeFile({
|
||||
path: `${IMAGE_DIR}/${name}`,
|
||||
data: this.downloadFile,
|
||||
directory: Directory.Data
|
||||
}).then((foo) => {
|
||||
console.log('SAVED FILE WEB', foo)
|
||||
}).catch((error) => {
|
||||
console.log('SAVED FILE WEB error ', error)
|
||||
});
|
||||
|
||||
const readFile = await Filesystem.readFile({
|
||||
path: `${IMAGE_DIR}/${name}`,
|
||||
directory: Directory.Data,
|
||||
}).then((foo) => {
|
||||
console.log('GET FILE WEB', foo)
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
console.log('FILE TYPE 44', this.downloadFile)
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
async openPreview(msg) {
|
||||
if(msg.image_url != "") {
|
||||
this.downloadFile();
|
||||
} else {
|
||||
if(msg.image_url != null) {
|
||||
const modal = await this.modalController.create({
|
||||
component: ViewMediaPage,
|
||||
cssClass: 'modal modal-desktop',
|
||||
componentProps: {
|
||||
image: msg.attachments[0].image_url,
|
||||
image: msg.image_url,
|
||||
username: msg.u.name,
|
||||
_updatedAt: msg._updatedAt,
|
||||
}
|
||||
});
|
||||
modal.present();
|
||||
|
||||
} else {
|
||||
this.downloadFileMsg(msg);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user