From 9f69de0f49c9151508374ae15633d122790d17d8 Mon Sep 17 00:00:00 2001
From: Thomas <4159106+dtslvr@users.noreply.github.com>
Date: Mon, 24 May 2021 09:05:13 +0200
Subject: [PATCH] Refactor cd to changeDetectorRef

---
 apps/client/src/app/app.component.ts             |  4 ++--
 .../performance-chart-dialog.component.ts        |  4 ++--
 .../position-detail-dialog.component.ts          |  4 ++--
 .../src/app/pages/about/about-page.component.ts  |  4 ++--
 .../app/pages/account/account-page.component.ts  |  8 ++++----
 .../pages/accounts/accounts-page.component.ts    |  6 +++---
 .../src/app/pages/admin/admin-page.component.ts  |  4 ++--
 .../pages/analysis/analysis-page.component.ts    |  8 ++++----
 .../src/app/pages/home/home-page.component.ts    | 16 ++++++++--------
 .../src/app/pages/login/login-page.component.ts  |  4 ++--
 .../show-access-token-dialog.component.ts        |  4 ++--
 .../app/pages/pricing/pricing-page.component.ts  |  4 ++--
 .../app/pages/report/report-page.component.ts    |  4 ++--
 ...ate-or-update-transaction-dialog.component.ts |  6 +++---
 .../transactions/transactions-page.component.ts  |  6 +++---
 .../src/app/pages/zen/zen-page.component.ts      | 10 +++++-----
 16 files changed, 48 insertions(+), 48 deletions(-)

diff --git a/apps/client/src/app/app.component.ts b/apps/client/src/app/app.component.ts
index f7d5ccff9..339d4712a 100644
--- a/apps/client/src/app/app.component.ts
+++ b/apps/client/src/app/app.component.ts
@@ -37,7 +37,7 @@ export class AppComponent implements OnDestroy, OnInit {
   private unsubscribeSubject = new Subject<void>();
 
   public constructor(
-    private cd: ChangeDetectorRef,
+    private changeDetectorRef: ChangeDetectorRef,
     private dataService: DataService,
     private deviceService: DeviceDetectorService,
     private materialCssVarsService: MaterialCssVarsService,
@@ -80,7 +80,7 @@ export class AppComponent implements OnDestroy, OnInit {
           this.user = null;
         }
 
-        this.cd.markForCheck();
+        this.changeDetectorRef.markForCheck();
       });
   }
 
diff --git a/apps/client/src/app/components/performance-chart-dialog/performance-chart-dialog.component.ts b/apps/client/src/app/components/performance-chart-dialog/performance-chart-dialog.component.ts
index e6f3acede..4086669c6 100644
--- a/apps/client/src/app/components/performance-chart-dialog/performance-chart-dialog.component.ts
+++ b/apps/client/src/app/components/performance-chart-dialog/performance-chart-dialog.component.ts
@@ -28,7 +28,7 @@ export class PerformanceChartDialog {
   public title: string;
 
   public constructor(
-    private cd: ChangeDetectorRef,
+    private changeDetectorRef: ChangeDetectorRef,
     private dataService: DataService,
     public dialogRef: MatDialogRef<PerformanceChartDialog>,
     @Inject(MAT_DIALOG_DATA) public data: PositionDetailDialogParams
@@ -75,7 +75,7 @@ export class PerformanceChartDialog {
           }
         });
 
-        this.cd.markForCheck();
+        this.changeDetectorRef.markForCheck();
       });
 
     this.title = `Performance vs. ${this.benchmarkLabel}`;
diff --git a/apps/client/src/app/components/position/position-detail-dialog/position-detail-dialog.component.ts b/apps/client/src/app/components/position/position-detail-dialog/position-detail-dialog.component.ts
index 4597b12ce..161d45399 100644
--- a/apps/client/src/app/components/position/position-detail-dialog/position-detail-dialog.component.ts
+++ b/apps/client/src/app/components/position/position-detail-dialog/position-detail-dialog.component.ts
@@ -34,7 +34,7 @@ export class PositionDetailDialog {
   public transactionCount: number;
 
   public constructor(
-    private cd: ChangeDetectorRef,
+    private changeDetectorRef: ChangeDetectorRef,
     private dataService: DataService,
     public dialogRef: MatDialogRef<PositionDetailDialog>,
     @Inject(MAT_DIALOG_DATA) public data: PositionDetailDialogParams
@@ -127,7 +127,7 @@ export class PositionDetailDialog {
             this.benchmarkDataItems[0].value = this.averagePrice;
           }
 
-          this.cd.markForCheck();
+          this.changeDetectorRef.markForCheck();
         }
       );
   }
diff --git a/apps/client/src/app/pages/about/about-page.component.ts b/apps/client/src/app/pages/about/about-page.component.ts
index 0d9db45a5..03d684d46 100644
--- a/apps/client/src/app/pages/about/about-page.component.ts
+++ b/apps/client/src/app/pages/about/about-page.component.ts
@@ -25,7 +25,7 @@ export class AboutPageComponent implements OnInit {
    * @constructor
    */
   public constructor(
-    private cd: ChangeDetectorRef,
+    private changeDetectorRef: ChangeDetectorRef,
     private userService: UserService
   ) {}
 
@@ -39,7 +39,7 @@ export class AboutPageComponent implements OnInit {
         if (state?.user) {
           this.user = state.user;
 
-          this.cd.markForCheck();
+          this.changeDetectorRef.markForCheck();
         }
       });
   }
diff --git a/apps/client/src/app/pages/account/account-page.component.ts b/apps/client/src/app/pages/account/account-page.component.ts
index fb25010c9..ed70a2561 100644
--- a/apps/client/src/app/pages/account/account-page.component.ts
+++ b/apps/client/src/app/pages/account/account-page.component.ts
@@ -28,7 +28,7 @@ export class AccountPageComponent implements OnDestroy, OnInit {
    * @constructor
    */
   public constructor(
-    private cd: ChangeDetectorRef,
+    private changeDetectorRef: ChangeDetectorRef,
     private dataService: DataService,
     private userService: UserService
   ) {
@@ -55,7 +55,7 @@ export class AccountPageComponent implements OnDestroy, OnInit {
             permissions.updateUserSettings
           );
 
-          this.cd.markForCheck();
+          this.changeDetectorRef.markForCheck();
         }
       });
   }
@@ -85,7 +85,7 @@ export class AccountPageComponent implements OnDestroy, OnInit {
           .subscribe((user) => {
             this.user = user;
 
-            this.cd.markForCheck();
+            this.changeDetectorRef.markForCheck();
           });
       });
   }
@@ -102,7 +102,7 @@ export class AccountPageComponent implements OnDestroy, OnInit {
       .subscribe((response) => {
         this.accesses = response;
 
-        this.cd.markForCheck();
+        this.changeDetectorRef.markForCheck();
       });
   }
 }
diff --git a/apps/client/src/app/pages/accounts/accounts-page.component.ts b/apps/client/src/app/pages/accounts/accounts-page.component.ts
index b86e8599b..a2de77c26 100644
--- a/apps/client/src/app/pages/accounts/accounts-page.component.ts
+++ b/apps/client/src/app/pages/accounts/accounts-page.component.ts
@@ -35,7 +35,7 @@ export class AccountsPageComponent implements OnInit {
    * @constructor
    */
   public constructor(
-    private cd: ChangeDetectorRef,
+    private changeDetectorRef: ChangeDetectorRef,
     private dataService: DataService,
     private deviceService: DeviceDetectorService,
     private dialog: MatDialog,
@@ -90,7 +90,7 @@ export class AccountsPageComponent implements OnInit {
             permissions.deleteAccount
           );
 
-          this.cd.markForCheck();
+          this.changeDetectorRef.markForCheck();
         }
       });
 
@@ -105,7 +105,7 @@ export class AccountsPageComponent implements OnInit {
         this.router.navigate([], { queryParams: { createDialog: true } });
       }
 
-      this.cd.markForCheck();
+      this.changeDetectorRef.markForCheck();
     });
   }
 
diff --git a/apps/client/src/app/pages/admin/admin-page.component.ts b/apps/client/src/app/pages/admin/admin-page.component.ts
index c715983d8..79a739d02 100644
--- a/apps/client/src/app/pages/admin/admin-page.component.ts
+++ b/apps/client/src/app/pages/admin/admin-page.component.ts
@@ -32,7 +32,7 @@ export class AdminPageComponent implements OnInit {
   public constructor(
     private adminService: AdminService,
     private cacheService: CacheService,
-    private cd: ChangeDetectorRef,
+    private changeDetectorRef: ChangeDetectorRef,
     private dataService: DataService,
     private userService: UserService
   ) {}
@@ -139,7 +139,7 @@ export class AdminPageComponent implements OnInit {
           this.transactionCount = transactionCount;
           this.userCount = userCount;
 
-          this.cd.markForCheck();
+          this.changeDetectorRef.markForCheck();
         }
       );
   }
diff --git a/apps/client/src/app/pages/analysis/analysis-page.component.ts b/apps/client/src/app/pages/analysis/analysis-page.component.ts
index 7d68b6f12..541f7cffc 100644
--- a/apps/client/src/app/pages/analysis/analysis-page.component.ts
+++ b/apps/client/src/app/pages/analysis/analysis-page.component.ts
@@ -40,7 +40,7 @@ export class AnalysisPageComponent implements OnDestroy, OnInit {
    * @constructor
    */
   public constructor(
-    private cd: ChangeDetectorRef,
+    private changeDetectorRef: ChangeDetectorRef,
     private dataService: DataService,
     private deviceService: DeviceDetectorService,
     private impersonationStorageService: ImpersonationStorageService,
@@ -66,7 +66,7 @@ export class AnalysisPageComponent implements OnDestroy, OnInit {
       .subscribe((response) => {
         this.portfolioItems = response;
 
-        this.cd.markForCheck();
+        this.changeDetectorRef.markForCheck();
       });
 
     this.dataService
@@ -76,7 +76,7 @@ export class AnalysisPageComponent implements OnDestroy, OnInit {
         this.portfolioPositions = response;
         this.initializeAnalysisData(this.portfolioPositions, this.period);
 
-        this.cd.markForCheck();
+        this.changeDetectorRef.markForCheck();
       });
 
     this.userService.stateChanged
@@ -85,7 +85,7 @@ export class AnalysisPageComponent implements OnDestroy, OnInit {
         if (state?.user) {
           this.user = state.user;
 
-          this.cd.markForCheck();
+          this.changeDetectorRef.markForCheck();
         }
       });
   }
diff --git a/apps/client/src/app/pages/home/home-page.component.ts b/apps/client/src/app/pages/home/home-page.component.ts
index df1f1397e..966ecd86c 100644
--- a/apps/client/src/app/pages/home/home-page.component.ts
+++ b/apps/client/src/app/pages/home/home-page.component.ts
@@ -58,7 +58,7 @@ export class HomePageComponent implements OnDestroy, OnInit {
    * @constructor
    */
   public constructor(
-    private cd: ChangeDetectorRef,
+    private changeDetectorRef: ChangeDetectorRef,
     private dataService: DataService,
     private deviceService: DeviceDetectorService,
     private dialog: MatDialog,
@@ -94,7 +94,7 @@ export class HomePageComponent implements OnDestroy, OnInit {
               .subscribe(({ marketPrice }) => {
                 this.fearAndGreedIndex = marketPrice;
 
-                this.cd.markForCheck();
+                this.changeDetectorRef.markForCheck();
               });
           }
 
@@ -103,7 +103,7 @@ export class HomePageComponent implements OnDestroy, OnInit {
             permissions.readForeignPortfolio
           );
 
-          this.cd.markForCheck();
+          this.changeDetectorRef.markForCheck();
         }
       });
   }
@@ -169,7 +169,7 @@ export class HomePageComponent implements OnDestroy, OnInit {
           };
         });
 
-        this.cd.markForCheck();
+        this.changeDetectorRef.markForCheck();
       });
 
     this.dataService
@@ -178,14 +178,14 @@ export class HomePageComponent implements OnDestroy, OnInit {
         this.performance = response;
         this.isLoadingPerformance = false;
 
-        this.cd.markForCheck();
+        this.changeDetectorRef.markForCheck();
       });
 
     this.dataService.fetchPortfolioOverview().subscribe((response) => {
       this.overview = response;
       this.isLoadingOverview = false;
 
-      this.cd.markForCheck();
+      this.changeDetectorRef.markForCheck();
     });
 
     this.dataService
@@ -195,9 +195,9 @@ export class HomePageComponent implements OnDestroy, OnInit {
         this.hasPositions =
           this.positions && Object.keys(this.positions).length > 0;
 
-        this.cd.markForCheck();
+        this.changeDetectorRef.markForCheck();
       });
 
-    this.cd.markForCheck();
+    this.changeDetectorRef.markForCheck();
   }
 }
diff --git a/apps/client/src/app/pages/login/login-page.component.ts b/apps/client/src/app/pages/login/login-page.component.ts
index d2a6f198f..ba3ea827c 100644
--- a/apps/client/src/app/pages/login/login-page.component.ts
+++ b/apps/client/src/app/pages/login/login-page.component.ts
@@ -26,7 +26,7 @@ export class LoginPageComponent implements OnDestroy, OnInit {
    * @constructor
    */
   public constructor(
-    private cd: ChangeDetectorRef,
+    private changeDetectorRef: ChangeDetectorRef,
     private dataService: DataService,
     private dialog: MatDialog,
     private router: Router,
@@ -42,7 +42,7 @@ export class LoginPageComponent implements OnDestroy, OnInit {
 
       this.initializeLineChart();
 
-      this.cd.markForCheck();
+      this.changeDetectorRef.markForCheck();
     });
   }
 
diff --git a/apps/client/src/app/pages/login/show-access-token-dialog/show-access-token-dialog.component.ts b/apps/client/src/app/pages/login/show-access-token-dialog/show-access-token-dialog.component.ts
index b68f8b52d..b3f987398 100644
--- a/apps/client/src/app/pages/login/show-access-token-dialog/show-access-token-dialog.component.ts
+++ b/apps/client/src/app/pages/login/show-access-token-dialog/show-access-token-dialog.component.ts
@@ -16,7 +16,7 @@ export class ShowAccessTokenDialog {
   public isAgreeButtonDisabled = true;
 
   public constructor(
-    private cd: ChangeDetectorRef,
+    private changeDetectorRef: ChangeDetectorRef,
     @Inject(MAT_DIALOG_DATA) public data: any
   ) {}
 
@@ -26,7 +26,7 @@ export class ShowAccessTokenDialog {
     setTimeout(() => {
       this.isAgreeButtonDisabled = false;
 
-      this.cd.markForCheck();
+      this.changeDetectorRef.markForCheck();
     }, 1500);
   }
 }
diff --git a/apps/client/src/app/pages/pricing/pricing-page.component.ts b/apps/client/src/app/pages/pricing/pricing-page.component.ts
index 650baa890..fe4a4df8b 100644
--- a/apps/client/src/app/pages/pricing/pricing-page.component.ts
+++ b/apps/client/src/app/pages/pricing/pricing-page.component.ts
@@ -21,7 +21,7 @@ export class PricingPageComponent implements OnInit {
    * @constructor
    */
   public constructor(
-    private cd: ChangeDetectorRef,
+    private changeDetectorRef: ChangeDetectorRef,
     private userService: UserService
   ) {}
 
@@ -35,7 +35,7 @@ export class PricingPageComponent implements OnInit {
         if (state?.user) {
           this.user = state.user;
 
-          this.cd.markForCheck();
+          this.changeDetectorRef.markForCheck();
         }
       });
   }
diff --git a/apps/client/src/app/pages/report/report-page.component.ts b/apps/client/src/app/pages/report/report-page.component.ts
index 4f6e3d0e4..2e4f062f3 100644
--- a/apps/client/src/app/pages/report/report-page.component.ts
+++ b/apps/client/src/app/pages/report/report-page.component.ts
@@ -20,7 +20,7 @@ export class ReportPageComponent implements OnInit {
    * @constructor
    */
   public constructor(
-    private cd: ChangeDetectorRef,
+    private changeDetectorRef: ChangeDetectorRef,
     private dataService: DataService
   ) {}
 
@@ -38,7 +38,7 @@ export class ReportPageComponent implements OnInit {
           portfolioReport.rules['currencyClusterRisk'] || null;
         this.feeRules = portfolioReport.rules['fees'] || null;
 
-        this.cd.markForCheck();
+        this.changeDetectorRef.markForCheck();
       });
   }
 
diff --git a/apps/client/src/app/pages/transactions/create-or-update-transaction-dialog/create-or-update-transaction-dialog.component.ts b/apps/client/src/app/pages/transactions/create-or-update-transaction-dialog/create-or-update-transaction-dialog.component.ts
index 798eab8e5..cf942cc9c 100644
--- a/apps/client/src/app/pages/transactions/create-or-update-transaction-dialog/create-or-update-transaction-dialog.component.ts
+++ b/apps/client/src/app/pages/transactions/create-or-update-transaction-dialog/create-or-update-transaction-dialog.component.ts
@@ -42,7 +42,7 @@ export class CreateOrUpdateTransactionDialog {
   private unsubscribeSubject = new Subject<void>();
 
   public constructor(
-    private cd: ChangeDetectorRef,
+    private changeDetectorRef: ChangeDetectorRef,
     private dataService: DataService,
     public dialogRef: MatDialogRef<CreateOrUpdateTransactionDialog>,
     @Inject(MAT_DIALOG_DATA) public data: CreateOrUpdateTransactionDialogParams
@@ -73,7 +73,7 @@ export class CreateOrUpdateTransactionDialog {
         .pipe(takeUntil(this.unsubscribeSubject))
         .subscribe(({ marketPrice }) => {
           this.currentMarketPrice = marketPrice;
-          this.cd.markForCheck();
+          this.changeDetectorRef.markForCheck();
         });
     }
   }
@@ -100,7 +100,7 @@ export class CreateOrUpdateTransactionDialog {
 
         this.isLoading = false;
 
-        this.cd.markForCheck();
+        this.changeDetectorRef.markForCheck();
       });
   }
 
diff --git a/apps/client/src/app/pages/transactions/transactions-page.component.ts b/apps/client/src/app/pages/transactions/transactions-page.component.ts
index ba38adfac..684535d6b 100644
--- a/apps/client/src/app/pages/transactions/transactions-page.component.ts
+++ b/apps/client/src/app/pages/transactions/transactions-page.component.ts
@@ -35,7 +35,7 @@ export class TransactionsPageComponent implements OnInit {
    * @constructor
    */
   public constructor(
-    private cd: ChangeDetectorRef,
+    private changeDetectorRef: ChangeDetectorRef,
     private dataService: DataService,
     private deviceService: DeviceDetectorService,
     private dialog: MatDialog,
@@ -90,7 +90,7 @@ export class TransactionsPageComponent implements OnInit {
             permissions.deleteOrder
           );
 
-          this.cd.markForCheck();
+          this.changeDetectorRef.markForCheck();
         }
       });
 
@@ -105,7 +105,7 @@ export class TransactionsPageComponent implements OnInit {
         this.router.navigate([], { queryParams: { createDialog: true } });
       }
 
-      this.cd.markForCheck();
+      this.changeDetectorRef.markForCheck();
     });
   }
 
diff --git a/apps/client/src/app/pages/zen/zen-page.component.ts b/apps/client/src/app/pages/zen/zen-page.component.ts
index 83596f7fe..ccb71b063 100644
--- a/apps/client/src/app/pages/zen/zen-page.component.ts
+++ b/apps/client/src/app/pages/zen/zen-page.component.ts
@@ -31,7 +31,7 @@ export class ZenPageComponent implements OnDestroy, OnInit {
    * @constructor
    */
   public constructor(
-    private cd: ChangeDetectorRef,
+    private changeDetectorRef: ChangeDetectorRef,
     private dataService: DataService,
     private deviceService: DeviceDetectorService,
     private impersonationStorageService: ImpersonationStorageService,
@@ -48,7 +48,7 @@ export class ZenPageComponent implements OnDestroy, OnInit {
             permissions.readForeignPortfolio
           );
 
-          this.cd.markForCheck();
+          this.changeDetectorRef.markForCheck();
         }
       });
   }
@@ -86,7 +86,7 @@ export class ZenPageComponent implements OnDestroy, OnInit {
           };
         });
 
-        this.cd.markForCheck();
+        this.changeDetectorRef.markForCheck();
       });
 
     this.dataService
@@ -95,9 +95,9 @@ export class ZenPageComponent implements OnDestroy, OnInit {
         this.performance = response;
         this.isLoadingPerformance = false;
 
-        this.cd.markForCheck();
+        this.changeDetectorRef.markForCheck();
       });
 
-    this.cd.markForCheck();
+    this.changeDetectorRef.markForCheck();
   }
 }