From 35a20c775ca547f3889cd18bb6e259a164a10c81 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Thu, 11 Jan 2018 14:29:55 -0500 Subject: [PATCH] added typings to settings components --- src/popup/app/settings/environment.component.ts | 6 +++--- .../app/settings/folders/add-folder.component.ts | 8 ++++---- .../settings/folders/edit-folder.component.ts | 16 ++++++++-------- .../app/settings/folders/folders.component.ts | 4 +++- src/popup/app/settings/help.component.ts | 2 +- src/popup/app/settings/options.component.ts | 9 ++++++--- src/popup/app/settings/premium.component.ts | 7 +++++-- src/popup/app/settings/settings.component.ts | 7 ++++--- src/popup/app/settings/sync.component.ts | 5 ++++- 9 files changed, 38 insertions(+), 26 deletions(-) diff --git a/src/popup/app/settings/environment.component.ts b/src/popup/app/settings/environment.component.ts index 99095385a3..62d7a592a8 100644 --- a/src/popup/app/settings/environment.component.ts +++ b/src/popup/app/settings/environment.component.ts @@ -1,6 +1,7 @@ import * as angular from 'angular'; import * as template from './environment.component.html'; +import { EnvironmentService } from 'jslib/abstractions/environment.service'; import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service'; export class EnvironmentController { @@ -11,9 +12,8 @@ export class EnvironmentController { baseUrl: string; i18n: any; - constructor(private i18nService: any, private $analytics: any, - platformUtilsService: PlatformUtilsService, - private environmentService: any, private toastr: any, private $timeout: ng.ITimeoutService) { + constructor(private i18nService: any, private $analytics: any, private platformUtilsService: PlatformUtilsService, + private environmentService: EnvironmentService, private toastr: any, private $timeout: ng.ITimeoutService) { this.i18n = i18nService; $timeout(() => { diff --git a/src/popup/app/settings/folders/add-folder.component.ts b/src/popup/app/settings/folders/add-folder.component.ts index 50a8292bc2..547a5dc902 100644 --- a/src/popup/app/settings/folders/add-folder.component.ts +++ b/src/popup/app/settings/folders/add-folder.component.ts @@ -3,6 +3,7 @@ import * as template from './add-folder.component.html'; import { Folder } from 'jslib/models/domain/folder'; +import { FolderService } from 'jslib/abstractions/folder.service'; import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service'; export class AddFolderController { @@ -10,7 +11,7 @@ export class AddFolderController { folder: {}; i18n: any; - constructor(private folderService: any, private $state: any, private toastr: any, + constructor(private folderService: FolderService, private $state: any, private toastr: any, platformUtilsService: PlatformUtilsService, private $analytics: any, private i18nService: any, $timeout: ng.ITimeoutService) { $timeout(() => { @@ -29,10 +30,9 @@ export class AddFolderController { return; } - this.savePromise = this.folderService.encrypt(model).then((folderModel: any) => { - const folder = new Folder(folderModel, true); + this.savePromise = this.folderService.encrypt(model).then((folder: Folder) => { return this.folderService.saveWithServer(folder); - }).then((folder: any) => { + }).then(() => { this.$analytics.eventTrack('Added Folder'); this.toastr.success(this.i18nService.addedFolder); this.$state.go('^.list', { animation: 'out-slide-down' }); diff --git a/src/popup/app/settings/folders/edit-folder.component.ts b/src/popup/app/settings/folders/edit-folder.component.ts index 6d401caa19..8763e64be6 100644 --- a/src/popup/app/settings/folders/edit-folder.component.ts +++ b/src/popup/app/settings/folders/edit-folder.component.ts @@ -3,18 +3,19 @@ import * as template from './edit-folder.component.html'; import { Folder } from 'jslib/models/domain/folder'; +import { FolderService } from 'jslib/abstractions/folder.service'; import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service'; export class EditFolderController { $transition$: any; - folderId: any; - savePromise: any = null; + folderId: string; + savePromise: Promise = null; i18n: any; folder: Folder; - constructor($scope: any, $stateParams: any, private folderService: any, private toastr: any, private $state: any, - private SweetAlert: any, platformUtilsService: PlatformUtilsService, private $analytics: any, - private i18nService: any, $timeout: ng.ITimeoutService) { + constructor($scope: any, $stateParams: any, private folderService: FolderService, private toastr: any, + private $state: any, private SweetAlert: any, platformUtilsService: PlatformUtilsService, + private $analytics: any, private i18nService: any, $timeout: ng.ITimeoutService) { this.i18n = i18nService; $timeout(() => { @@ -40,10 +41,9 @@ export class EditFolderController { return; } - this.savePromise = this.folderService.encrypt(model).then((folderModel: any) => { - const folder = new Folder(folderModel, true); + this.savePromise = this.folderService.encrypt(model).then((folder: Folder) => { return this.folderService.saveWithServer(folder); - }).then((folder: any) => { + }).then(() => { this.$analytics.eventTrack('Edited Folder'); this.toastr.success(this.i18nService.editedFolder); this.$state.go('^.list', { animation: 'out-slide-down' }); diff --git a/src/popup/app/settings/folders/folders.component.ts b/src/popup/app/settings/folders/folders.component.ts index 325361c9be..5cda2888cb 100644 --- a/src/popup/app/settings/folders/folders.component.ts +++ b/src/popup/app/settings/folders/folders.component.ts @@ -2,12 +2,14 @@ import * as template from './folders.component.html'; import { Folder } from 'jslib/models/domain/folder'; +import { FolderService } from 'jslib/abstractions/folder.service'; + export class FoldersController { folders: Folder[] = []; i18n: any; loaded = false; - constructor(private folderService: any, private $state: any, i18nService: any) { + constructor(private folderService: FolderService, private $state: any, i18nService: any) { this.i18n = i18nService; this.load(); } diff --git a/src/popup/app/settings/help.component.ts b/src/popup/app/settings/help.component.ts index 51794fb22e..10ff4800ee 100644 --- a/src/popup/app/settings/help.component.ts +++ b/src/popup/app/settings/help.component.ts @@ -3,7 +3,7 @@ import * as template from './help.component.html'; export class HelpController { i18n: any; - constructor(i18nService: any, private $analytics: any) { + constructor(private i18nService: any, private $analytics: any) { this.i18n = i18nService; } diff --git a/src/popup/app/settings/options.component.ts b/src/popup/app/settings/options.component.ts index 5cef7fb423..a9833c51cc 100644 --- a/src/popup/app/settings/options.component.ts +++ b/src/popup/app/settings/options.component.ts @@ -1,11 +1,14 @@ import * as angular from 'angular'; +import * as template from './options.component.html'; + +import { ConstantsService } from 'jslib/services/constants.service'; import { MessagingService } from 'jslib/abstractions/messaging.service'; import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service'; import { StorageService } from 'jslib/abstractions/storage.service'; +import { TotpService } from 'jslib/abstractions/totp.service'; import StateService from '../services/state.service'; -import * as template from './options.component.html'; export class OptionsController { disableFavicon = false; @@ -16,8 +19,8 @@ export class OptionsController { disableGa = false; i18n: any; - constructor(private i18nService: any, private $analytics: any, private constantsService: any, - private platformUtilsService: PlatformUtilsService, private totpService: any, + constructor(private i18nService: any, private $analytics: any, private constantsService: ConstantsService, + private platformUtilsService: PlatformUtilsService, private totpService: TotpService, private stateService: StateService, private storageService: StorageService, public messagingService: MessagingService, private $timeout: ng.ITimeoutService) { this.i18n = i18nService; diff --git a/src/popup/app/settings/premium.component.ts b/src/popup/app/settings/premium.component.ts index 2d312bcbec..7f4371aec4 100644 --- a/src/popup/app/settings/premium.component.ts +++ b/src/popup/app/settings/premium.component.ts @@ -1,12 +1,15 @@ import * as template from './premium.component.html'; +import { ApiService } from 'jslib/abstractions/api.service'; +import { TokenService } from 'jslib/abstractions/token.service'; + export class PremiumController { isPremium: boolean; i18n: any; price = '$10'; - constructor(private i18nService: any, private tokenService: any, private apiService: any, private toastr: any, - private SweetAlert: any, private $analytics: any, private $timeout: ng.ITimeoutService) { + constructor(private i18nService: any, private tokenService: TokenService, private apiService: ApiService, + private toastr: any, private SweetAlert: any, private $analytics: any, private $timeout: ng.ITimeoutService) { this.i18n = i18nService; this.isPremium = tokenService.getPremium(); } diff --git a/src/popup/app/settings/settings.component.ts b/src/popup/app/settings/settings.component.ts index 7703001d63..08edd149ec 100644 --- a/src/popup/app/settings/settings.component.ts +++ b/src/popup/app/settings/settings.component.ts @@ -5,6 +5,7 @@ import { DeviceType } from 'jslib/enums/deviceType'; import { ConstantsService } from 'jslib/services/constants.service'; import { CryptoService } from 'jslib/abstractions/crypto.service'; +import { LockService } from 'jslib/abstractions/lock.service'; import { MessagingService } from 'jslib/abstractions/messaging.service'; import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service'; import { StorageService } from 'jslib/abstractions/storage.service'; @@ -34,9 +35,9 @@ export class SettingsController { constructor(private $state: any, private SweetAlert: any, private platformUtilsService: PlatformUtilsService, private $analytics: any, private i18nService: any, private constantsService: ConstantsService, - private cryptoService: CryptoService, private lockService: any, - private storageService: StorageService, - public messagingService: MessagingService, private $timeout: ng.ITimeoutService) { + private cryptoService: CryptoService, private lockService: LockService, + private storageService: StorageService, public messagingService: MessagingService, + private $timeout: ng.ITimeoutService) { this.i18n = i18nService; $timeout(() => { diff --git a/src/popup/app/settings/sync.component.ts b/src/popup/app/settings/sync.component.ts index 3e71d6d211..1150833aae 100644 --- a/src/popup/app/settings/sync.component.ts +++ b/src/popup/app/settings/sync.component.ts @@ -1,11 +1,14 @@ import * as template from './sync.component.html'; +import { SyncService } from 'jslib/abstractions/sync.service'; + export class SyncController { i18n: any; lastSync = '--'; loading = false; - constructor(private syncService: any, private toastr: any, private $analytics: any, private i18nService: any) { + constructor(private syncService: SyncService, private toastr: any, private $analytics: any, + private i18nService: any) { this.i18n = i18nService; this.setLastSync(); }