Consolidate wowup models

This commit is contained in:
jliddev
2021-03-02 15:25:41 -06:00
parent ff20a9c380
commit c026fa30dc
45 changed files with 97 additions and 124 deletions

View File

@@ -5,7 +5,7 @@ import {
IPC_MENU_ZOOM_OUT_CHANNEL,
IPC_MENU_ZOOM_RESET_CHANNEL,
} from "./src/common/constants";
import { MenuConfig } from "./src/common/wowup/menu-config";
import { MenuConfig } from "./src/common/wowup/models";
function onMenuZoomIn(win: BrowserWindow) {
win?.webContents.send(IPC_MENU_ZOOM_IN_CHANNEL);

View File

@@ -58,10 +58,8 @@ import { DownloadStatusType } from "./src/common/models/download-status-type";
import { FsDirent, FsStats } from "./src/common/models/ipc-events";
import { UnzipRequest } from "./src/common/models/unzip-request";
import { RendererChannels } from "./src/common/wowup";
import { MenuConfig } from "./src/common/wowup/menu-config";
import { SystemTrayConfig } from "./src/common/wowup/system-tray-config";
import { MenuConfig, SystemTrayConfig, WowUpScanResult } from "./src/common/wowup/models";
import { WowUpFolderScanner } from "./src/common/wowup/wowup-folder-scanner";
import { WowUpScanResult } from "./src/common/wowup/wowup-scan-result";
import { Addon } from "./src/common/entities/addon";
import { createTray, restoreWindow } from "./system-tray";
import { addonStore } from "./stores";

View File

@@ -28,7 +28,7 @@ import {
WINDOW_MIN_WIDTH,
WOWUP_LOGO_FILENAME,
} from "./src/common/constants";
import { AppOptions } from "./src/common/wowup/app-options";
import { AppOptions } from "./src/common/wowup/models";
import { windowStateManager } from "./window-state";
import { createAppMenu } from "./app-menu";
import { MainChannels } from "./src/common/wowup";

View File

@@ -3,7 +3,7 @@ import { WowInstallation } from "../models/wowup/wow-installation";
import { Observable, of } from "rxjs";
import { Addon } from "../../common/entities/addon";
import { AddonChannelType } from "../../common/wowup/addon-channel-type";
import { AddonChannelType } from "../../common/wowup/models";
import { AddonFolder } from "../models/wowup/addon-folder";
import { AddonSearchResult } from "../models/wowup/addon-search-result";

View File

@@ -12,8 +12,7 @@ import {
import { CurseFolderScanResult } from "../../common/curse/curse-folder-scan-result";
import { Addon } from "../../common/entities/addon";
import { WowClientType } from "../../common/warcraft/wow-client-type";
import { AddonChannelType } from "../../common/wowup/addon-channel-type";
import { AddonDependencyType } from "../../common/wowup/addon-dependency-type";
import { AddonChannelType, AddonDependencyType } from "../../common/wowup/models";
import { AppConfig } from "../../environments/environment";
import { AppCurseScanResult } from "../models/curse/app-curse-scan-result";
import {

View File

@@ -18,7 +18,7 @@ import { GitHubAsset } from "../models/github/github-asset";
import { GitHubRelease } from "../models/github/github-release";
import { GitHubRepository } from "../models/github/github-repository";
import { WowClientType } from "../../common/warcraft/wow-client-type";
import { AddonChannelType } from "../../common/wowup/addon-channel-type";
import { AddonChannelType } from "../../common/wowup/models";
import { AddonSearchResult } from "../models/wowup/addon-search-result";
import { AddonSearchResultFile } from "../models/wowup/addon-search-result-file";
import { AddonProvider, GetAllResult } from "./addon-provider";

View File

@@ -3,7 +3,7 @@ import * as _ from "lodash";
import { v4 as uuidv4 } from "uuid";
import { ADDON_PROVIDER_RAIDERIO } from "../../common/constants";
import { AddonChannelType } from "../../common/wowup/addon-channel-type";
import { AddonChannelType } from "../../common/wowup/models";
import { AddonFolder } from "../models/wowup/addon-folder";
import { getEnumName } from "../utils/enum.utils";
import { AddonProvider } from "./addon-provider";

View File

@@ -5,7 +5,7 @@ import { v4 as uuidv4 } from "uuid";
import { ADDON_PROVIDER_TUKUI } from "../../common/constants";
import { WowClientType } from "../../common/warcraft/wow-client-type";
import { AddonChannelType } from "../../common/wowup/addon-channel-type";
import { AddonChannelType } from "../../common/wowup/models";
import { TukUiAddon } from "../models/tukui/tukui-addon";
import { AddonFolder } from "../models/wowup/addon-folder";
import { AddonSearchResult } from "../models/wowup/addon-search-result";

View File

@@ -7,7 +7,7 @@ import { HttpErrorResponse } from "@angular/common/http";
import { ADDON_PROVIDER_WOWINTERFACE } from "../../common/constants";
import { Addon } from "../../common/entities/addon";
import { AddonChannelType } from "../../common/wowup/addon-channel-type";
import { AddonChannelType } from "../../common/wowup/models";
import { SourceRemovedAddonError } from "../errors";
import { AddonDetailsResponse } from "../models/wow-interface/addon-details-response";
import { AddonFolder } from "../models/wowup/addon-folder";

View File

@@ -6,8 +6,7 @@ import { v4 as uuidv4 } from "uuid";
import { ADDON_PROVIDER_HUB, IPC_WOWUP_GET_SCAN_RESULTS } from "../../common/constants";
import { Addon } from "../../common/entities/addon";
import { WowClientType } from "../../common/warcraft/wow-client-type";
import { AddonChannelType } from "../../common/wowup/addon-channel-type";
import { WowUpScanResult } from "../../common/wowup/wowup-scan-result";
import { AddonChannelType, WowUpScanResult } from "../../common/wowup/models";
import { AppConfig } from "../../environments/environment";
import { SourceRemovedAddonError } from "../errors";
import { WowUpAddonReleaseRepresentation, WowUpAddonRepresentation } from "../models/wowup-api/addon-representations";

View File

@@ -7,7 +7,7 @@ import { HttpClient } from "@angular/common/http";
import { ADDON_PROVIDER_ZIP } from "../../common/constants";
import { Addon } from "../../common/entities/addon";
import { AddonChannelType } from "../../common/wowup/addon-channel-type";
import { AddonChannelType } from "../../common/wowup/models";
import { AddonSearchResult } from "../models/wowup/addon-search-result";
import { AddonSearchResultFile } from "../models/wowup/addon-search-result-file";
import { Toc } from "../models/wowup/toc";

View File

@@ -31,8 +31,7 @@ import {
ZOOM_FACTOR_KEY,
WOWUP_LOGO_FILENAME,
} from "../common/constants";
import { SystemTrayConfig } from "../common/wowup/system-tray-config";
import { MenuConfig } from "../common/wowup/menu-config";
import { MenuConfig, SystemTrayConfig } from "../common/wowup/models";
import { TelemetryDialogComponent } from "./components/telemetry-dialog/telemetry-dialog.component";
import { ElectronService } from "./services";
import { AddonService } from "./services/addons/addon.service";

View File

@@ -1,12 +1,10 @@
import * as _ from "lodash";
import { AddonDependencyType } from "../../common/wowup/addon-dependency-type";
import { AddonChannelType, AddonDependency, AddonDependencyType } from "../../common/wowup/models";
import { Addon } from "../../common/entities/addon";
import { AddonChannelType } from "../../common/wowup/addon-channel-type";
import { AddonInstallState } from "../models/wowup/addon-install-state";
import { AddonStatusSortOrder } from "../models/wowup/addon-status-sort-order";
import * as AddonUtils from "../utils/addon.utils";
import { ADDON_PROVIDER_UNKNOWN } from "../../common/constants";
import { AddonDependency } from "../../common/wowup/addon-dependency";
export class AddonViewModel {
public addon: Addon;

View File

@@ -1,6 +1,6 @@
import * as _ from "lodash";
import { AddonChannelType } from "../../common/wowup/addon-channel-type";
import { AddonChannelType } from "../../common/wowup/models";
import { AddonInstallState } from "../models/wowup/addon-install-state";
import { AddonSearchResult } from "../models/wowup/addon-search-result";
import * as SearchResults from "../utils/search-result.utils";

View File

@@ -20,9 +20,7 @@ import { TranslateService } from "@ngx-translate/core";
import { ADDON_PROVIDER_GITHUB, ADDON_PROVIDER_UNKNOWN } from "../../../common/constants";
import { AddonFundingLink } from "../../../common/entities/addon";
import { AddonChannelType } from "../../../common/wowup/addon-channel-type";
import { AddonDependency } from "../../../common/wowup/addon-dependency";
import { AddonDependencyType } from "../../../common/wowup/addon-dependency-type";
import { AddonChannelType, AddonDependency, AddonDependencyType } from "../../../common/wowup/models";
import { AddonViewModel } from "../../business-objects/addon-view-model";
import { AddonSearchResult } from "../../models/wowup/addon-search-result";
import { AddonSearchResultDependency } from "../../models/wowup/addon-search-result-dependency";

View File

@@ -3,7 +3,7 @@ import { MatDialog } from "@angular/material/dialog";
import { TranslateService } from "@ngx-translate/core";
import { AddonViewModel } from "../../business-objects/addon-view-model";
import { AddonWarningType } from "../../../common/wowup/addon-warning-type";
import { AddonWarningType } from "../../../common/wowup/models";
import { AlertDialogComponent } from "../alert-dialog/alert-dialog.component";
@Component({

View File

@@ -2,8 +2,7 @@ import { Component, EventEmitter, Input, OnInit, Output } from "@angular/core";
import { TranslateService } from "@ngx-translate/core";
import { AddonViewModel } from "../../business-objects/addon-view-model";
import { AddonDependencyType } from "../../../common/wowup/addon-dependency-type";
import { AddonWarningType } from "../../../common/wowup/addon-warning-type";
import { AddonDependencyType, AddonWarningType } from "../../../common/wowup/models";
import * as AddonUtils from "../../utils/addon.utils";
import { capitalizeString } from "../../utils/string.utils";

View File

@@ -3,8 +3,7 @@ import * as _ from "lodash";
import { Component, EventEmitter, Input, OnChanges, Output, SimpleChanges } from "@angular/core";
import { WowClientType } from "../../../common/warcraft/wow-client-type";
import { AddonChannelType } from "../../../common/wowup/addon-channel-type";
import { AddonDependencyType } from "../../../common/wowup/addon-dependency-type";
import { AddonChannelType, AddonDependencyType } from "../../../common/wowup/models";
import { GetAddonListItem } from "../../business-objects/get-addon-list-item";
import { AddonSearchResult } from "../../models/wowup/addon-search-result";
import { AddonSearchResultDependency } from "../../models/wowup/addon-search-result-dependency";

View File

@@ -9,7 +9,7 @@ import { MatSlideToggleChange } from "@angular/material/slide-toggle";
import { TranslateService } from "@ngx-translate/core";
import { WowClientType } from "../../../common/warcraft/wow-client-type";
import { AddonChannelType } from "../../../common/wowup/addon-channel-type";
import { AddonChannelType } from "../../../common/wowup/models";
import { WowInstallation } from "../../models/wowup/wow-installation";
import { WarcraftInstallationService } from "../../services/warcraft/warcraft-installation.service";
import { getEnumList, getEnumName } from "../../utils/enum.utils";

View File

@@ -1,4 +1,4 @@
import { AddonDependencyType } from "../../../common/wowup/addon-dependency-type";
import { AddonDependencyType } from "../../../common/wowup/models";
export interface AddonSearchResultDependency {
externalAddonId: string;

View File

@@ -1,4 +1,4 @@
import { AddonChannelType } from "../../../common/wowup/addon-channel-type";
import { AddonChannelType } from "../../../common/wowup/models";
import { AddonSearchResultDependency } from "./addon-search-result-dependency";
export interface AddonSearchResultFile {

View File

@@ -1,4 +1,4 @@
import { WowUpScanResult } from "../../../common/wowup/wowup-scan-result";
import { WowUpScanResult } from "../../../common/wowup/models";
import { WowUpAddonRepresentation } from "../wowup-api/addon-representations";
export interface AppWowUpScanResult extends WowUpScanResult {

View File

@@ -1,5 +1,5 @@
import { WowClientType } from "../../../common/warcraft/wow-client-type";
import { AddonChannelType } from "../../../common/wowup/addon-channel-type";
import { AddonChannelType } from "../../../common/wowup/models";
export interface WowInstallation {
id: string;

View File

@@ -28,7 +28,7 @@ import { TranslateService } from "@ngx-translate/core";
import { ADDON_PROVIDER_HUB } from "../../../common/constants";
import { WowClientType } from "../../../common/warcraft/wow-client-type";
import { AddonChannelType } from "../../../common/wowup/addon-channel-type";
import { AddonChannelType } from "../../../common/wowup/models";
import { GetAddonListItem } from "../../business-objects/get-addon-list-item";
import { AddonDetailComponent, AddonDetailModel } from "../../components/addon-detail/addon-detail.component";
import { InstallFromUrlDialogComponent } from "../../components/install-from-url-dialog/install-from-url-dialog.component";

View File

@@ -1,7 +1,7 @@
import { Pipe, PipeTransform } from "@angular/core";
import * as _ from "lodash";
import { GetAddonListItem } from "../business-objects/get-addon-list-item";
import { AddonChannelType } from "../../common/wowup/addon-channel-type";
import { AddonChannelType } from "../../common/wowup/models";
import * as SearchResults from "../utils/search-result.utils";
@Pipe({

View File

@@ -20,10 +20,7 @@ import {
} from "../../../common/constants";
import { Addon, AddonExternalId } from "../../../common/entities/addon";
import { WowClientType } from "../../../common/warcraft/wow-client-type";
import { AddonChannelType } from "../../../common/wowup/addon-channel-type";
import { AddonDependency } from "../../../common/wowup/addon-dependency";
import { AddonDependencyType } from "../../../common/wowup/addon-dependency-type";
import { AddonWarningType } from "../../../common/wowup/addon-warning-type";
import { AddonChannelType, AddonDependency, AddonDependencyType, AddonWarningType } from "../../../common/wowup/models";
import { AddonProvider, GetAllResult } from "../../addon-providers/addon-provider";
import { CurseAddonProvider } from "../../addon-providers/curse-addon-provider";
import { WowUpAddonProvider } from "../../addon-providers/wowup-addon-provider";

View File

@@ -38,7 +38,7 @@ import { IpcRequest } from "../../../common/models/ipc-request";
import { IpcResponse } from "../../../common/models/ipc-response";
import { ValueRequest } from "../../../common/models/value-request";
import { ValueResponse } from "../../../common/models/value-response";
import { AppOptions } from "../../../common/wowup/app-options";
import { AppOptions } from "../../../common/wowup/models";
import { ZoomDirection, ZOOM_SCALE } from "../../utils/zoom.utils";
import { PreferenceStorageService } from "../storage/preference-storage.service";
import { MainChannels, RendererChannels } from "../../../common/wowup";

View File

@@ -13,7 +13,7 @@ import {
WOW_INSTALLATIONS_KEY,
} from "../../../common/constants";
import { WowClientType } from "../../../common/warcraft/wow-client-type";
import { AddonChannelType } from "../../../common/wowup/addon-channel-type";
import { AddonChannelType } from "../../../common/wowup/models";
import { WowInstallation } from "../../models/wowup/wow-installation";
import { getEnumName } from "../../utils/enum.utils";
import { ElectronService } from "../electron/electron.service";

View File

@@ -38,12 +38,10 @@ import {
ADDON_MIGRATION_VERSION_KEY,
IPC_GET_APP_VERSION,
USE_SYMLINK_MODE_PREFERENCE_KEY,
WOW_INSTALLATIONS_KEY,
} from "../../../common/constants";
import { WowClientType } from "../../../common/warcraft/wow-client-type";
import { AddonChannelType } from "../../../common/wowup/addon-channel-type";
import { AddonChannelType } from "../../../common/wowup/models";
import { PreferenceChange } from "../../models/wowup/preference-change";
import { WowInstallation } from "../../models/wowup/wow-installation";
import { SortOrder } from "../../models/wowup/sort-order";
import { WowUpReleaseChannelType } from "../../models/wowup/wowup-release-channel-type";
import { AddonProviderState } from "../../models/wowup/addon-provider-state";
@@ -51,8 +49,6 @@ import { getEnumList, getEnumName } from "../../utils/enum.utils";
import { ElectronService } from "../electron/electron.service";
import { FileService } from "../files/file.service";
import { PreferenceStorageService } from "../storage/preference-storage.service";
import { WarcraftService } from "../warcraft/warcraft.service";
import { filter, map } from "rxjs/operators";
@Injectable({
providedIn: "root",

View File

@@ -1,6 +1,6 @@
import { orderBy, filter, map } from "lodash";
import { Addon, AddonExternalId } from "../../common/entities/addon";
import { AddonDependencyType } from "../../common/wowup/addon-dependency-type";
import { AddonDependency, AddonDependencyType } from "../../common/wowup/models";
export function getAllProviders(addon: Addon): AddonExternalId[] {
return orderBy(addon.externalIds, ["providerName"], ["asc"]);
@@ -14,7 +14,7 @@ export function hasMultipleProviders(addon: Addon): boolean {
return getProviders(addon).length > 0;
}
export function getAddonDependencies(addon: Addon, dependencyType: AddonDependencyType = undefined) {
export function getAddonDependencies(addon: Addon, dependencyType: AddonDependencyType = undefined): AddonDependency[] {
return dependencyType == undefined
? addon.dependencies
: filter(addon.dependencies, (dep) => dep.type === dependencyType);

View File

@@ -1,7 +1,6 @@
import { AddonDependencyType } from "../../common/wowup/addon-dependency-type";
import { AddonChannelType, AddonDependencyType } from "../../common/wowup/models";
import { AddonSearchResultDependency } from "../models/wowup/addon-search-result-dependency";
import * as _ from "lodash";
import { AddonChannelType } from "../../common/wowup/addon-channel-type";
import { AddonSearchResult } from "../models/wowup/addon-search-result";
import { AddonSearchResultFile } from "../models/wowup/addon-search-result-file";

View File

@@ -1,9 +1,7 @@
/// <reference path="../../typings.d.ts" />
import { WowClientType } from "../warcraft/wow-client-type";
import { AddonWarningType } from "../wowup/addon-warning-type";
import { AddonChannelType } from "../wowup/addon-channel-type";
import { AddonDependency } from "../wowup/addon-dependency";
import { AddonChannelType, AddonDependency, AddonWarningType } from "../wowup/models";
export interface AddonExternalId {
providerName: string;

View File

@@ -1,5 +0,0 @@
export enum AddonChannelType {
Stable,
Beta,
Alpha,
}

View File

@@ -1,6 +0,0 @@
export enum AddonDependencyType {
Embedded = 1,
Required = 2,
Optional = 3,
Other = 4,
}

View File

@@ -1,6 +0,0 @@
import { AddonDependencyType } from "./addon-dependency-type";
export interface AddonDependency {
externalAddonId: string;
type: AddonDependencyType;
}

View File

@@ -1,3 +0,0 @@
export enum AddonWarningType {
MissingOnProvider = "missing-on-provider",
}

View File

@@ -1,5 +0,0 @@
export interface AppOptions {
serve?: boolean;
hidden?: boolean;
quit?: boolean;
}

View File

@@ -1,20 +0,0 @@
export interface MenuConfig {
editLabel: string;
viewLabel: string;
zoomOutLabel: string;
zoomInLabel: string;
zoomResetLabel: string;
reloadLabel: string;
forceReloadLabel: string;
toggleDevToolsLabel: string;
toggleFullScreenLabel: string;
quitLabel: string;
undoLabel: string;
redoLabel: string;
cutLabel: string;
copyLabel: string;
pasteLabel: string;
selectAllLabel: string;
windowLabel: string;
windowCloseLabel: string;
}

View File

@@ -0,0 +1,62 @@
export enum AddonChannelType {
Stable,
Beta,
Alpha,
}
export enum AddonDependencyType {
Embedded = 1,
Required = 2,
Optional = 3,
Other = 4,
}
export enum AddonWarningType {
MissingOnProvider = "missing-on-provider",
}
export interface AddonDependency {
externalAddonId: string;
type: AddonDependencyType;
}
export interface AppOptions {
serve?: boolean;
hidden?: boolean;
quit?: boolean;
}
export interface MenuConfig {
editLabel: string;
viewLabel: string;
zoomOutLabel: string;
zoomInLabel: string;
zoomResetLabel: string;
reloadLabel: string;
forceReloadLabel: string;
toggleDevToolsLabel: string;
toggleFullScreenLabel: string;
quitLabel: string;
undoLabel: string;
redoLabel: string;
cutLabel: string;
copyLabel: string;
pasteLabel: string;
selectAllLabel: string;
windowLabel: string;
windowCloseLabel: string;
}
export interface SystemTrayConfig {
showLabel: string;
quitLabel: string;
checkUpdateLabel: string;
}
export interface WowUpScanResult {
fileCount: number;
fileFingerprints: string[];
fingerprint: string;
folderName: string;
path: string;
}

View File

@@ -1,5 +0,0 @@
export interface SystemTrayConfig {
showLabel: string;
quitLabel: string;
checkUpdateLabel: string;
}

View File

@@ -5,7 +5,7 @@ import * as path from "path";
import * as pLimit from "p-limit";
import * as log from "electron-log";
import { readDirRecursive, readFile, readFileAsBuffer } from "../../../file.utils";
import { WowUpScanResult } from "./wowup-scan-result";
import { WowUpScanResult } from "./models";
const INVALID_PATH_CHARS = [
"|",

View File

@@ -1,5 +0,0 @@
import { IpcRequest } from "../models/ipc-request";
export interface WowUpGetScanResultsRequest extends IpcRequest {
filePaths: string[];
}

View File

@@ -1,6 +0,0 @@
import { WowUpScanResult } from "./wowup-scan-result";
export interface WowUpGetScanResultsResponse {
error?: Error;
scanResults: WowUpScanResult[];
}

View File

@@ -1,7 +0,0 @@
export interface WowUpScanResult {
fileCount: number;
fileFingerprints: string[];
fingerprint: string;
folderName: string;
path: string;
}

View File

@@ -4,7 +4,7 @@ import * as path from "path";
import * as platform from "./platform";
import { WOWUP_LOGO_FILENAME, WOWUP_LOGO_MAC_SYSTEM_TRAY } from "./src/common/constants";
import { SystemTrayConfig } from "./src/common/wowup/system-tray-config";
import { SystemTrayConfig } from "./src/common/wowup/models";
let _trayRef: Tray;