diff --git a/wowup-electron/src/app/components/install-from-url-dialog/install-from-url-dialog.component.html b/wowup-electron/src/app/components/install-from-url-dialog/install-from-url-dialog.component.html index dcc0f514..77da41ed 100644 --- a/wowup-electron/src/app/components/install-from-url-dialog/install-from-url-dialog.component.html +++ b/wowup-electron/src/app/components/install-from-url-dialog/install-from-url-dialog.component.html @@ -51,8 +51,7 @@ - \ No newline at end of file diff --git a/wowup-electron/src/app/directive.module.ts b/wowup-electron/src/app/directive.module.ts index 532989f0..035632b9 100644 --- a/wowup-electron/src/app/directive.module.ts +++ b/wowup-electron/src/app/directive.module.ts @@ -1,9 +1,8 @@ import { NgModule } from "@angular/core"; import { ExternalLinkDirective } from "./directives/external-link.directive"; -import { UserActionTrackerDirective } from "./directives/user-action-tracker.directive"; @NgModule({ - declarations: [ExternalLinkDirective, UserActionTrackerDirective], - exports: [ExternalLinkDirective, UserActionTrackerDirective], + declarations: [ExternalLinkDirective], + exports: [ExternalLinkDirective], }) export class DirectiveModule {} diff --git a/wowup-electron/src/app/directives/external-link.directive.ts b/wowup-electron/src/app/directives/external-link.directive.ts index d95e7e7f..e07f72eb 100644 --- a/wowup-electron/src/app/directives/external-link.directive.ts +++ b/wowup-electron/src/app/directives/external-link.directive.ts @@ -5,14 +5,14 @@ import { ElectronService } from "../services"; selector: "[appExternalLink]", }) export class ExternalLinkDirective { - @HostListener("click", ["$event"]) onClick($event) { + @HostListener("click", ["$event"]) public async onClick($event: any): Promise { $event.preventDefault(); $event.stopPropagation(); const target = $event.path.find((t) => t.tagName === "A"); - this._electronService.openExternal(target.href); + await this._electronService.openExternal(target.href); } - constructor(private _electronService: ElectronService) {} + public constructor(private _electronService: ElectronService) {} } diff --git a/wowup-electron/src/app/directives/user-action-tracker.directive.spec.ts b/wowup-electron/src/app/directives/user-action-tracker.directive.spec.ts deleted file mode 100644 index b0765a68..00000000 --- a/wowup-electron/src/app/directives/user-action-tracker.directive.spec.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { inject } from "@angular/core/testing"; -import { AnalyticsService } from "../services/analytics/analytics.service"; -import { UserActionTrackerDirective } from "./user-action-tracker.directive"; - -describe("UserActionTrackerDirective", () => { - it("should create an instance", () => { - inject([AnalyticsService], (analyticsService: AnalyticsService) => { - const instance = new UserActionTrackerDirective(analyticsService); - expect(instance).toBeTruthy(); - }); - }); -}); diff --git a/wowup-electron/src/app/directives/user-action-tracker.directive.ts b/wowup-electron/src/app/directives/user-action-tracker.directive.ts deleted file mode 100644 index 9e40a70e..00000000 --- a/wowup-electron/src/app/directives/user-action-tracker.directive.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { Directive, HostListener, Input } from "@angular/core"; -import { AnalyticsService } from "../services/analytics/analytics.service"; - -@Directive({ - selector: "[appUserActionTracker]", -}) -export class UserActionTrackerDirective { - @Input() appUserActionTracker: string; - @Input() category: string; - @Input() action: string; - @Input() label: string; - - @HostListener("click", ["$event"]) onClick($event) {} - - constructor(private _analyticsService: AnalyticsService) {} -} diff --git a/wowup-electron/src/app/errors/index.ts b/wowup-electron/src/app/errors/index.ts index b5de5c34..413a834b 100644 --- a/wowup-electron/src/app/errors/index.ts +++ b/wowup-electron/src/app/errors/index.ts @@ -4,7 +4,7 @@ import { CustomError } from "ts-custom-error"; export class ErrorContainer extends CustomError { public readonly innerError?: Error; - constructor(innerError?: Error, message?: string) { + public constructor(innerError?: Error, message?: string) { super(message); this.innerError = innerError; } @@ -28,7 +28,7 @@ export class AddonScanError extends CustomError { public readonly providerName: string; public readonly addonName?: string; - constructor(config: AddonScanErrorConfig) { + public constructor(config: AddonScanErrorConfig) { super(config.message); this.providerName = config.providerName; @@ -49,7 +49,7 @@ export class AddonSyncError extends CustomError { public readonly providerName: string; public readonly addonName?: string; - constructor(config: AddonSyncErrorConfig) { + public constructor(config: AddonSyncErrorConfig) { super(config.message); this.providerName = config.providerName; @@ -61,7 +61,7 @@ export class AddonSyncError extends CustomError { export class GenericProviderError extends ErrorContainer {} export class SourceRemovedAddonError extends ErrorContainer { - constructor(public addonId: string, innerError: Error) { + public constructor(public addonId: string, innerError: Error) { super(innerError); } } @@ -74,7 +74,7 @@ export class GitHubLimitError extends GitHubError { public readonly rateLimitRemaining: number; public readonly rateLimitReset: number; - constructor(max: number, used: number, remaining: number, reset: number, message?: string) { + public constructor(max: number, used: number, remaining: number, reset: number, message?: string) { super(undefined, message); this.rateLimitMax = max; @@ -87,7 +87,7 @@ export class GitHubLimitError extends GitHubError { export class GitHubFetchReleasesError extends GitHubError { public readonly addonId: string; - constructor(addonId: string, error?: Error) { + public constructor(addonId: string, error?: Error) { super(error); this.addonId = addonId; @@ -97,7 +97,7 @@ export class GitHubFetchReleasesError extends GitHubError { export class GitHubFetchRepositoryError extends GitHubError { public readonly addonId: string; - constructor(addonId: string, error?: Error) { + public constructor(addonId: string, error?: Error) { super(error); this.addonId = addonId; diff --git a/wowup-electron/src/app/interceptors/default-headers.interceptor.ts b/wowup-electron/src/app/interceptors/default-headers.interceptor.ts index 7b5762f5..a300a4a2 100644 --- a/wowup-electron/src/app/interceptors/default-headers.interceptor.ts +++ b/wowup-electron/src/app/interceptors/default-headers.interceptor.ts @@ -1,11 +1,15 @@ -import { HttpHandler, HttpInterceptor, HttpRequest } from "@angular/common/http"; +import { HttpEvent, HttpHandler, HttpInterceptor, HttpRequest } from "@angular/common/http"; import { Injectable } from "@angular/core"; +import { Observable } from "rxjs"; -@Injectable() +@Injectable({ + providedIn: "root", +}) export class DefaultHeadersInterceptor implements HttpInterceptor { - intercept(req: HttpRequest, next: HttpHandler) { + public intercept(req: HttpRequest, next: HttpHandler): Observable> { // Get the auth token from the service. + console.debug("INTERCEPT"); // Clone the request and replace the original headers with // cloned headers, updated with the authorization. const authReq = req.clone({ diff --git a/wowup-electron/src/app/pages/about/about.component.html b/wowup-electron/src/app/pages/about/about.component.html index 9638c619..648648c9 100644 --- a/wowup-electron/src/app/pages/about/about.component.html +++ b/wowup-electron/src/app/pages/about/about.component.html @@ -12,8 +12,7 @@

{{ "PAGES.ABOUT.TITLE" | translate }}

v{{ versionNumber | async }}
diff --git a/wowup-electron/src/app/pages/about/about.component.ts b/wowup-electron/src/app/pages/about/about.component.ts index 04ff3a15..9ab22fee 100644 --- a/wowup-electron/src/app/pages/about/about.component.ts +++ b/wowup-electron/src/app/pages/about/about.component.ts @@ -11,17 +11,15 @@ import { WowUpService } from "../../services/wowup/wowup.service"; styleUrls: ["./about.component.scss"], changeDetection: ChangeDetectionStrategy.OnPush, }) -export class AboutComponent implements OnInit { - @Input("tabIndex") tabIndex: number; +export class AboutComponent { + @Input("tabIndex") public tabIndex: number; public changeLogs: ChangeLog[] = ChangeLogJson.ChangeLogs; public versionNumber = from(this.electronService.getVersionNumber()); - constructor(public wowUpService: WowUpService, public electronService: ElectronService) {} + public constructor(public wowUpService: WowUpService, public electronService: ElectronService) {} - ngOnInit(): void {} - - formatChanges(changeLog: ChangeLog): string { + public formatChanges(changeLog: ChangeLog): string { return changeLog.changes.join("\n"); } } diff --git a/wowup-electron/src/app/pages/get-addons/get-addons.component.html b/wowup-electron/src/app/pages/get-addons/get-addons.component.html index dcccd81f..eb5a1d0d 100644 --- a/wowup-electron/src/app/pages/get-addons/get-addons.component.html +++ b/wowup-electron/src/app/pages/get-addons/get-addons.component.html @@ -27,12 +27,10 @@
- -
diff --git a/wowup-electron/src/app/pages/get-addons/get-addons.component.ts b/wowup-electron/src/app/pages/get-addons/get-addons.component.ts index 3e817747..e5f053c6 100644 --- a/wowup-electron/src/app/pages/get-addons/get-addons.component.ts +++ b/wowup-electron/src/app/pages/get-addons/get-addons.component.ts @@ -66,7 +66,7 @@ class AddonListItemDataSource extends MatTableDataSource { // Notify any listeners when the offset changes public offsetChange$ = this._offsetChangeSrc.asObservable(); - constructor(private subject: BehaviorSubject, private viewport: CdkVirtualScrollViewport) { + public constructor(private subject: BehaviorSubject, private viewport: CdkVirtualScrollViewport) { super(); subject.subscribe((data) => { @@ -85,12 +85,12 @@ class AddonListItemDataSource extends MatTableDataSource { }); } - resume() { + public resume() { this.viewport.getElementRef().nativeElement.scrollTop = this.lastTop; this.viewport.getElementRef().nativeElement.dispatchEvent(new CustomEvent("scroll")); } - handleNewData(start: number) { + public handleNewData(start: number) { const end = start + PAGESIZE; const data = [...this.subject.value]; const slicedData = _.slice(data, start, end); @@ -106,11 +106,11 @@ class AddonListItemDataSource extends MatTableDataSource { * Virtual Scroll Strategy */ export class CustomVirtualScrollStrategy extends FixedSizeVirtualScrollStrategy { - constructor() { + public constructor() { super(ROW_HEIGHT, 1000, 2000); } - attach(viewport: CdkVirtualScrollViewport): void { + public attach(viewport: CdkVirtualScrollViewport): void { this.onDataLengthChanged(); } } @@ -123,12 +123,12 @@ export class CustomVirtualScrollStrategy extends FixedSizeVirtualScrollStrategy providers: [{ provide: VIRTUAL_SCROLL_STRATEGY, useClass: CustomVirtualScrollStrategy }], }) export class GetAddonsComponent implements OnInit, AfterViewInit, OnDestroy, AfterViewChecked { - @Input("tabIndex") tabIndex: number; + @Input("tabIndex") public tabIndex: number; - @ViewChild(MatSort) sort: MatSort; - @ViewChild("table", { read: ElementRef }) table: ElementRef; - @ViewChild("columnContextMenuTrigger") columnContextMenu: MatMenuTrigger; - @ViewChild("viewport") viewport: CdkVirtualScrollViewport; + @ViewChild(MatSort) public sort: MatSort; + @ViewChild("table", { read: ElementRef }) public table: ElementRef; + @ViewChild("columnContextMenuTrigger") public columnContextMenu: MatMenuTrigger; + @ViewChild("viewport") public viewport: CdkVirtualScrollViewport; private _subscriptions: Subscription[] = []; private _isSelectedTab = false; @@ -143,7 +143,7 @@ export class GetAddonsComponent implements OnInit, AfterViewInit, OnDestroy, Aft public activeSortDirection = "desc"; public placeholderHeight = 0; - columns: ColumnState[] = [ + public columns: ColumnState[] = [ { name: "name", display: "PAGES.GET_ADDONS.TABLE.ADDON_COLUMN_HEADER", visible: true }, { name: "downloadCount", @@ -197,7 +197,7 @@ export class GetAddonsComponent implements OnInit, AfterViewInit, OnDestroy, Aft }) ); - constructor( + public constructor( private _dialog: MatDialog, private _cdRef: ChangeDetectorRef, private _addonService: AddonService, @@ -225,7 +225,7 @@ export class GetAddonsComponent implements OnInit, AfterViewInit, OnDestroy, Aft }); } - ngAfterViewChecked(): void { + public ngAfterViewChecked(): void { // Wait for the tab to have a height, then if we need to resume the table do so if (this._resumeTable && this.viewport.elementRef.nativeElement.scrollHeight > 0) { this._resumeTable = false; @@ -233,7 +233,7 @@ export class GetAddonsComponent implements OnInit, AfterViewInit, OnDestroy, Aft } } - ngOnInit(): void { + public ngOnInit(): void { this._subscriptions.push( this._addonService.searchError$.subscribe((error) => { this.displayError(error); @@ -253,23 +253,23 @@ export class GetAddonsComponent implements OnInit, AfterViewInit, OnDestroy, Aft }); } - ngOnDestroy(): void { + public ngOnDestroy(): void { this._subscriptions.forEach((sub) => sub.unsubscribe()); this._subscriptions = []; } - ngAfterViewInit(): void { + public ngAfterViewInit(): void { this.dataSource = new AddonListItemDataSource(this._dataSubject, this.viewport); this.dataSource.offsetChange$.subscribe((offset) => { this.placeholderHeight = offset; }); } - placeholderWhen(index: number, _: any): boolean { + public placeholderWhen(index: number, _: any): boolean { return index == 0; } - onSortChange(sort: Sort): void { + public onSortChange(sort: Sort): void { const sortedData = this.sortAddons(this._dataSubject.value.slice(), sort); this._wowUpService.getAddonsSortOrder = { name: this.sort.active, @@ -279,7 +279,7 @@ export class GetAddonsComponent implements OnInit, AfterViewInit, OnDestroy, Aft this._dataSubject.next(sortedData); } - onStatusColumnUpdated(): void { + public onStatusColumnUpdated(): void { this._cdRef.detectChanges(); } @@ -336,27 +336,27 @@ export class GetAddonsComponent implements OnInit, AfterViewInit, OnDestroy, Aft this._subscriptions = [selectedInstallationSub, addonRemovedSubscription, channelTypeSubscription, dataSourceSub]; } - onInstallFromUrl(): void { + public onInstallFromUrl(): void { const dialogRef = this._dialog.open(InstallFromUrlDialogComponent); dialogRef.afterClosed().subscribe(() => { console.log("The dialog was closed"); }); } - onClientChange(): void { + public onClientChange(): void { this._sessionService.setSelectedWowInstallation(this.selectedInstallationId); } - onRefresh(): void { + public onRefresh(): void { this.loadPopularAddons(this.selectedInstallation); } - onClearSearch(): void { + public onClearSearch(): void { this.query = ""; this.onSearch(); } - onSearch(): void { + public onSearch(): void { this._isBusySubject.next(true); if (!this.query) { @@ -383,15 +383,15 @@ export class GetAddonsComponent implements OnInit, AfterViewInit, OnDestroy, Aft .subscribe(); } - onDoubleClickRow(listItem: GetAddonListItem): void { + public onDoubleClickRow(listItem: GetAddonListItem): void { this.openDetailDialog(listItem.searchResult, this.defaultAddonChannel); } - onAddonColumnDetailDialog(event: PotentialAddonViewDetailsEvent): void { + public onAddonColumnDetailDialog(event: PotentialAddonViewDetailsEvent): void { this.openDetailDialog(event.searchResult, event.channelType); } - openDetailDialog(searchResult: AddonSearchResult, channelType: AddonChannelType): void { + public openDetailDialog(searchResult: AddonSearchResult, channelType: AddonChannelType): void { const data: AddonDetailModel = { searchResult: searchResult, channelType: channelType, diff --git a/wowup-electron/src/app/pages/home/home.component.ts b/wowup-electron/src/app/pages/home/home.component.ts index 9f29ee29..75548c0a 100644 --- a/wowup-electron/src/app/pages/home/home.component.ts +++ b/wowup-electron/src/app/pages/home/home.component.ts @@ -1,5 +1,5 @@ -import { from, interval, Subscription } from "rxjs"; -import { filter, first, switchMap, tap } from "rxjs/operators"; +import { interval, Subscription } from "rxjs"; +import { filter, first, tap } from "rxjs/operators"; import { AfterViewInit, ChangeDetectionStrategy, ChangeDetectorRef, Component, NgZone, OnDestroy } from "@angular/core"; import { MatSnackBar } from "@angular/material/snack-bar"; @@ -13,7 +13,6 @@ import { ElectronService } from "../../services"; import { AddonService, ScanUpdate, ScanUpdateType } from "../../services/addons/addon.service"; import { SessionService } from "../../services/session/session.service"; import { WarcraftInstallationService } from "../../services/warcraft/warcraft-installation.service"; -import { WarcraftService } from "../../services/warcraft/warcraft.service"; import { WowUpService } from "../../services/wowup/wowup.service"; @Component({ @@ -30,7 +29,7 @@ export class HomeComponent implements AfterViewInit, OnDestroy { public appReady = false; public preloadSpinnerKey = "COMMON.PROGRESS_SPINNER.LOADING"; - constructor( + public constructor( public electronService: ElectronService, private _sessionService: SessionService, private _translateService: TranslateService, @@ -52,7 +51,7 @@ export class HomeComponent implements AfterViewInit, OnDestroy { .subscribe(this.onScanUpdate); } - ngAfterViewInit(): void { + public ngAfterViewInit(): void { this.electronService.powerMonitor$.pipe(filter((evt) => !!evt)).subscribe((evt) => { console.log("Stopping app update check..."); this.destroyAppUpdateCheck(); @@ -72,7 +71,7 @@ export class HomeComponent implements AfterViewInit, OnDestroy { }); } - ngOnDestroy(): void { + public ngOnDestroy(): void { this._appUpdateInterval?.unsubscribe(); } @@ -126,7 +125,7 @@ export class HomeComponent implements AfterViewInit, OnDestroy { } }; - onSelectedIndexChange(index: number): void { + public onSelectedIndexChange(index: number): void { this._sessionService.selectedHomeTab = index; } diff --git a/wowup-electron/src/app/pages/options/options.component.ts b/wowup-electron/src/app/pages/options/options.component.ts index b0f627cc..daea8ec1 100644 --- a/wowup-electron/src/app/pages/options/options.component.ts +++ b/wowup-electron/src/app/pages/options/options.component.ts @@ -1,4 +1,4 @@ -import { ChangeDetectionStrategy, Component, Input, OnInit } from "@angular/core"; +import { ChangeDetectionStrategy, Component, Input } from "@angular/core"; import { ElectronService } from "../../services"; import { WowUpService } from "../../services/wowup/wowup.service"; @@ -8,13 +8,10 @@ import { WowUpService } from "../../services/wowup/wowup.service"; styleUrls: ["./options.component.scss"], changeDetection: ChangeDetectionStrategy.OnPush, }) -export class OptionsComponent implements OnInit { - @Input("tabIndex") tabIndex: number; +export class OptionsComponent { + @Input("tabIndex") public tabIndex: number; public optionTabIndex = 0; - constructor(public wowUpService: WowUpService, public electronService: ElectronService) {} - - ngOnInit(): void {} - + public constructor(public wowUpService: WowUpService, public electronService: ElectronService) {} }