From 62e2486417f094507d9372bd3165d3a5c725a662 Mon Sep 17 00:00:00 2001 From: Spencer Ofwiti Date: Wed, 30 Jun 2021 15:24:40 +0300 Subject: [PATCH] Clean up stale variables and lint code. --- src/app/_interceptors/error.interceptor.ts | 9 ++------- src/app/_services/auth.service.ts | 2 -- src/app/_services/block-sync.service.ts | 4 +--- src/app/_services/logging.service.ts | 3 --- src/app/_services/token.service.ts | 4 +--- src/app/_services/transaction.service.ts | 3 --- src/app/_services/user.service.ts | 6 +----- src/app/app.component.ts | 11 ++++++----- .../account-search.component.ts | 19 ------------------- src/app/pages/settings/settings.component.ts | 1 - src/app/pages/tokens/tokens.component.ts | 4 +--- 11 files changed, 12 insertions(+), 54 deletions(-) diff --git a/src/app/_interceptors/error.interceptor.ts b/src/app/_interceptors/error.interceptor.ts index 31e3812..a6ee321 100644 --- a/src/app/_interceptors/error.interceptor.ts +++ b/src/app/_interceptors/error.interceptor.ts @@ -14,7 +14,7 @@ import { Observable, throwError } from 'rxjs'; import { catchError } from 'rxjs/operators'; // Application imports -import { ErrorDialogService, LoggingService } from '@app/_services'; +import { LoggingService } from '@app/_services'; /** Intercepts and handles errors from outgoing HTTP request. */ @Injectable() @@ -22,15 +22,10 @@ export class ErrorInterceptor implements HttpInterceptor { /** * Initialization of the error interceptor. * - * @param errorDialogService - A service that provides a dialog box for displaying errors to the user. * @param loggingService - A service that provides logging capabilities. * @param router - A service that provides navigation among views and URL manipulation capabilities. */ - constructor( - private errorDialogService: ErrorDialogService, - private loggingService: LoggingService, - private router: Router - ) {} + constructor(private loggingService: LoggingService, private router: Router) {} /** * Intercepts HTTP requests. diff --git a/src/app/_services/auth.service.ts b/src/app/_services/auth.service.ts index 1022f54..e703bfa 100644 --- a/src/app/_services/auth.service.ts +++ b/src/app/_services/auth.service.ts @@ -5,7 +5,6 @@ import { environment } from '@src/environments/environment'; import { LoggingService } from '@app/_services/logging.service'; import { MutableKeyStore } from '@app/_pgp'; import { ErrorDialogService } from '@app/_services/error-dialog.service'; -import { HttpClient } from '@angular/common/http'; import { HttpError, rejectBody } from '@app/_helpers/global-error-handler'; import { Staff } from '@app/_models'; import { BehaviorSubject, Observable } from 'rxjs'; @@ -23,7 +22,6 @@ export class AuthService { trustedUsersSubject: Observable> = this.trustedUsersList.asObservable(); constructor( - private httpClient: HttpClient, private loggingService: LoggingService, private errorDialogService: ErrorDialogService ) {} diff --git a/src/app/_services/block-sync.service.ts b/src/app/_services/block-sync.service.ts index 987f0be..41bc89a 100644 --- a/src/app/_services/block-sync.service.ts +++ b/src/app/_services/block-sync.service.ts @@ -14,9 +14,7 @@ export class BlockSyncService { readyStateTarget: number = 2; readyState: number = 0; - constructor( - private transactionService: TransactionService, - ) {} + constructor(private transactionService: TransactionService) {} async blockSync(address: string = null, offset: number = 0, limit: number = 100): Promise { this.transactionService.resetTransactionsList(); diff --git a/src/app/_services/logging.service.ts b/src/app/_services/logging.service.ts index 0865e88..d7e38a1 100644 --- a/src/app/_services/logging.service.ts +++ b/src/app/_services/logging.service.ts @@ -5,9 +5,6 @@ import { NGXLogger } from 'ngx-logger'; providedIn: 'root', }) export class LoggingService { - env: string; - canDebug: boolean; - constructor(private logger: NGXLogger) { // TRACE|DEBUG|INFO|LOG|WARN|ERROR|FATAL|OFF if (isDevMode()) { diff --git a/src/app/_services/token.service.ts b/src/app/_services/token.service.ts index a572729..120bcc7 100644 --- a/src/app/_services/token.service.ts +++ b/src/app/_services/token.service.ts @@ -22,9 +22,7 @@ export class TokenService { async init(): Promise { this.registry = await RegistryService.getRegistry(); - this.tokenRegistry = new TokenRegistry( - await this.registry.getContractAddressByName('TokenRegistry') - ); + this.tokenRegistry = await RegistryService.getTokenRegistry(); this.load.next(true); } diff --git a/src/app/_services/transaction.service.ts b/src/app/_services/transaction.service.ts index 834c39c..4a46e73 100644 --- a/src/app/_services/transaction.service.ts +++ b/src/app/_services/transaction.service.ts @@ -10,7 +10,6 @@ import { add0x, fromHex, strip0x, toHex } from '@src/assets/js/ethtx/dist/hex'; import { Tx } from '@src/assets/js/ethtx/dist'; import { toValue } from '@src/assets/js/ethtx/dist/tx'; import * as secp256k1 from 'secp256k1'; -import { AuthService } from '@app/_services/auth.service'; import { defaultAccount } from '@app/_models'; import { LoggingService } from '@app/_services/logging.service'; import { HttpClient } from '@angular/common/http'; @@ -28,13 +27,11 @@ export class TransactionService { transactions: any[] = []; private transactionList = new BehaviorSubject(this.transactions); transactionsSubject = this.transactionList.asObservable(); - userInfo: any; web3: Web3; registry: CICRegistry; constructor( private httpClient: HttpClient, - private authService: AuthService, private userService: UserService, private loggingService: LoggingService ) { diff --git a/src/app/_services/user.service.ts b/src/app/_services/user.service.ts index 6f7652a..a1ed148 100644 --- a/src/app/_services/user.service.ts +++ b/src/app/_services/user.service.ts @@ -41,7 +41,7 @@ export class UserService { constructor( private httpClient: HttpClient, private loggingService: LoggingService, - private tokenService: TokenService, + private tokenService: TokenService ) {} async init(): Promise { @@ -261,10 +261,6 @@ export class UserService { this.accountsList.next(this.accounts); } - searchAccountByName(name: string): any { - return; - } - getCategories(): void { this.httpClient .get(`${environment.cicMetaUrl}/categories`) diff --git a/src/app/app.component.ts b/src/app/app.component.ts index f305a22..03aa30e 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -1,9 +1,12 @@ import { ChangeDetectionStrategy, Component, HostListener, OnInit } from '@angular/core'; import { - AuthService, BlockSyncService, + AuthService, + BlockSyncService, ErrorDialogService, - LoggingService, TokenService, - TransactionService, UserService, + LoggingService, + TokenService, + TransactionService, + UserService, } from '@app/_services'; import { SwUpdate } from '@angular/service-worker'; @@ -15,8 +18,6 @@ import { SwUpdate } from '@angular/service-worker'; }) export class AppComponent implements OnInit { title = 'CICADA'; - readyStateTarget: number = 3; - readyState: number = 0; mediaQuery: MediaQueryList = window.matchMedia('(max-width: 768px)'); constructor( diff --git a/src/app/pages/accounts/account-search/account-search.component.ts b/src/app/pages/accounts/account-search/account-search.component.ts index 47daed9..a24708a 100644 --- a/src/app/pages/accounts/account-search/account-search.component.ts +++ b/src/app/pages/accounts/account-search/account-search.component.ts @@ -13,9 +13,6 @@ import { environment } from '@src/environments/environment'; changeDetection: ChangeDetectionStrategy.OnPush, }) export class AccountSearchComponent implements OnInit { - nameSearchForm: FormGroup; - nameSearchSubmitted: boolean = false; - nameSearchLoading: boolean = false; phoneSearchForm: FormGroup; phoneSearchSubmitted: boolean = false; phoneSearchLoading: boolean = false; @@ -29,9 +26,6 @@ export class AccountSearchComponent implements OnInit { private userService: UserService, private router: Router ) { - this.nameSearchForm = this.formBuilder.group({ - name: ['', Validators.required], - }); this.phoneSearchForm = this.formBuilder.group({ phoneNumber: ['', Validators.required], }); @@ -42,9 +36,6 @@ export class AccountSearchComponent implements OnInit { ngOnInit(): void {} - get nameSearchFormStub(): any { - return this.nameSearchForm.controls; - } get phoneSearchFormStub(): any { return this.phoneSearchForm.controls; } @@ -52,16 +43,6 @@ export class AccountSearchComponent implements OnInit { return this.addressSearchForm.controls; } - onNameSearch(): void { - this.nameSearchSubmitted = true; - if (this.nameSearchForm.invalid) { - return; - } - this.nameSearchLoading = true; - this.userService.searchAccountByName(this.nameSearchFormStub.name.value); - this.nameSearchLoading = false; - } - async onPhoneSearch(): Promise { this.phoneSearchSubmitted = true; if (this.phoneSearchForm.invalid) { diff --git a/src/app/pages/settings/settings.component.ts b/src/app/pages/settings/settings.component.ts index 2ec1a80..1dbeaee 100644 --- a/src/app/pages/settings/settings.component.ts +++ b/src/app/pages/settings/settings.component.ts @@ -13,7 +13,6 @@ import { exportCsv } from '@app/_helpers'; changeDetection: ChangeDetectionStrategy.OnPush, }) export class SettingsComponent implements OnInit { - date: string; dataSource: MatTableDataSource; displayedColumns: Array = ['name', 'email', 'userId']; trustedUsers: Array; diff --git a/src/app/pages/tokens/tokens.component.ts b/src/app/pages/tokens/tokens.component.ts index 11cdb1a..38cce28 100644 --- a/src/app/pages/tokens/tokens.component.ts +++ b/src/app/pages/tokens/tokens.component.ts @@ -20,9 +20,7 @@ export class TokensComponent implements OnInit { tokens: Array; token: Token; - constructor( - private tokenService: TokenService, - ) {} + constructor(private tokenService: TokenService) {} ngOnInit(): void { this.tokenService.load.subscribe(async (status: boolean) => {