added typings to popup services

This commit is contained in:
Kyle Spearrin 2018-01-11 14:45:27 -05:00
parent 969eb76ccc
commit 9644b7eeb3
7 changed files with 29 additions and 8 deletions

View File

@ -57,6 +57,8 @@ import BrowserPlatformUtilsService from '../services/browserPlatformUtils.servic
import BrowserStorageService from '../services/browserStorage.service';
import i18nService from '../services/i18n.service';
import { AutofillService as AutofillServiceAbstraction } from '../services/abstractions/autofill.service';
export default class MainBackground {
messagingService: MessagingServiceAbstraction;
storageService: StorageServiceAbstraction;
@ -78,7 +80,7 @@ export default class MainBackground {
syncService: SyncServiceAbstraction;
passwordGenerationService: PasswordGenerationServiceAbstraction;
totpService: TotpServiceAbstraction;
autofillService: AutofillService;
autofillService: AutofillServiceAbstraction;
containerService: ContainerService;
onUpdatedRan: boolean;

View File

@ -11,7 +11,7 @@ import BrowserApi from '../browser/browserApi';
import MainBackground from './main.background';
import AutofillService from '../services/autofill.service';
import { AutofillService } from '../services/abstractions/autofill.service';
export default class RuntimeBackground {
private runtime: any;

View File

@ -1,14 +1,20 @@
import { DeviceRequest } from 'jslib/models/request/deviceRequest';
import { TokenRequest } from 'jslib/models/request/tokenRequest';
import { ConstantsService } from 'jslib/services/constants.service';
import { ApiService } from 'jslib/abstractions/api.service';
import { AppIdService } from 'jslib/abstractions/appId.service';
import { CryptoService } from 'jslib/abstractions/crypto.service';
import { MessagingService } from 'jslib/abstractions/messaging.service';
import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service';
import { TokenService } from 'jslib/abstractions/token.service';
import { UserService } from 'jslib/abstractions/user.service';
class AuthService {
constructor(public cryptoService: CryptoService, public apiService: any, public userService: any,
public tokenService: any, public $rootScope: any, public appIdService: any,
public platformUtilsService: PlatformUtilsService, public constantsService: any,
constructor(public cryptoService: CryptoService, public apiService: ApiService, public userService: UserService,
public tokenService: TokenService, public $rootScope: any, public appIdService: AppIdService,
public platformUtilsService: PlatformUtilsService, public constantsService: ConstantsService,
public messagingService: MessagingService) {
}

View File

@ -18,6 +18,8 @@ import { TotpService } from 'jslib/abstractions/totp.service';
import { UserService } from 'jslib/abstractions/user.service';
import { UtilsService } from 'jslib/abstractions/utils.service';
import { AutofillService } from '../../../services/abstractions/autofill.service';
function getBackgroundService<T>(service: string) {
return (): T => {
const page = chrome.extension.getBackgroundPage();
@ -33,7 +35,7 @@ export const apiService = getBackgroundService<ApiService>('apiService');
export const folderService = getBackgroundService<FolderService>('folderService');
export const cipherService = getBackgroundService<CipherService>('cipherService');
export const syncService = getBackgroundService<SyncService>('syncService');
export const autofillService = getBackgroundService<any>('autofillService');
export const autofillService = getBackgroundService<AutofillService>('autofillService');
export const passwordGenerationService = getBackgroundService<PasswordGenerationService>('passwordGenerationService');
export const platformUtilsService = getBackgroundService<PlatformUtilsService>('platformUtilsService');
export const utilsService = getBackgroundService<UtilsService>('utilsService');

View File

@ -1,9 +1,11 @@
import { ConstantsService } from 'jslib/services/constants.service';
import { StorageService } from 'jslib/abstractions/storage.service';
class StateService {
private state: any = {};
constructor(private storageService: StorageService, private constantsService: any) {
constructor(private storageService: StorageService, private constantsService: ConstantsService) {
}
async init() {

View File

@ -0,0 +1,7 @@
import AutofillPageDetails from '../../models/domain/autofillPageDetails';
export interface AutofillService {
getFormsWithPasswordFields(pageDetails: AutofillPageDetails): any[];
doAutoFill(options: any): Promise<string>;
doAutoFillForLastUsedLogin(pageDetails: any, fromCommand: boolean): Promise<void>;
}

View File

@ -9,6 +9,8 @@ import AutofillScript from '../models/domain/autofillScript';
import { UtilsService } from 'jslib/services';
import { AutofillService as AutofillServiceInterface } from './abstractions/autofill.service';
import {
CipherService,
PlatformUtilsService,
@ -97,7 +99,7 @@ var IsoProvinces: { [id: string]: string; } = {
};
/* tslint:enable */
export default class AutofillService {
export default class AutofillService implements AutofillServiceInterface {
constructor(public cipherService: CipherService, public tokenService: TokenService,
public totpService: TotpService, public utilsService: UtilsServiceAbstraction,
public platformUtilsService: PlatformUtilsService) {