From 834892c834e5fe14ffa5b4f6893d94a39fa3ef1a Mon Sep 17 00:00:00 2001
From: Xiao Gui <xgui3783@gmail.com>
Date: Fri, 6 May 2022 09:28:17 +0200
Subject: [PATCH] chore: remove unused/deprecated

---
 .../nehubaViewer/nehubaViewer.component.ts      |  9 ---------
 .../nehubaViewerInterface.directive.ts          |  7 ++-----
 .../viewerCtrlCmp/viewerCtrlCmp.component.ts    | 17 -----------------
 3 files changed, 2 insertions(+), 31 deletions(-)

diff --git a/src/viewerModule/nehuba/nehubaViewer/nehubaViewer.component.ts b/src/viewerModule/nehuba/nehubaViewer/nehubaViewer.component.ts
index b739d5904..633778743 100644
--- a/src/viewerModule/nehuba/nehubaViewer/nehubaViewer.component.ts
+++ b/src/viewerModule/nehuba/nehubaViewer/nehubaViewer.component.ts
@@ -129,11 +129,6 @@ export class NehubaViewerUnit implements OnDestroy {
 
   public ondestroySubscriptions: Subscription[] = []
 
-  private createNehubaPromiseRs: () => void
-  private createNehubaPromise = new Promise<void>(rs => {
-    this.createNehubaPromiseRs = rs
-  })
-
   public nehubaLoaded: boolean = false
 
   public landmarksLoaded: boolean = false
@@ -182,10 +177,6 @@ export class NehubaViewerUnit implements OnDestroy {
         })
         viewer.registerDisposer(this.layersChangedHandler)
       })
-      .then(() => {
-        // all mutation to this.nehubaViewer should await createNehubaPromise
-        this.createNehubaPromiseRs()
-      })
       .catch(e => this.errorEmitter.emit(e))
 
 
diff --git a/src/viewerModule/nehuba/nehubaViewerInterface/nehubaViewerInterface.directive.ts b/src/viewerModule/nehuba/nehubaViewerInterface/nehubaViewerInterface.directive.ts
index c3109feb8..3c503c9fc 100644
--- a/src/viewerModule/nehuba/nehubaViewerInterface/nehubaViewerInterface.directive.ts
+++ b/src/viewerModule/nehuba/nehubaViewerInterface/nehubaViewerInterface.directive.ts
@@ -1,4 +1,4 @@
-import { Directive, ViewContainerRef, ComponentFactoryResolver, ComponentFactory, ComponentRef, OnDestroy, Output, EventEmitter, Optional, ChangeDetectorRef } from "@angular/core";
+import { Directive, ViewContainerRef, ComponentRef, OnDestroy, Output, EventEmitter, Optional, ChangeDetectorRef } from "@angular/core";
 import { NehubaViewerUnit } from "../nehubaViewer/nehubaViewer.component";
 import { Store, select } from "@ngrx/store";
 import { Subscription, Observable, asyncScheduler, combineLatest } from "rxjs";
@@ -151,12 +151,10 @@ export class NehubaViewerContainerDirective implements OnDestroy{
   @Output()
   public iavNehubaViewerContainerViewerLoading: EventEmitter<boolean> = new EventEmitter()
   
-  private nehubaViewerFactory: ComponentFactory<NehubaViewerUnit>
   private cr: ComponentRef<NehubaViewerUnit>
   private navigation: atlasSelection.AtlasSelectionState['navigation']
   constructor(
     private el: ViewContainerRef,
-    private cfr: ComponentFactoryResolver,
     private store$: Store<any>,
     private navService: NehubaNavigationService,
     private effect: LayerCtrlEffects,
@@ -164,7 +162,6 @@ export class NehubaViewerContainerDirective implements OnDestroy{
     @Optional() private log: LoggingService,
   ){
     this.cdr.detach()
-    this.nehubaViewerFactory = this.cfr.resolveComponentFactory(NehubaViewerUnit)
 
     this.subscriptions.push(
       this.nehubaViewerPerspectiveOctantRemoval$.pipe(
@@ -296,7 +293,7 @@ export class NehubaViewerContainerDirective implements OnDestroy{
     await new Promise(rs => setTimeout(rs, 0))
 
     this.iavNehubaViewerContainerViewerLoading.emit(true)
-    this.cr = this.el.createComponent(this.nehubaViewerFactory)
+    this.cr = this.el.createComponent(NehubaViewerUnit)
 
     if (this.navService.storeNav) {
       this.nehubaViewerInstance.initNav = {
diff --git a/src/viewerModule/nehuba/viewerCtrl/viewerCtrlCmp/viewerCtrlCmp.component.ts b/src/viewerModule/nehuba/viewerCtrl/viewerCtrlCmp/viewerCtrlCmp.component.ts
index ad8239b21..2a44980c9 100644
--- a/src/viewerModule/nehuba/viewerCtrl/viewerCtrlCmp/viewerCtrlCmp.component.ts
+++ b/src/viewerModule/nehuba/viewerCtrl/viewerCtrlCmp/viewerCtrlCmp.component.ts
@@ -47,23 +47,6 @@ export class ViewerCtrlCmp implements OnInit{
   )
 
   ngOnInit(): void {
-    
-    // TODO move this to... nehubadirective?
-    if (this.nehubaInst$) {
-      this.sub.push(
-        // combineLatest([
-        //   this.customLandmarks$,
-        //   this.nehubaInst$,
-        // ]).pipe(
-        //   filter(([_, nehubaInst]) => !!nehubaInst),
-        // ).subscribe(([landmarks, nehubainst]) => {
-        //   this.setOctantRemoval(landmarks.length === 0)
-        //   nehubainst.updateUserLandmarks(landmarks)
-        // }),
-      )
-    } else {
-      console.warn(`NEHUBA_INSTANCE_INJTKN not provided`)
-    }
 
     this.sub.push(
 
-- 
GitLab