From 1671ace74541fb74f6e650dc2771ff85c49b6a30 Mon Sep 17 00:00:00 2001 From: Peter Maquiran Date: Wed, 3 Apr 2024 15:28:58 +0100 Subject: [PATCH] save --- .../new-publication/new-publication.page.ts | 18 ++++++++--- .../new-publication/new-publication.page.html | 2 +- .../new-publication/new-publication.page.ts | 2 +- .../upload/publication-from-mv.service.ts | 32 ++++++++++++++----- .../upload/upload-streaming.service.ts | 1 + 5 files changed, 41 insertions(+), 14 deletions(-) diff --git a/src/app/pages/publications/new-publication/new-publication.page.ts b/src/app/pages/publications/new-publication/new-publication.page.ts index f6ae2e297..00930ef69 100644 --- a/src/app/pages/publications/new-publication/new-publication.page.ts +++ b/src/app/pages/publications/new-publication/new-publication.page.ts @@ -409,21 +409,31 @@ export class NewPublicationPage implements OnInit { close() { - this.modalController.dismiss(this.PublicationFromMvService.form).then(() => { this.showLoader = true; }); } cancel() { + + this.PublicationFromMvService.form.cancel = true if(this.PublicationFromMvService.form.send == false) { this.PublicationFromMvService.cancel() this.PublicationFromMvService.ObjectMergeNotification.close() } - this.modalController.dismiss(this.PublicationFromMvService.form).then(() => { - this.showLoader = true; - }); + if (window["sharedContent"]) { + + if (this.platform.is('android')) { + App.exitApp() + } else { + window["sharedContent"] = null; + this.close() + } + } else { + this.close() + } + } clear() { diff --git a/src/app/shared/publication/new-publication/new-publication.page.html b/src/app/shared/publication/new-publication/new-publication.page.html index 65e49d75f..30afdfc30 100644 --- a/src/app/shared/publication/new-publication/new-publication.page.html +++ b/src/app/shared/publication/new-publication/new-publication.page.html @@ -66,7 +66,7 @@ - diff --git a/src/app/shared/publication/new-publication/new-publication.page.ts b/src/app/shared/publication/new-publication/new-publication.page.ts index ed021947b..0b9b8b5af 100644 --- a/src/app/shared/publication/new-publication/new-publication.page.ts +++ b/src/app/shared/publication/new-publication/new-publication.page.ts @@ -315,7 +315,7 @@ export class NewPublicationPage implements OnInit { console.log('load video tablet base64', content) this.filecontent = true; let fileObject = new PublicationAttachmentEntity({ - base64: 'data:video/mp4;base64,'+content.data, + base64: content.data, extension: this.removeTextBeforeSlash(element.mimeType, '/'), OriginalFileName: 'video', FileType: this.checkFileType.checkFileType( this.removeTextBeforeSlash(element.mimeType, '/')) as any diff --git a/src/app/shared/publication/upload/publication-from-mv.service.ts b/src/app/shared/publication/upload/publication-from-mv.service.ts index d98d6aad9..b3947dbb4 100644 --- a/src/app/shared/publication/upload/publication-from-mv.service.ts +++ b/src/app/shared/publication/upload/publication-from-mv.service.ts @@ -113,11 +113,19 @@ export class PublicationFromMvService { publication.ProcessId = this.folderId + if(this.form.cancel) { + window['upload-header-set-remove'](this.id); + return false + } + try { const response = await this.publications.UpdatePublication(publication.ProcessId, publication).toPromise() - this.httpErroHandle.httpsSucessMessagge('Editar publicação') + if (!this.form.cancel) { + this.httpErroHandle.httpsSucessMessagge('Editar publicação') + } + this.publicationFolderService.getPublicationsIds(this.folderId) window['upload-header-set-remove'](this.id); @@ -195,21 +203,24 @@ export class PublicationFromMvService { publication.DocumentId = null; publication.ProcessId = this.folderId + if(this.form.cancel) { + window['upload-header-set-remove'](this.id); + return false + } + try { await this.publications.CreatePublication(publication.ProcessId, publication).toPromise() - if (this.publicationType == '1') { + if (this.publicationType == '1' && !this.form.cancel) { this.httpErroHandle.httpsSucessMessagge('Criar publicação') - } else if (this.publicationType == '2') { + } else if (this.publicationType == '2' && !this.form.cancel) { this.httpErroHandle.httpsSucessMessagge('Criar publicação') - } else if (this.publicationType == '3') { - this.httpErroHandle.httpsSucessMessagge('Editar publicação') } // this.goBackToViewPublications.emit(); window['upload-header-set-remove'](this.id); - this.closeApp() + this.doneUpload() this.publicationFolderService.getPublicationsIds(this.folderId) } catch (error) { window['upload-header-set-retry'](this.id) @@ -232,11 +243,14 @@ export class PublicationFromMvService { } - closeApp() { + doneUpload() { if (window["sharedContent"]) { if (this.platform.is('android')) { - App.exitApp() + window["sharedContent"] = null + this.modalController.dismiss(this.form).then(() => { + this.router.navigate(['/home/publications', this.folderId]) + }); } else { window["sharedContent"] = null this.modalController.dismiss(this.form).then(() => { @@ -244,6 +258,8 @@ export class PublicationFromMvService { }); } + } else { + this.modalController.dismiss(this.form).then(() => {}); } } diff --git a/src/app/shared/publication/upload/upload-streaming.service.ts b/src/app/shared/publication/upload/upload-streaming.service.ts index 4cb5b9b86..ca533e38b 100644 --- a/src/app/shared/publication/upload/upload-streaming.service.ts +++ b/src/app/shared/publication/upload/upload-streaming.service.ts @@ -215,6 +215,7 @@ export class PublicationFormModel implements IPublicationFormModelEntity { hasSet = false send = false + cancel = false setData(data: IPublicationFormModelEntity) { if(data.Files) {