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 { try {
let guid: any = await this.AttachmentsService.uploadFile(formData).toPromise() let guid: any = await this.AttachmentsService.uploadFile(formData).toPromise()
message.file.guid = guid.path message.file.guid = guid.path
await this.storage.set(guid.path, message.file.image_url).then(() => { // await this.storage.set(guid.path, message.file.image_url).then(() => {
console.log('add picture to chat IMAGE SAVED') // console.log('add picture to chat IMAGE SAVED')
message.getFileFromDb() // // message.getFileFromDb()
}); // });
return true return true
} catch(e) { } catch(e) {
+12 -12
View File
@@ -102,7 +102,7 @@ export class MessageService {
} }
if(this.hasFile) { if(this.hasFile) {
this.getFileFromDb() // this.getFileFromDb()
if(this.file.type != 'application/webtrix') { if(this.file.type != 'application/webtrix') {
this.displayType = this.file.type.replace('application/','').toUpperCase() this.displayType = this.file.type.replace('application/','').toUpperCase()
} }
@@ -118,18 +118,18 @@ export class MessageService {
return firstName + ' ' + lastName return firstName + ' ' + lastName
} }
getFileFromDb() { // getFileFromDb() {
if(this.hasFile) { // if(this.hasFile) {
if (this.file.guid) { // if (this.file.guid) {
this.storage.get(this.file.guid).then((image) => { // this.storage.get(this.file.guid).then((image) => {
if(image != null) { // if(image != null) {
this.file.image_url = image // this.file.image_url = image
} // }
}); // });
} // }
} // }
} // }
async send(): Promise<any> { async send(): Promise<any> {
@@ -761,13 +761,9 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
ts: msg.attachments[0].ts ts: msg.attachments[0].ts
} }
// save the changes to the storage
msg.save() msg.save()
// msg.attachments[0].image_url = 'sdfsdf'
await this.storage.set(msg.file.guid, this.downloadFile).then(() => {
console.log('IMAGE SAVED')
});
} }