Skip to content

Commit

Permalink
last safe / consensual commit before strictNullChecks (which requires…
Browse files Browse the repository at this point in the history
… many changes)
  • Loading branch information
danielweck committed Jul 24, 2019
1 parent 6eb74a2 commit 4f50b20
Show file tree
Hide file tree
Showing 9 changed files with 44 additions and 59 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"build": "cross-env NODE_ENV=production webpack --config webpack.config.js && ncp src/package.json dist/package.json",
"build:dev:main": "webpack --config webpack.config.main.js",
"start": "npm run build && cross-env DEBUG=r2:*,readium-desktop:* electron .",
"lint:ts": "tslint --project tsconfig.json -c tslint.json './src/**/*.ts' './src/**/*.tsx'",
"lint:ts": "tslint --project tsconfig.json -c tslint.json './src/**/*.ts' './src/**/*.tsx' './test/**/*.ts' './test/**/*.tsx'",
"lint:editorconfig": "eclint check '**/*' '!.vscode/**/*' '!.git/**/*' '!node_modules/**/*' '!resources/**/*' '!src/renderer/assets/**/*' '!dist/**/*' '!**/.DS_Store'",
"lint": "npm run lint:editorconfig && npm run lint:ts",
"start:dev:renderer-reader": "concurrently --kill-others \"npm run start:dev:renderer\" \"npm run start:dev:reader\"",
Expand Down
10 changes: 5 additions & 5 deletions src/main/api/catalog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,19 @@ export const CATALOG_CONFIG_ID = "catalog";
@injectable()
export class CatalogApi {
@inject("publication-repository")
private publicationRepository: PublicationRepository;
private readonly publicationRepository!: PublicationRepository;

@inject("config-repository")
private configRepository: ConfigRepository;
private readonly configRepository!: ConfigRepository;

@inject("locator-repository")
private locatorRepository: LocatorRepository;
private readonly locatorRepository!: LocatorRepository;

@inject("publication-view-converter")
private publicationViewConverter: PublicationViewConverter;
private readonly publicationViewConverter!: PublicationViewConverter;

@inject("translator")
private translator: Translator;
private readonly translator!: Translator;

public async get(): Promise<CatalogView> {
const __ = this.translator.translate.bind(this.translator);
Expand Down
6 changes: 3 additions & 3 deletions src/main/api/lcp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ import { PublicationRepository } from "readium-desktop/main/db/repository/public
@injectable()
export class LcpApi {
@inject("store")
private store: Store<any>;
private readonly store!: Store<any>;

@inject("publication-repository")
private publicationRepository: PublicationRepository;
private readonly publicationRepository!: PublicationRepository;

@inject("lcp-manager")
private lcpManager: LcpManager;
private readonly lcpManager!: LcpManager;

public async renewPublicationLicense(data: any): Promise<void> {
const { publication } = data;
Expand Down
15 changes: 5 additions & 10 deletions src/main/api/opds.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,11 @@ import { httpGet } from "readium-desktop/common/utils";

@injectable()
export class OpdsApi {
private opdsFeedRepository: OpdsFeedRepository;
private opdsFeedViewConverter: OpdsFeedViewConverter;

constructor(
@inject("opds-feed-repository") opdsFeedRepository: OpdsFeedRepository,
@inject("opds-feed-view-converter") opdsFeedViewConverter: OpdsFeedViewConverter,
) {
this.opdsFeedRepository = opdsFeedRepository;
this.opdsFeedViewConverter = opdsFeedViewConverter;
}
@inject("opds-feed-repository")
private readonly opdsFeedRepository!: OpdsFeedRepository;

@inject("opds-feed-view-converter")
private readonly opdsFeedViewConverter!: OpdsFeedViewConverter;

public async getFeed(data: any): Promise<OpdsFeedView> {
const { identifier } = data;
Expand Down
21 changes: 8 additions & 13 deletions src/main/api/publication.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,14 @@ import { open } from "readium-desktop/common/redux/actions/toast";

@injectable()
export class PublicationApi {
private publicationRepository: PublicationRepository;
private publicationViewConverter: PublicationViewConverter;
private catalogService: CatalogService;

constructor(
@inject("publication-repository") publicationRepository: PublicationRepository,
@inject("publication-view-converter") publicationViewConverter: PublicationViewConverter,
@inject("catalog-service") catalogService: CatalogService,
) {
this.publicationRepository = publicationRepository;
this.publicationViewConverter = publicationViewConverter;
this.catalogService = catalogService;
}
@inject("publication-repository")
private readonly publicationRepository!: PublicationRepository;

@inject("publication-view-converter")
private readonly publicationViewConverter!: PublicationViewConverter;

@inject("catalog-service")
private readonly catalogService!: CatalogService;

public async get(data: any): Promise<PublicationView> {
const { identifier } = data;
Expand Down
4 changes: 2 additions & 2 deletions src/main/api/reader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ import { LocatorType } from "readium-desktop/common/models/locator";
@injectable()
export class ReaderApi {
@inject("locator-repository")
private locatorRepository: LocatorRepository;
private readonly locatorRepository!: LocatorRepository;

@inject("locator-view-converter")
private locatorViewConverter: LocatorViewConverter;
private readonly locatorViewConverter!: LocatorViewConverter;

public async setLastReadingLocation(data: any): Promise<LocatorView> {
const { publication, locator } = data;
Expand Down
27 changes: 11 additions & 16 deletions src/main/services/catalog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,22 +56,17 @@ const debug = debug_("readium-desktop:main#services/catalog");

@injectable()
export class CatalogService {
private downloader: Downloader;
private lcpManager: LcpManager;
private publicationStorage: PublicationStorage;
private publicationRepository: PublicationRepository;

public constructor(
@inject("publication-repository") publicationRepository: PublicationRepository,
@inject("publication-storage") publicationStorage: PublicationStorage,
@inject("downloader") downloader: Downloader,
@inject("lcp-manager") lcpManager: LcpManager,
) {
this.publicationRepository = publicationRepository;
this.publicationStorage = publicationStorage;
this.downloader = downloader;
this.lcpManager = lcpManager;
}
@inject("downloader")
private readonly downloader!: Downloader;

@inject("lcp-manager")
private readonly lcpManager!: LcpManager;

@inject("publication-storage")
private readonly publicationStorage!: PublicationStorage;

@inject("publication-repository")
private readonly publicationRepository!: PublicationRepository;

public async importFile(filePath: string, isLcpFile?: boolean): Promise<PublicationDocument> {
const ext = path.extname(filePath);
Expand Down
8 changes: 4 additions & 4 deletions src/main/services/device.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import * as uuid from "uuid";

import { inject, injectable} from "inversify";
import { injectable } from "inversify";

import { ConfigRepository } from "readium-desktop/main/db/repository/config";

Expand All @@ -19,13 +19,13 @@ const DEVICE_ID_PREFIX = "device_id_";
@injectable()
export class DeviceIdManager implements IDeviceIDManager {
// Config repository
private configRepository: ConfigRepository;
private readonly configRepository: ConfigRepository;

private deviceName: string;
private readonly deviceName: string;

public constructor(
deviceName: string,
@inject("config-repository") configRepository: ConfigRepository,
configRepository: ConfigRepository,
) {
this.deviceName = deviceName;
this.configRepository = configRepository;
Expand Down
10 changes: 5 additions & 5 deletions src/main/services/lcp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,19 +53,19 @@ const debug = debug_("readium-desktop:main#services/lcp");
@injectable()
export class LcpManager {
@inject("device-id-manager")
private deviceIdManager: DeviceIdManager;
private readonly deviceIdManager!: DeviceIdManager;

@inject("publication-storage")
private publicationStorage: PublicationStorage;
private readonly publicationStorage!: PublicationStorage;

@inject("publication-repository")
private publicationRepository: PublicationRepository;
private readonly publicationRepository!: PublicationRepository;

@inject("lcp-secret-repository")
private lcpSecretRepository: LcpSecretRepository;
private readonly lcpSecretRepository!: LcpSecretRepository;

@inject("streamer")
private streamer: Server;
private readonly streamer!: Server;

/**
* Inject lcpl document in publication
Expand Down

0 comments on commit 4f50b20

Please sign in to comment.