From e8c740ef6ad9034e70d8b6b9f0c7a295ab8166fd Mon Sep 17 00:00:00 2001 From: Peter Maquiran Date: Mon, 4 Dec 2023 08:34:57 +0100 Subject: [PATCH] fix agenda layout and publication stop playing video on scroll --- src/app/pages/agenda/agenda.page.scss | 2 - .../view-publications.page.ts | 22 ++++++- .../publication-video-manager.service.ts | 1 - .../view-publications.page.html | 4 +- .../view-publications.page.ts | 27 +++++--- src/app/store/publication-folder.service.ts | 62 ++++++++++++------- 6 files changed, 78 insertions(+), 40 deletions(-) diff --git a/src/app/pages/agenda/agenda.page.scss b/src/app/pages/agenda/agenda.page.scss index 94edd8f82..3a1c376be 100644 --- a/src/app/pages/agenda/agenda.page.scss +++ b/src/app/pages/agenda/agenda.page.scss @@ -508,7 +508,6 @@ div ion-raw > ul > li { font-family: Roboto; font-weight: bold; color: var(--title-text-color); - max-width: 250px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; @@ -519,7 +518,6 @@ div ion-raw > ul > li { overflow: hidden !important; text-overflow: ellipsis !important; font-size: rem(17); - max-width: 250px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; diff --git a/src/app/pages/publications/view-publications/view-publications.page.ts b/src/app/pages/publications/view-publications/view-publications.page.ts index 67a64e862..b191043b5 100644 --- a/src/app/pages/publications/view-publications/view-publications.page.ts +++ b/src/app/pages/publications/view-publications/view-publications.page.ts @@ -68,8 +68,6 @@ export class ViewPublicationsPage implements OnInit { private publicationVideoManagerService: PublicationVideoManagerService) { - this.publicationVideoManagerService.setContainer(this.VideoManager.nativeElement) - this.createPublicationList() this.getFromDB(); @@ -233,10 +231,28 @@ export class ViewPublicationsPage implements OnInit { const findIndex = this.publicationFindIndex(publicationId, folderId) const found = this.publicationIsPresent(publicationId, folderId) + + + if (!found) { this.publicationFolderService.publicationList[folderId].push(publicationDetails) } else { - this.publicationFolderService.publicationList[folderId][findIndex] = publicationDetails + + + let a: any = Object.assign({},this.publicationFolderService.publicationList[folderId][findIndex]) + let b: any = Object.assign({}, publicationDetails) + + a.Files = a.Files.length + b.Files = b.Files.length + + if(JSON.stringify(a) != JSON.stringify(b)) { + + // console.log({a, b}) + this.publicationFolderService.publicationList[folderId][findIndex] = publicationDetails + } else { + // console.log({publicationDetails}) + } + } } diff --git a/src/app/services/publication/publication-video-manager.service.ts b/src/app/services/publication/publication-video-manager.service.ts index 08fcd9eb6..60c4c9588 100644 --- a/src/app/services/publication/publication-video-manager.service.ts +++ b/src/app/services/publication/publication-video-manager.service.ts @@ -23,7 +23,6 @@ export class PublicationVideoManagerService { } - class SelectedPublication { position: number video: HTMLVideoElement diff --git a/src/app/shared/publication/view-publications/view-publications.page.html b/src/app/shared/publication/view-publications/view-publications.page.html index 654dc35c7..02b5dc47e 100644 --- a/src/app/shared/publication/view-publications/view-publications.page.html +++ b/src/app/shared/publication/view-publications/view-publications.page.html @@ -28,14 +28,14 @@ - + -
+

{{publicationFolderService.FolderDetails[folderId].Detail}}

diff --git a/src/app/shared/publication/view-publications/view-publications.page.ts b/src/app/shared/publication/view-publications/view-publications.page.ts index a81ab74d8..c31c40e72 100644 --- a/src/app/shared/publication/view-publications/view-publications.page.ts +++ b/src/app/shared/publication/view-publications/view-publications.page.ts @@ -60,12 +60,6 @@ export class ViewPublicationsPage implements OnInit { private publicationVideoManagerService: PublicationVideoManagerService ) { - setTimeout(()=> { - // console.log("this.VideoManager", this.VideoManager, document.querySelector('.VideoManager')) - this.publicationVideoManagerService.setContainer(this.VideoManager.nativeElement) - }, 2000) - - // this.publicationVideoManagerService.setContainer(this.VideoManager.nativeElement) this.createPublicationList() } @@ -75,7 +69,7 @@ export class ViewPublicationsPage implements OnInit { console.log("nice to have", e) if(!e) { - this.stopVideo() + //this.stopVideo() } } ngOnInit() { @@ -217,10 +211,27 @@ export class ViewPublicationsPage implements OnInit { const findIndex = this.publicationFindIndex(publicationId, folderId) const found = this.publicationIsPresent(publicationId, folderId) + if (!found) { this.publicationFolderService.publicationList[folderId].push(publicationDetails) } else { - this.publicationFolderService.publicationList[folderId][findIndex] = publicationDetails + + // console.log("names"); + + let a: any = Object.assign({},this.publicationFolderService.publicationList[folderId][findIndex]) + let b: any = Object.assign({}, publicationDetails) + + a.Files = a.Files.length + b.Files = b.Files.length + + if(JSON.stringify(a) != JSON.stringify(b)) { + + // console.log({a, b}) + this.publicationFolderService.publicationList[folderId][findIndex] = publicationDetails + } else { + // console.log({publicationDetails}) + } + } } diff --git a/src/app/store/publication-folder.service.ts b/src/app/store/publication-folder.service.ts index b8aca81a4..7221ea60e 100644 --- a/src/app/store/publication-folder.service.ts +++ b/src/app/store/publication-folder.service.ts @@ -21,12 +21,12 @@ export class PublicationFolderService { publicationPipe = new PublicationPipe() getpublication = []; - + constructor( private storage: Storage, private publications: PublicationsService, ) {} - + createPublicationList(folderId) { if(!this.publicationList[folderId]) { @@ -38,10 +38,10 @@ export class PublicationFolderService { } getFromDB(folderId: any) { - - + + if(!this.restoreFolder[folderId]) { - + this.storage.get(folderId).then((viewPublications) => { this.publicationList[folderId] = viewPublications }) @@ -50,7 +50,7 @@ export class PublicationFolderService { this.FolderDetails[folderId] = viewPublications }) } - + this.restoreFolder[folderId] = true } @@ -85,19 +85,19 @@ export class PublicationFolderService { } deletePost(folderId: any, DocumentId: any) { - - if(this.publicationList[folderId]) { - + + if(this.publicationList[folderId]) { + this.publicationList[folderId] = this.publicationList[folderId].filter( e => e.DocumentId != DocumentId) - + this.save(folderId) - } + } } getPublicationDetail(folderId) { - - this.publications.GetPresidentialAction(folderId).subscribe(res => { + + this.publications.GetPresidentialAction(folderId).subscribe(res => { this.FolderDetails[folderId] = res this.storage.set(folderId+"name", res) }, (error) => { @@ -113,7 +113,7 @@ export class PublicationFolderService { try { const publicationIds = await this.publications.GetPublicationsList(folderId).toPromise(); - + this.createPublicationList(folderId) let loadLater = [] for (let publicationId of publicationIds) { @@ -129,9 +129,9 @@ export class PublicationFolderService { for( let publicationId of loadLater) { await this.loadPublication(publicationId, folderId) } - + this.showLoader = false; - + this.storage.set(folderId, this.publicationList[folderId]); this.getpublication = this.publicationList[folderId]; } catch(error) { @@ -144,15 +144,29 @@ export class PublicationFolderService { async loadPublication(publicationId, folderId) { let Publication = await this.publications.GetPublicationWithArrayOfFilesById(publicationId).toPromise(); let publicationDetails: Publication = this.publicationPipe.itemList(Publication) - + const findIndex = this.publicationFindIndex(publicationId, folderId) const found = this.publicationIsPresent(publicationId, folderId) if(!found) { this.publicationList[folderId].push(publicationDetails) } else { - this.publicationList[folderId][findIndex] = publicationDetails + + let a: any = Object.assign({},this.publicationList[folderId][findIndex]) + let b: any = Object.assign({}, publicationDetails) + + a.Files = a.Files.length + b.Files = b.Files.length + + if(JSON.stringify(a) != JSON.stringify(b)) { + + // console.log({a, b}) + this.publicationList[folderId][findIndex] = publicationDetails + } else { + // console.log({publicationDetails}) + } + } - + } @@ -165,7 +179,7 @@ export class PublicationFolderService { async setPublication(publicationId, folderId, publicationDetails: Publication) { - + const findIndex = this.publicationFindIndex(publicationId, folderId) const found = this.publicationIsPresent(publicationId, folderId) if(!found) { @@ -173,13 +187,13 @@ export class PublicationFolderService { } else { this.publicationList[folderId][findIndex] = publicationDetails } - + } async getPublication(publicationId, folderId, publicationDetails: Publication) { - + const findIndex = this.publicationFindIndex(publicationId, folderId) const found = this.publicationIsPresent(publicationId, folderId) if(!found) { @@ -187,7 +201,7 @@ export class PublicationFolderService { } else { return this.publicationList[folderId][findIndex] } - + } @@ -198,7 +212,7 @@ export class PublicationFolderService { } else { } - + }