MOBILE-4456 activitymodules: Get branded from icons

main
Pau Ferrer Ocaña 2024-03-05 13:45:30 +01:00
parent 732a21160c
commit 9c28b32557
2 changed files with 8 additions and 1 deletions

View File

@ -63,6 +63,8 @@ export class AddonBlockActivityModulesComponent extends CoreBlockBaseComponent i
const archetypes: Record<string, number> = {};
const modIcons: Record<string, string> = {};
let modFullNames: Record<string, string> = {};
const brandedIcons: Record<string, boolean|undefined> = {};
sections.forEach((section) => {
if (!section.modules) {
return;
@ -93,6 +95,8 @@ export class AddonBlockActivityModulesComponent extends CoreBlockBaseComponent i
modFullNames[mod.modname] = mod.modplural;
}
brandedIcons[mod.modname] = mod.branded;
// If this is not a theme image, leave it undefined to avoid having specific activity icons.
if (CoreUrlUtils.isThemeImageUrl(mod.modicon)) {
modIcons[mod.modname] = mod.modicon;
@ -111,6 +115,7 @@ export class AddonBlockActivityModulesComponent extends CoreBlockBaseComponent i
iconModName,
name: modFullNames[modName],
modName,
branded: brandedIcons[iconModName],
});
}
}
@ -149,4 +154,5 @@ type AddonBlockActivityModuleEntry = {
name: string;
modName: string;
iconModName: string;
branded?: boolean;
};

View File

@ -5,7 +5,8 @@
</ion-item-divider>
<core-loading [hideUntil]="loaded">
<ion-item class="ion-text-wrap" *ngFor="let entry of entries" [detail]="true" button (click)="gotoCoureListModType(entry)">
<core-mod-icon slot="start" [modicon]="entry.icon" [modname]="entry.iconModName" [showAlt]="false" [colorize]="false" />
<core-mod-icon slot="start" [modicon]="entry.icon" [modname]="entry.iconModName" [showAlt]="false" [colorize]="false"
[isBranded]="entry.branded" />
<ion-label>{{ entry.name }}</ion-label>
</ion-item>
</core-loading>