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

View File

@ -5,7 +5,8 @@
</ion-item-divider> </ion-item-divider>
<core-loading [hideUntil]="loaded"> <core-loading [hideUntil]="loaded">
<ion-item class="ion-text-wrap" *ngFor="let entry of entries" [detail]="true" button (click)="gotoCoureListModType(entry)"> <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-label>{{ entry.name }}</ion-label>
</ion-item> </ion-item>
</core-loading> </core-loading>