From 2302a32df62ccb1bf6dcfd9fc49b5d7d09e005db Mon Sep 17 00:00:00 2001 From: Peter Maquiran Date: Tue, 15 Mar 2022 16:28:31 +0100 Subject: [PATCH] save --- src/app/services/auth.service.ts | 8 +++---- src/app/services/chat/message.service.ts | 24 +++++++++---------- src/app/shared/chat/messages/messages.page.ts | 6 +---- 3 files changed, 17 insertions(+), 21 deletions(-) diff --git a/src/app/services/auth.service.ts b/src/app/services/auth.service.ts index 45e971aba..b28f8f4ec 100644 --- a/src/app/services/auth.service.ts +++ b/src/app/services/auth.service.ts @@ -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) { diff --git a/src/app/services/chat/message.service.ts b/src/app/services/chat/message.service.ts index eb0708962..67ca3207c 100644 --- a/src/app/services/chat/message.service.ts +++ b/src/app/services/chat/message.service.ts @@ -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 { diff --git a/src/app/shared/chat/messages/messages.page.ts b/src/app/shared/chat/messages/messages.page.ts index e0c822a05..fdf1a1dd5 100644 --- a/src/app/shared/chat/messages/messages.page.ts +++ b/src/app/shared/chat/messages/messages.page.ts @@ -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') - }); }