This commit is contained in:
Peter Maquiran
2022-03-15 16:28:31 +01:00
parent 00cf4f7eaa
commit 2302a32df6
3 changed files with 17 additions and 21 deletions
+4 -4
View File
@@ -169,10 +169,10 @@ export class AuthService {
try {
let guid: any = await this.AttachmentsService.uploadFile(formData).toPromise()
message.file.guid = guid.path
await this.storage.set(guid.path, message.file.image_url).then(() => {
console.log('add picture to chat IMAGE SAVED')
message.getFileFromDb()
});
// await this.storage.set(guid.path, message.file.image_url).then(() => {
// console.log('add picture to chat IMAGE SAVED')
// // message.getFileFromDb()
// });
return true
} catch(e) {
+12 -12
View File
@@ -102,7 +102,7 @@ export class MessageService {
}
if(this.hasFile) {
this.getFileFromDb()
// this.getFileFromDb()
if(this.file.type != 'application/webtrix') {
this.displayType = this.file.type.replace('application/','').toUpperCase()
}
@@ -118,18 +118,18 @@ export class MessageService {
return firstName + ' ' + lastName
}
getFileFromDb() {
// getFileFromDb() {
if(this.hasFile) {
if (this.file.guid) {
this.storage.get(this.file.guid).then((image) => {
if(image != null) {
this.file.image_url = image
}
});
}
}
}
// if(this.hasFile) {
// if (this.file.guid) {
// this.storage.get(this.file.guid).then((image) => {
// if(image != null) {
// this.file.image_url = image
// }
// });
// }
// }
// }
async send(): Promise<any> {
@@ -761,13 +761,9 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
ts: msg.attachments[0].ts
}
// save the changes to the storage
msg.save()
// msg.attachments[0].image_url = 'sdfsdf'
await this.storage.set(msg.file.guid, this.downloadFile).then(() => {
console.log('IMAGE SAVED')
});
}