From eb17b9d310bfff614357e449d5a889c82d3da5d4 Mon Sep 17 00:00:00 2001 From: Peter Maquiran Date: Sun, 3 Mar 2024 12:21:34 +0100 Subject: [PATCH 1/2] fix reported issue --- src/app/services/publications.service.ts | 2 +- .../new-publication/new-publication.page.ts | 12 +++++++++--- .../publication/upload/upload-streaming.service.ts | 4 ++-- src/environments/environment.ts | 2 +- 4 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/app/services/publications.service.ts b/src/app/services/publications.service.ts index 786524fbc..30182c8d1 100644 --- a/src/app/services/publications.service.ts +++ b/src/app/services/publications.service.ts @@ -246,7 +246,7 @@ GetIdsPublicationNext(id:any){ body.Files = body.Files.map( e => ({ FileBase64: e.FileBase64, FileExtension: e.FileExtension, - OriginalFileName: 'foto' + OriginalFileName: e.OriginalFileName || 'foto' })) return this.http.put(`${geturl}`, body, options) 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 20e1a0db1..1928cd27a 100644 --- a/src/app/shared/publication/new-publication/new-publication.page.ts +++ b/src/app/shared/publication/new-publication/new-publication.page.ts @@ -110,6 +110,8 @@ export class NewPublicationPage implements OnInit { this.showLoader = true; this.publications.GetPublicationWithArrayOfFilesById(this.documentId).subscribe(res => { this.processData(res) + + console.log("res get", res) this.showLoader = false; }, (error) => { console.log(error) @@ -120,6 +122,8 @@ export class NewPublicationPage implements OnInit { } processData(res) { + + console.log("res process", res) this.publicationFormMV.form.Files = [] this.publicationFormMV.form.setData({ DateIndex: res.DateIndex, @@ -295,6 +299,8 @@ export class NewPublicationPage implements OnInit { OriginalFileName: 'video', FileType: this.checkFileType.checkFileType( this.removeTextBeforeSlash(element.mimeType, '/')) as any }) + + fileObject.needUpload() this.publicationFormMV.form.Files.push(fileObject) }) .catch((err) => console.error(err)); @@ -351,7 +357,7 @@ export class NewPublicationPage implements OnInit { if(upload) { this.publicationFormMV.form.Files = this.publicationFormMV.form.Files.map((e:PublicationAttachmentEntity)=> { - if(e.FileType == 'video') { + if(e.FileType == 'video' && e.toUpload) { e.OriginalFileName = e.chucksManager.path.replace(".mp4", "") e.FileExtension = "mp4" } @@ -427,8 +433,6 @@ export class NewPublicationPage implements OnInit { try { - console.log({publication}) - await this.publications.CreatePublication(publication.ProcessId, publication).toPromise() if (this.publicationTitle == '1') { @@ -781,6 +785,7 @@ console.log(stringGerada); } ) + fileObject.needUpload() this.publicationFormMV.form.Files.push(fileObject) }) .catch((erro) => console.error('read converted video erro ', erro)); @@ -810,6 +815,7 @@ console.log(stringGerada); } ) + fileObject.needUpload() this.publicationFormMV.form.Files.push(fileObject) }) .catch((err) => console.error(err)); diff --git a/src/app/shared/publication/upload/upload-streaming.service.ts b/src/app/shared/publication/upload/upload-streaming.service.ts index 419e81128..e3856a660 100644 --- a/src/app/shared/publication/upload/upload-streaming.service.ts +++ b/src/app/shared/publication/upload/upload-streaming.service.ts @@ -246,7 +246,7 @@ export class PublicationFormMV { if(!PublicationAttachmentEntity.hasChunkManger) { const fileBlob = PublicationAttachmentEntity.blobFile; - const fileChunks = new Chunks({chunkSize: 40 }) + const fileChunks = new Chunks({chunkSize: 400 }) fileChunks.setFile(fileBlob) PublicationAttachmentEntity.setChunkManger(fileChunks) @@ -303,7 +303,7 @@ export class PublicationFormMV { // this.ObjectMergeNotification.socket.registerWhenConnected(() => { const videosFiles = this.getVideoFiles() - const videosFilesToUploads = videosFiles.filter( e => e.FileType == "video") + const videosFilesToUploads = videosFiles.filter( e => e.FileType == "video" && e.toUpload) const Promises: Promise[] = [] diff --git a/src/environments/environment.ts b/src/environments/environment.ts index 3bd65b833..983359e87 100644 --- a/src/environments/environment.ts +++ b/src/environments/environment.ts @@ -4,4 +4,4 @@ import { doneITDev } from './suport/doneIt' import { DevDev } from './suport/dev' -export const environment: Environment = oaprDev +export const environment: Environment = DevDev From 588b59b3ab7df576acb330c194852cb6ec716a67 Mon Sep 17 00:00:00 2001 From: Peter Maquiran Date: Sun, 3 Mar 2024 18:14:33 +0100 Subject: [PATCH 2/2] fix --- .../pages/chat/new-group/new-group.page.ts | 89 ++++++++++++------- .../deploma-options/deploma-options.page.html | 2 +- .../opts-expediente/opts-expediente.page.ts | 3 +- .../new-publication/new-publication.page.ts | 12 ++- .../upload/upload-streaming.service.ts | 2 +- 5 files changed, 67 insertions(+), 41 deletions(-) diff --git a/src/app/pages/chat/new-group/new-group.page.ts b/src/app/pages/chat/new-group/new-group.page.ts index 0786f7a0e..b31738dac 100644 --- a/src/app/pages/chat/new-group/new-group.page.ts +++ b/src/app/pages/chat/new-group/new-group.page.ts @@ -6,6 +6,7 @@ import { ThemeService } from 'src/app/services/theme.service'; import { ChatSystemService } from 'src/app/services/chat/chat-system.service'; import { SessionStore } from 'src/app/store/session.service'; import { ToastService } from 'src/app/services/toast.service'; +import { catchError } from 'rxjs/operators'; @Component({ selector: 'app-new-group', @@ -66,46 +67,72 @@ export class NewGroupPage implements OnInit { let customFields = {} let res: any; - if (this.thedate) { - let customFields = { - "countDownDate": this.thedate - } - res = await this.ChatSystemService.createPrivateRoom(name, SessionStore.user.UserName, customFields); - } - else { - res = await this.ChatSystemService.createPrivateRoom(name, SessionStore.user.UserName, customFields); + if(!SessionStore.user?.ChatData?.data) { + this.toastService._successMessage("Chat temporariamente indisponível") } - this.isGroupCreated = true; - this.addContacts(res.result); - this.ChatSystemService.getRoom([res.result]); + try { - setTimeout(() => { - this.ChatSystemService.subscribeToRoomUpdate(res.result.rid, res.result); - }, 10) - - - - if (res?.result?.rid) { - - this.ChatSystemService.getAllRooms(() => { - if (!this.ChatSystemService.getGroupRoom(res.result.rid)) { - this.createGroupWithAttachmentsCath(res) - } else { - setTimeout(() => { - - this.createGroupWithAttachments(res) - - }, 500) + if (this.thedate) { + let customFields = { + "countDownDate": this.thedate } - }, res.result.rid); + res = await this.ChatSystemService.createPrivateRoom(name, SessionStore.user.UserName, customFields); + } + else { + res = await this.ChatSystemService.createPrivateRoom(name, SessionStore.user.UserName, customFields); + } + + try { + this.isGroupCreated = true; + this.addContacts(res.result); + this.ChatSystemService.getRoom([res.result]); + + setTimeout(() => { + this.ChatSystemService.subscribeToRoomUpdate(res.result.rid, res.result); + }, 10) + + } catch (error) { + await this.ChatSystemService.getUser(); + await this.ChatSystemService.getAllRooms(); + await this.ChatSystemService.subscribeToRoom(); + + this.isGroupCreated = true; + this.addContacts(res.result); + this.ChatSystemService.getRoom([res.result]); + + setTimeout(() => { + this.ChatSystemService.subscribeToRoomUpdate(res.result.rid, res.result); + }, 10) + + } - } else { + if (res?.result?.rid) { - this.toastService._badRequest('Existe um grupo com este nome!'); + this.ChatSystemService.getAllRooms(() => { + if (!this.ChatSystemService.getGroupRoom(res.result.rid)) { + this.createGroupWithAttachmentsCath(res) + } else { + setTimeout(() => { + this.createGroupWithAttachments(res) + + }, 500) + } + }, res.result.rid); + + + + } else { + + this.toastService._badRequest('Existe um grupo com este nome!'); + + } + + } catch(error) { + this.toastService._successMessage("Chat temporariamente indisponível") } } diff --git a/src/app/shared/popover/deploma-options/deploma-options.page.html b/src/app/shared/popover/deploma-options/deploma-options.page.html index 87e350eda..908c60caa 100644 --- a/src/app/shared/popover/deploma-options/deploma-options.page.html +++ b/src/app/shared/popover/deploma-options/deploma-options.page.html @@ -27,7 +27,7 @@
-
+
diff --git a/src/app/shared/popover/opts-expediente/opts-expediente.page.ts b/src/app/shared/popover/opts-expediente/opts-expediente.page.ts index cbcad8e04..227d189de 100644 --- a/src/app/shared/popover/opts-expediente/opts-expediente.page.ts +++ b/src/app/shared/popover/opts-expediente/opts-expediente.page.ts @@ -143,6 +143,7 @@ export class OptsExpedientePage implements OnInit { this.attachmentsService.AddAttachment(body).subscribe((res)=> { this.toastService._successMessage() + this.popoverController.dismiss() }, (error) => { this.httpErrorHanlde.httpStatusHandle(error) },()=> { @@ -151,7 +152,7 @@ export class OptsExpedientePage implements OnInit { }); - this.popoverController.dismiss() + } }, (error) => { 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 1928cd27a..3c491b932 100644 --- a/src/app/shared/publication/new-publication/new-publication.page.ts +++ b/src/app/shared/publication/new-publication/new-publication.page.ts @@ -181,7 +181,6 @@ export class NewPublicationPage implements OnInit { FileType: 'image' } ) - newAttachment.needUpload() this.publicationFormMV.form.Files.push(newAttachment) }); } @@ -300,7 +299,6 @@ export class NewPublicationPage implements OnInit { FileType: this.checkFileType.checkFileType( this.removeTextBeforeSlash(element.mimeType, '/')) as any }) - fileObject.needUpload() this.publicationFormMV.form.Files.push(fileObject) }) .catch((err) => console.error(err)); @@ -357,8 +355,8 @@ export class NewPublicationPage implements OnInit { if(upload) { this.publicationFormMV.form.Files = this.publicationFormMV.form.Files.map((e:PublicationAttachmentEntity)=> { - if(e.FileType == 'video' && e.toUpload) { - e.OriginalFileName = e.chucksManager.path.replace(".mp4", "") + if(e.FileType == 'video' && e.blobFile && e.toUpload) { + e.OriginalFileName = e?.chucksManager?.path?.replace(".mp4", "") || e.OriginalFileName e.FileExtension = "mp4" } return e @@ -408,7 +406,7 @@ export class NewPublicationPage implements OnInit { if(upload) { this.publicationFormMV.form.Files = this.publicationFormMV.form.Files.map((e:PublicationAttachmentEntity) => { - if(e.FileType == 'video') { + if(e.FileType == 'video' && e.blobFile && e.toUpload) { e.OriginalFileName = e.chucksManager.path.replace(".mp4", "") e.FileExtension = "mp4" e.Base64 = "" @@ -785,7 +783,7 @@ console.log(stringGerada); } ) - fileObject.needUpload() + // fileObject.needUpload() this.publicationFormMV.form.Files.push(fileObject) }) .catch((erro) => console.error('read converted video erro ', erro)); @@ -815,7 +813,7 @@ console.log(stringGerada); } ) - fileObject.needUpload() + // fileObject.needUpload() this.publicationFormMV.form.Files.push(fileObject) }) .catch((err) => console.error(err)); diff --git a/src/app/shared/publication/upload/upload-streaming.service.ts b/src/app/shared/publication/upload/upload-streaming.service.ts index e3856a660..a5a995ef1 100644 --- a/src/app/shared/publication/upload/upload-streaming.service.ts +++ b/src/app/shared/publication/upload/upload-streaming.service.ts @@ -303,7 +303,7 @@ export class PublicationFormMV { // this.ObjectMergeNotification.socket.registerWhenConnected(() => { const videosFiles = this.getVideoFiles() - const videosFilesToUploads = videosFiles.filter( e => e.FileType == "video" && e.toUpload) + const videosFilesToUploads = videosFiles.filter( e => e.FileType == "video" && e.toUpload && e.blobFile) const Promises: Promise[] = []