From fe732a199764f0a5599892ae9c3106aa381504e4 Mon Sep 17 00:00:00 2001 From: Peter Maquiran Date: Wed, 29 Nov 2023 16:12:30 +0100 Subject: [PATCH 1/3] add redirect message --- src/app/app-routing.module.ts | 4 + ...dleware-remote-datasourcec.service.spec.ts | 16 ---- .../middleware-remote-datasourcec.service.ts | 17 ---- src/app/home/home-routing.module.ts | 5 +- src/app/pages/events/events.page.ts | 42 +++++----- .../not-found/not-found-routing.module.ts | 17 ++++ src/app/pages/not-found/not-found.module.ts | 20 +++++ src/app/pages/not-found/not-found.page.html | 1 + src/app/pages/not-found/not-found.page.scss | 0 .../pages/not-found/not-found.page.spec.ts | 24 ++++++ src/app/pages/not-found/not-found.page.ts | 22 +++++ .../middleware-repository.service.spec.ts | 16 ---- .../middleware-repository.service.ts | 16 ---- .../token-interceptor.service.spec.ts | 16 ---- .../interceptor/token-interceptor.service.ts | 81 ------------------- web.config | 2 +- 16 files changed, 114 insertions(+), 185 deletions(-) delete mode 100644 src/app/datasource/middleware/remote/middleware-remote-datasourcec.service.spec.ts delete mode 100644 src/app/datasource/middleware/remote/middleware-remote-datasourcec.service.ts create mode 100644 src/app/pages/not-found/not-found-routing.module.ts create mode 100644 src/app/pages/not-found/not-found.module.ts create mode 100644 src/app/pages/not-found/not-found.page.html create mode 100644 src/app/pages/not-found/not-found.page.scss create mode 100644 src/app/pages/not-found/not-found.page.spec.ts create mode 100644 src/app/pages/not-found/not-found.page.ts delete mode 100644 src/app/repository/middleWare/middleware-repository.service.spec.ts delete mode 100644 src/app/repository/middleWare/middleware-repository.service.ts delete mode 100644 src/app/services/interceptor/token-interceptor.service.spec.ts delete mode 100644 src/app/services/interceptor/token-interceptor.service.ts diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index a4d9de6c0..d06f42c16 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -292,6 +292,10 @@ const routes = [ { path: 'popup-question', loadChildren: () => import('./modals/popup-question/popup-question.module').then( m => m.PopupQuestionPageModule) + }, + { + path: 'not-found', + loadChildren: () => import('./pages/not-found/not-found.module').then( m => m.NotFoundPageModule) } diff --git a/src/app/datasource/middleware/remote/middleware-remote-datasourcec.service.spec.ts b/src/app/datasource/middleware/remote/middleware-remote-datasourcec.service.spec.ts deleted file mode 100644 index 15fd47731..000000000 --- a/src/app/datasource/middleware/remote/middleware-remote-datasourcec.service.spec.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { TestBed } from '@angular/core/testing'; - -import { MiddlewareRemoteDatasourcecService } from './middleware-remote-datasourcec.service'; - -describe('MiddlewareRemoteDatasourcecService', () => { - let service: MiddlewareRemoteDatasourcecService; - - beforeEach(() => { - TestBed.configureTestingModule({}); - service = TestBed.inject(MiddlewareRemoteDatasourcecService); - }); - - it('should be created', () => { - expect(service).toBeTruthy(); - }); -}); diff --git a/src/app/datasource/middleware/remote/middleware-remote-datasourcec.service.ts b/src/app/datasource/middleware/remote/middleware-remote-datasourcec.service.ts deleted file mode 100644 index 487ac3e30..000000000 --- a/src/app/datasource/middleware/remote/middleware-remote-datasourcec.service.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { Injectable } from '@angular/core'; -import { SessionStore } from "src/app/store/session.service" -import { MiddlewareServiceService } from "src/app/shared/API/middleware/middleware-service.service" -@Injectable({ - providedIn: 'root' -}) -export class MiddlewareRemoteDatasourcecService { - - constructor( - private MiddlewareServiceService: MiddlewareServiceService, - ) {} - - refreshToken() { - const refreshToken = SessionStore.user.Authorization - return this.MiddlewareServiceService.refreshToken(refreshToken) - } -} diff --git a/src/app/home/home-routing.module.ts b/src/app/home/home-routing.module.ts index 11b56d38d..53b16aa2f 100644 --- a/src/app/home/home-routing.module.ts +++ b/src/app/home/home-routing.module.ts @@ -414,7 +414,10 @@ const routes: Routes = [ }, - { path: '**', redirectTo: '/', pathMatch: 'full' }, + { + path: '**', + loadChildren: ()=> import('../pages/not-found/not-found.module').then(m => m.NotFoundPageModule), + }, ]; @NgModule({ diff --git a/src/app/pages/events/events.page.ts b/src/app/pages/events/events.page.ts index 8c1b7c939..847a69cda 100644 --- a/src/app/pages/events/events.page.ts +++ b/src/app/pages/events/events.page.ts @@ -92,7 +92,7 @@ export class EventsPage implements OnInit { private changeProfileService: ChangeProfileService, public TaskService: TaskService ) { - + window['zipPhoneCallback'] = function (zipphone) { var frame = document.getElementById('home-iframe'); if(frame) { @@ -113,7 +113,7 @@ export class EventsPage implements OnInit { } ngAfterViewInit(): void { - + this.loadAllTask(); @@ -123,9 +123,9 @@ export class EventsPage implements OnInit { this.dynamicSearch() } }) - + this.dynamicSearch() - + } ngOnDestroy() { @@ -161,20 +161,20 @@ export class EventsPage implements OnInit { const ordinance = this.ordinance if(this.showSearch && this.searchSubject) { - + const AllProcess = this.TaskService.AllProcess.filter((task) => { let subject = task.Folio || task.Subject || task.workflowInstanceDataFields.Subject subject = subject.toLowerCase(); return subject.includes(this.searchSubject.toLowerCase()) }).filter( task => this.TaskService.filter(task, this.filterName)) - + if(ordinance == this.ordinance) { - this.AllProcess = this.TaskService.reorderList(this.ordinance, AllProcess) + this.AllProcess = this.TaskService.reorderList(this.ordinance, AllProcess) } } else { const AllProcess = this.TaskService.AllProcess - + if(ordinance == this.ordinance) { this.AllProcess = this.TaskService.reorderList(this.ordinance, AllProcess) .filter( task => this.TaskService.filter(task, this.filterName)) @@ -205,7 +205,7 @@ export class EventsPage implements OnInit { } catch(error) {} }, 2000); } - + this.RefreshEvents(); this.LoadList(); this.loadAllTask(); @@ -218,7 +218,7 @@ export class EventsPage implements OnInit { async RefreshEvents() { - + this.currentEvent = ""; this.showLoader = true; this.showAgendaLoader = true; @@ -256,7 +256,7 @@ export class EventsPage implements OnInit { let dateToday = date.getFullYear() + "-" + month + "-" + date.getDate(); this.storage.get('events').then((events: any[] = []) => { - // + // if(Array.isArray(events)) { this.listToPresent = events @@ -271,7 +271,7 @@ export class EventsPage implements OnInit { } catch (error) {} } - // + // }) @@ -299,19 +299,19 @@ export class EventsPage implements OnInit { changeProfile() { if (this.profile == "mdgpr") { - // + // this.profile = "pr"; this.RefreshEvents(); } else { - // + // this.profile = "mdgpr"; this.RefreshEvents(); } } async openEventDetail1(id: any) { - // + // const modal = await this.modalController.create({ component: EventDetailPage, @@ -328,7 +328,7 @@ export class EventsPage implements OnInit { } async openEventDetail(id: any) { - // + // const modal = await this.modalController.create({ component: ViewEventPage, @@ -338,7 +338,7 @@ export class EventsPage implements OnInit { cssClass: 'view-event', backdropDismiss: false }); - + modal.onDidDismiss(); await modal.present(); @@ -358,7 +358,7 @@ export class EventsPage implements OnInit { window['all-process-gabinete']() } - + } sortArrayISODate(myArray: any) { @@ -375,9 +375,9 @@ export class EventsPage implements OnInit { } goToAllTaskFilter(event: any) { - let navigationExtras: NavigationExtras = { queryParams: { + let navigationExtras: NavigationExtras = { queryParams: { filter: event, - processes: true + processes: true } } @@ -407,4 +407,4 @@ export class EventsPage implements OnInit { } } -} \ No newline at end of file +} diff --git a/src/app/pages/not-found/not-found-routing.module.ts b/src/app/pages/not-found/not-found-routing.module.ts new file mode 100644 index 000000000..6d73b581a --- /dev/null +++ b/src/app/pages/not-found/not-found-routing.module.ts @@ -0,0 +1,17 @@ +import { NgModule } from '@angular/core'; +import { Routes, RouterModule } from '@angular/router'; + +import { NotFoundPage } from './not-found.page'; + +const routes: Routes = [ + { + path: '', + component: NotFoundPage + } +]; + +@NgModule({ + imports: [RouterModule.forChild(routes)], + exports: [RouterModule], +}) +export class NotFoundPageRoutingModule {} diff --git a/src/app/pages/not-found/not-found.module.ts b/src/app/pages/not-found/not-found.module.ts new file mode 100644 index 000000000..4dec837fa --- /dev/null +++ b/src/app/pages/not-found/not-found.module.ts @@ -0,0 +1,20 @@ +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { FormsModule } from '@angular/forms'; + +import { IonicModule } from '@ionic/angular'; + +import { NotFoundPageRoutingModule } from './not-found-routing.module'; + +import { NotFoundPage } from './not-found.page'; + +@NgModule({ + imports: [ + CommonModule, + FormsModule, + IonicModule, + NotFoundPageRoutingModule + ], + declarations: [NotFoundPage] +}) +export class NotFoundPageModule {} diff --git a/src/app/pages/not-found/not-found.page.html b/src/app/pages/not-found/not-found.page.html new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/src/app/pages/not-found/not-found.page.html @@ -0,0 +1 @@ + diff --git a/src/app/pages/not-found/not-found.page.scss b/src/app/pages/not-found/not-found.page.scss new file mode 100644 index 000000000..e69de29bb diff --git a/src/app/pages/not-found/not-found.page.spec.ts b/src/app/pages/not-found/not-found.page.spec.ts new file mode 100644 index 000000000..e502e3640 --- /dev/null +++ b/src/app/pages/not-found/not-found.page.spec.ts @@ -0,0 +1,24 @@ +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; +import { IonicModule } from '@ionic/angular'; + +import { NotFoundPage } from './not-found.page'; + +describe('NotFoundPage', () => { + let component: NotFoundPage; + let fixture: ComponentFixture; + + beforeEach(waitForAsync(() => { + TestBed.configureTestingModule({ + declarations: [ NotFoundPage ], + imports: [IonicModule.forRoot()] + }).compileComponents(); + + fixture = TestBed.createComponent(NotFoundPage); + component = fixture.componentInstance; + fixture.detectChanges(); + })); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/pages/not-found/not-found.page.ts b/src/app/pages/not-found/not-found.page.ts new file mode 100644 index 000000000..7d9debdd3 --- /dev/null +++ b/src/app/pages/not-found/not-found.page.ts @@ -0,0 +1,22 @@ +import { Component, OnInit } from '@angular/core'; +import { Router } from '@angular/router'; +import { ToastService } from 'src/app/services/toast.service'; + +@Component({ + selector: 'app-not-found', + templateUrl: './not-found.page.html', + styleUrls: ['./not-found.page.scss'], +}) +export class NotFoundPage implements OnInit { + + constructor( + private router: Router, + private toastService: ToastService, + ) { } + + ngOnInit() { + this.router.navigate(['/home/events']); + this.toastService._badRequest("Página não encontrada") + } + +} diff --git a/src/app/repository/middleWare/middleware-repository.service.spec.ts b/src/app/repository/middleWare/middleware-repository.service.spec.ts deleted file mode 100644 index b9ffd7e10..000000000 --- a/src/app/repository/middleWare/middleware-repository.service.spec.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { TestBed } from '@angular/core/testing'; - -import { MiddlewareRepositoryService } from './middleware-repository.service'; - -describe('MiddlewareRepositoryService', () => { - let service: MiddlewareRepositoryService; - - beforeEach(() => { - TestBed.configureTestingModule({}); - service = TestBed.inject(MiddlewareRepositoryService); - }); - - it('should be created', () => { - expect(service).toBeTruthy(); - }); -}); diff --git a/src/app/repository/middleWare/middleware-repository.service.ts b/src/app/repository/middleWare/middleware-repository.service.ts deleted file mode 100644 index bf24fd68a..000000000 --- a/src/app/repository/middleWare/middleware-repository.service.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { Injectable } from '@angular/core'; -import { MiddlewareRemoteDatasourcecService } from "src/app/datasource/middleware/remote/middleware-remote-datasourcec.service"; -@Injectable({ - providedIn: 'root' -}) -export class MiddlewareRepositoryService { - - constructor( - private MiddlewareRemoteDatasourcecService: MiddlewareRemoteDatasourcecService, - ) {} - - refreshToken() { - return this.MiddlewareRemoteDatasourcecService.refreshToken() - } - -} diff --git a/src/app/services/interceptor/token-interceptor.service.spec.ts b/src/app/services/interceptor/token-interceptor.service.spec.ts deleted file mode 100644 index b3ca21c33..000000000 --- a/src/app/services/interceptor/token-interceptor.service.spec.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { TestBed } from '@angular/core/testing'; - -import { TokenInterceptorService } from './token-interceptor.service'; - -describe('TokenInterceptorService', () => { - let service: TokenInterceptorService; - - beforeEach(() => { - TestBed.configureTestingModule({}); - service = TestBed.inject(TokenInterceptorService); - }); - - it('should be created', () => { - expect(service).toBeTruthy(); - }); -}); diff --git a/src/app/services/interceptor/token-interceptor.service.ts b/src/app/services/interceptor/token-interceptor.service.ts deleted file mode 100644 index 497721f84..000000000 --- a/src/app/services/interceptor/token-interceptor.service.ts +++ /dev/null @@ -1,81 +0,0 @@ -import { Injectable } from "@angular/core"; -import { - HttpRequest, - HttpHandler, - HttpEvent, - HttpInterceptor, - HttpErrorResponse, - HTTP_INTERCEPTORS, -} from "@angular/common/http"; -import { Observable, throwError, BehaviorSubject } from "rxjs"; -import { catchError, filter, take, switchMap } from "rxjs/operators"; -import { SessionStore } from "src/app/store/session.service"; -import { MiddlewareRepositoryService } from "src/app/repository/middleWare/middleware-repository.service" - -@Injectable({ - providedIn: 'root' -}) -export class TokenInterceptorService { - - private isRefreshing = false; - private refreshTokenSubject: BehaviorSubject = new BehaviorSubject( - null - ); - - - constructor(private middlewareRepositoryService: MiddlewareRepositoryService) { - this.middlewareRepositoryService = middlewareRepositoryService - } - - intercept( - request: HttpRequest, - next: HttpHandler - ): Observable> { - if (SessionStore.user.Authorization) { - request = this.addToken(request, SessionStore.user.Authorization); - } - - return next.handle(request).pipe( - catchError((error) => { - if (error instanceof HttpErrorResponse && error.status === 401) { - return this.handle401Error(request, next); - } else { - return throwError(error); - } - }) - ) as any - } - - private addToken(request: HttpRequest, token: string) { - return request.clone({ - setHeaders: { - Authorization: `Bearer ${token}`, - }, - }); - } - - private handle401Error(request: HttpRequest, next: HttpHandler) { - if (!this.isRefreshing) { - this.isRefreshing = true; - this.refreshTokenSubject.next(null); - - - - return this.middlewareRepositoryService.refreshToken().pipe( - switchMap((token: any) => { - this.isRefreshing = false; - this.refreshTokenSubject.next(token['result'].accessToken); - return next.handle(this.addToken(request, token['result'].accessToken)); - }) - ); - } else { - return this.refreshTokenSubject.pipe( - filter((token) => token != null), - take(1), - switchMap((jwt) => { - return next.handle(this.addToken(request, jwt)); - }) - ); - } - } -} diff --git a/web.config b/web.config index 166d482b4..1c8a36c6e 100644 --- a/web.config +++ b/web.config @@ -27,7 +27,7 @@ - + From e8c740ef6ad9034e70d8b6b9f0c7a295ab8166fd Mon Sep 17 00:00:00 2001 From: Peter Maquiran Date: Mon, 4 Dec 2023 08:34:57 +0100 Subject: [PATCH 2/3] 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 { } - + } From 81e2dc06f1cfdeb11c9f4b437921c882490270ed Mon Sep 17 00:00:00 2001 From: Peter Maquiran Date: Wed, 6 Dec 2023 12:09:27 +0100 Subject: [PATCH 3/3] remove alert --- .../publication/view-publications/view-publications.page.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 ad2d5e90d..706467ad5 100644 --- a/src/app/shared/publication/view-publications/view-publications.page.ts +++ b/src/app/shared/publication/view-publications/view-publications.page.ts @@ -62,8 +62,8 @@ export class ViewPublicationsPage implements OnInit { setTimeout(() => { - document.querySelector("swiper-container").shadowRoot.querySelector(".swiper-button-next").innerHTML = "ok" - alert("ok") + // document.querySelector("swiper-container").shadowRoot.querySelector(".swiper-button-next").innerHTML = "ok" + // alert("ok") // console.log("this.VideoManager", this.VideoManager, document.querySelector('.VideoManager')) /* this.publicationVideoManagerService.setContainer(this.VideoManager.nativeElement) */ }, 15000)