mirror of
https://github.com/WowUp/WowUp.git
synced 2026-05-24 14:35:53 -04:00
Fix an issue with the app breaking if no battlenet is installed
This commit is contained in:
@@ -21,7 +21,7 @@ export class GetAddonListItem {
|
||||
return this.searchResult.externalId;
|
||||
}
|
||||
|
||||
public constructor(searchResult: AddonSearchResult, defaultAddonChannel: AddonChannelType) {
|
||||
public constructor(searchResult: AddonSearchResult, defaultAddonChannel?: AddonChannelType) {
|
||||
this.searchResult = searchResult;
|
||||
this.author = this.searchResult.author;
|
||||
this.name = this.searchResult.name;
|
||||
@@ -30,9 +30,11 @@ export class GetAddonListItem {
|
||||
this.downloadCount = this.searchResult.downloadCount || 0;
|
||||
this.canonicalName = this.name.toLowerCase();
|
||||
|
||||
const latestFile = SearchResults.getLatestFile(searchResult, defaultAddonChannel);
|
||||
this.latestAddonChannel = latestFile?.channelType ?? AddonChannelType.Stable;
|
||||
if (defaultAddonChannel) {
|
||||
const latestFile = SearchResults.getLatestFile(searchResult, defaultAddonChannel);
|
||||
this.latestAddonChannel = latestFile?.channelType ?? AddonChannelType.Stable;
|
||||
|
||||
this.releasedAt = new Date(latestFile?.releaseDate ?? new Date()).getTime();
|
||||
this.releasedAt = new Date(latestFile?.releaseDate ?? new Date()).getTime();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -108,8 +108,8 @@ export class GetAddonsComponent implements OnInit, OnDestroy {
|
||||
{ name: "status", display: "PAGES.GET_ADDONS.TABLE.STATUS_COLUMN_HEADER", visible: true },
|
||||
];
|
||||
|
||||
public get defaultAddonChannel(): AddonChannelType {
|
||||
return this._sessionService.getSelectedWowInstallation().defaultAddonChannelType;
|
||||
public get defaultAddonChannel(): AddonChannelType | undefined {
|
||||
return this._sessionService.getSelectedWowInstallation()?.defaultAddonChannelType;
|
||||
}
|
||||
|
||||
public query = "";
|
||||
@@ -196,9 +196,8 @@ export class GetAddonsComponent implements OnInit, OnDestroy {
|
||||
public relativeDurationPipe: RelativeDurationPipe,
|
||||
public downloadCountPipe: DownloadCountPipe
|
||||
) {
|
||||
this.overlayNoRowsTemplate = `<span class="text-1 mat-h1">${
|
||||
_translateService.instant("COMMON.SEARCH.NO_ADDONS") as string
|
||||
}</span>`;
|
||||
this.overlayNoRowsTemplate = `<span class="text-1 mat-h1">${_translateService.instant("COMMON.SEARCH.NO_ADDONS") as string
|
||||
}</span>`;
|
||||
|
||||
this.wowInstallations$ = warcraftInstallationService.wowInstallations$;
|
||||
|
||||
@@ -289,6 +288,11 @@ export class GetAddonsComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
|
||||
public onRowDoubleClicked(evt: RowDoubleClickedEvent): void {
|
||||
const defaultChannel = this.defaultAddonChannel;
|
||||
if (!defaultChannel) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.openDetailDialog(evt.data.searchResult as AddonSearchResult, this.defaultAddonChannel);
|
||||
evt.node.setSelected(true);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user