This commit is contained in:
Peter Maquiran
2022-02-04 00:54:41 +01:00
parent 0f04ad98c2
commit 3b6e519adb
3 changed files with 31 additions and 20 deletions
@@ -638,18 +638,15 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
//"title": this.capturedImageTitle ,
//"text": "description",
"title_link_download": false,
//"image_url": this.capturedImage,
"type": "application/img",
"guid": '',
"image_url": imageData
}]
})
let guid: any = await this.AttachmentsService.uploadFile(formData).toPromise()
updateMessage({
file: {
type: "application/img",
guid: guid.path,
image_url: imageData
}
})
message.file.guid = guid.path
this.AttachmentsService.downloadFile(guid.path).subscribe(async (event) => {
@@ -659,6 +656,23 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
} else if (event.type === HttpEventType.Response) {
var fileImage = 'data:image/jpeg;base64,' + btoa(new Uint8Array(event.body).reduce((data, byte) => data + String.fromCharCode(byte), ''));
console.log('add picture to chat',fileImage);
updateMessage({
file: {
type: "application/img",
guid: guid.path,
image_url: fileImage
},
attachments: [{
//"title": this.capturedImageTitle ,
//"text": "description",
"title_link_download": false,
"type": "application/img",
guid: guid.path,
"image_url": fileImage
}]
})
await this.storage.set(guid.path, fileImage).then(() => {
console.log('add picture to chat IMAGE SAVED')
message.getFileFromDb()
+5 -6
View File
@@ -658,10 +658,9 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
"image_url": imageData
},
attachments: [{
//"title": this.capturedImageTitle ,
//"text": "description",
"title": file.name,
"title_link_download": false,
//"image_url": this.capturedImage,
"image_url": imageData,
}]
})
@@ -744,10 +743,10 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
"image_url": fileImage
},
attachments: [{
//"title": this.capturedImageTitle ,
//"text": "description",
"title": capturedImageTitle ,
"text": "description",
"title_link_download": false,
//"image_url": this.capturedImage,
"image_url": capturedImage,
}]
})