1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-13 14:53:33 +00:00

added typings to settings components

This commit is contained in:
Kyle Spearrin
2018-01-11 14:29:55 -05:00
parent 2f5a1f470a
commit 35a20c775c
9 changed files with 38 additions and 26 deletions

View File

@@ -1,6 +1,7 @@
import * as angular from 'angular'; import * as angular from 'angular';
import * as template from './environment.component.html'; import * as template from './environment.component.html';
import { EnvironmentService } from 'jslib/abstractions/environment.service';
import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service'; import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service';
export class EnvironmentController { export class EnvironmentController {
@@ -11,9 +12,8 @@ export class EnvironmentController {
baseUrl: string; baseUrl: string;
i18n: any; i18n: any;
constructor(private i18nService: any, private $analytics: any, constructor(private i18nService: any, private $analytics: any, private platformUtilsService: PlatformUtilsService,
platformUtilsService: PlatformUtilsService, private environmentService: EnvironmentService, private toastr: any, private $timeout: ng.ITimeoutService) {
private environmentService: any, private toastr: any, private $timeout: ng.ITimeoutService) {
this.i18n = i18nService; this.i18n = i18nService;
$timeout(() => { $timeout(() => {

View File

@@ -3,6 +3,7 @@ import * as template from './add-folder.component.html';
import { Folder } from 'jslib/models/domain/folder'; import { Folder } from 'jslib/models/domain/folder';
import { FolderService } from 'jslib/abstractions/folder.service';
import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service'; import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service';
export class AddFolderController { export class AddFolderController {
@@ -10,7 +11,7 @@ export class AddFolderController {
folder: {}; folder: {};
i18n: any; 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, platformUtilsService: PlatformUtilsService, private $analytics: any, private i18nService: any,
$timeout: ng.ITimeoutService) { $timeout: ng.ITimeoutService) {
$timeout(() => { $timeout(() => {
@@ -29,10 +30,9 @@ export class AddFolderController {
return; return;
} }
this.savePromise = this.folderService.encrypt(model).then((folderModel: any) => { this.savePromise = this.folderService.encrypt(model).then((folder: Folder) => {
const folder = new Folder(folderModel, true);
return this.folderService.saveWithServer(folder); return this.folderService.saveWithServer(folder);
}).then((folder: any) => { }).then(() => {
this.$analytics.eventTrack('Added Folder'); this.$analytics.eventTrack('Added Folder');
this.toastr.success(this.i18nService.addedFolder); this.toastr.success(this.i18nService.addedFolder);
this.$state.go('^.list', { animation: 'out-slide-down' }); this.$state.go('^.list', { animation: 'out-slide-down' });

View File

@@ -3,18 +3,19 @@ import * as template from './edit-folder.component.html';
import { Folder } from 'jslib/models/domain/folder'; import { Folder } from 'jslib/models/domain/folder';
import { FolderService } from 'jslib/abstractions/folder.service';
import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service'; import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service';
export class EditFolderController { export class EditFolderController {
$transition$: any; $transition$: any;
folderId: any; folderId: string;
savePromise: any = null; savePromise: Promise<any> = null;
i18n: any; i18n: any;
folder: Folder; folder: Folder;
constructor($scope: any, $stateParams: any, private folderService: any, private toastr: any, private $state: any, constructor($scope: any, $stateParams: any, private folderService: FolderService, private toastr: any,
private SweetAlert: any, platformUtilsService: PlatformUtilsService, private $analytics: any, private $state: any, private SweetAlert: any, platformUtilsService: PlatformUtilsService,
private i18nService: any, $timeout: ng.ITimeoutService) { private $analytics: any, private i18nService: any, $timeout: ng.ITimeoutService) {
this.i18n = i18nService; this.i18n = i18nService;
$timeout(() => { $timeout(() => {
@@ -40,10 +41,9 @@ export class EditFolderController {
return; return;
} }
this.savePromise = this.folderService.encrypt(model).then((folderModel: any) => { this.savePromise = this.folderService.encrypt(model).then((folder: Folder) => {
const folder = new Folder(folderModel, true);
return this.folderService.saveWithServer(folder); return this.folderService.saveWithServer(folder);
}).then((folder: any) => { }).then(() => {
this.$analytics.eventTrack('Edited Folder'); this.$analytics.eventTrack('Edited Folder');
this.toastr.success(this.i18nService.editedFolder); this.toastr.success(this.i18nService.editedFolder);
this.$state.go('^.list', { animation: 'out-slide-down' }); this.$state.go('^.list', { animation: 'out-slide-down' });

View File

@@ -2,12 +2,14 @@ import * as template from './folders.component.html';
import { Folder } from 'jslib/models/domain/folder'; import { Folder } from 'jslib/models/domain/folder';
import { FolderService } from 'jslib/abstractions/folder.service';
export class FoldersController { export class FoldersController {
folders: Folder[] = []; folders: Folder[] = [];
i18n: any; i18n: any;
loaded = false; loaded = false;
constructor(private folderService: any, private $state: any, i18nService: any) { constructor(private folderService: FolderService, private $state: any, i18nService: any) {
this.i18n = i18nService; this.i18n = i18nService;
this.load(); this.load();
} }

View File

@@ -3,7 +3,7 @@ import * as template from './help.component.html';
export class HelpController { export class HelpController {
i18n: any; i18n: any;
constructor(i18nService: any, private $analytics: any) { constructor(private i18nService: any, private $analytics: any) {
this.i18n = i18nService; this.i18n = i18nService;
} }

View File

@@ -1,11 +1,14 @@
import * as angular from 'angular'; 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 { MessagingService } from 'jslib/abstractions/messaging.service';
import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service'; import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service';
import { StorageService } from 'jslib/abstractions/storage.service'; import { StorageService } from 'jslib/abstractions/storage.service';
import { TotpService } from 'jslib/abstractions/totp.service';
import StateService from '../services/state.service'; import StateService from '../services/state.service';
import * as template from './options.component.html';
export class OptionsController { export class OptionsController {
disableFavicon = false; disableFavicon = false;
@@ -16,8 +19,8 @@ export class OptionsController {
disableGa = false; disableGa = false;
i18n: any; i18n: any;
constructor(private i18nService: any, private $analytics: any, private constantsService: any, constructor(private i18nService: any, private $analytics: any, private constantsService: ConstantsService,
private platformUtilsService: PlatformUtilsService, private totpService: any, private platformUtilsService: PlatformUtilsService, private totpService: TotpService,
private stateService: StateService, private storageService: StorageService, private stateService: StateService, private storageService: StorageService,
public messagingService: MessagingService, private $timeout: ng.ITimeoutService) { public messagingService: MessagingService, private $timeout: ng.ITimeoutService) {
this.i18n = i18nService; this.i18n = i18nService;

View File

@@ -1,12 +1,15 @@
import * as template from './premium.component.html'; import * as template from './premium.component.html';
import { ApiService } from 'jslib/abstractions/api.service';
import { TokenService } from 'jslib/abstractions/token.service';
export class PremiumController { export class PremiumController {
isPremium: boolean; isPremium: boolean;
i18n: any; i18n: any;
price = '$10'; price = '$10';
constructor(private i18nService: any, private tokenService: any, private apiService: any, private toastr: any, constructor(private i18nService: any, private tokenService: TokenService, private apiService: ApiService,
private SweetAlert: any, private $analytics: any, private $timeout: ng.ITimeoutService) { private toastr: any, private SweetAlert: any, private $analytics: any, private $timeout: ng.ITimeoutService) {
this.i18n = i18nService; this.i18n = i18nService;
this.isPremium = tokenService.getPremium(); this.isPremium = tokenService.getPremium();
} }

View File

@@ -5,6 +5,7 @@ import { DeviceType } from 'jslib/enums/deviceType';
import { ConstantsService } from 'jslib/services/constants.service'; import { ConstantsService } from 'jslib/services/constants.service';
import { CryptoService } from 'jslib/abstractions/crypto.service'; import { CryptoService } from 'jslib/abstractions/crypto.service';
import { LockService } from 'jslib/abstractions/lock.service';
import { MessagingService } from 'jslib/abstractions/messaging.service'; import { MessagingService } from 'jslib/abstractions/messaging.service';
import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service'; import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service';
import { StorageService } from 'jslib/abstractions/storage.service'; import { StorageService } from 'jslib/abstractions/storage.service';
@@ -34,9 +35,9 @@ export class SettingsController {
constructor(private $state: any, private SweetAlert: any, constructor(private $state: any, private SweetAlert: any,
private platformUtilsService: PlatformUtilsService, private $analytics: any, private platformUtilsService: PlatformUtilsService, private $analytics: any,
private i18nService: any, private constantsService: ConstantsService, private i18nService: any, private constantsService: ConstantsService,
private cryptoService: CryptoService, private lockService: any, private cryptoService: CryptoService, private lockService: LockService,
private storageService: StorageService, private storageService: StorageService, public messagingService: MessagingService,
public messagingService: MessagingService, private $timeout: ng.ITimeoutService) { private $timeout: ng.ITimeoutService) {
this.i18n = i18nService; this.i18n = i18nService;
$timeout(() => { $timeout(() => {

View File

@@ -1,11 +1,14 @@
import * as template from './sync.component.html'; import * as template from './sync.component.html';
import { SyncService } from 'jslib/abstractions/sync.service';
export class SyncController { export class SyncController {
i18n: any; i18n: any;
lastSync = '--'; lastSync = '--';
loading = false; 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.i18n = i18nService;
this.setLastSync(); this.setLastSync();
} }