diff --git a/src/addons/badges/classes/user-badges-source.ts b/src/addons/badges/classes/user-badges-source.ts index ee1b6ed5f..1ece130e0 100644 --- a/src/addons/badges/classes/user-badges-source.ts +++ b/src/addons/badges/classes/user-badges-source.ts @@ -33,10 +33,10 @@ export class AddonBadgesUserBadgesSource extends CoreItemsManagerSource { + protected async loadPageItems(): Promise<{ items: AddonBadgesUserBadge[] }> { const badges = await AddonBadges.getUserBadges(this.COURSE_ID, this.USER_ID); - return { items: badges, hasMoreItems: false }; + return { items: badges }; } } diff --git a/src/addons/badges/pages/issued-badge/issued-badge.page.ts b/src/addons/badges/pages/issued-badge/issued-badge.page.ts index bd9764a36..f89064f85 100644 --- a/src/addons/badges/pages/issued-badge/issued-badge.page.ts +++ b/src/addons/badges/pages/issued-badge/issued-badge.page.ts @@ -143,11 +143,7 @@ class AddonBadgesUserBadgesSwipeManager extends CoreSwipeItemsManager { async reload(): Promise { const { items, hasMoreItems } = await this.loadPageItems(0); - this.setItems(items, hasMoreItems); + this.setItems(items, hasMoreItems ?? false); } /** @@ -140,7 +140,7 @@ export abstract class CoreItemsManagerSource { const { items, hasMoreItems } = await this.loadPageItems(this.getPagesLoaded()); - this.setItems((this.items ?? []).concat(items), hasMoreItems); + this.setItems((this.items ?? []).concat(items), hasMoreItems ?? false); } /** @@ -149,7 +149,7 @@ export abstract class CoreItemsManagerSource { * @param page Page number (starting at 0). * @return Page items data. */ - protected abstract loadPageItems(page: number): Promise<{ items: Item[]; hasMoreItems: boolean }>; + protected abstract loadPageItems(page: number): Promise<{ items: Item[]; hasMoreItems?: boolean }>; /** * Get the length of each page in the collection. diff --git a/src/core/classes/items-management/items-manager.ts b/src/core/classes/items-management/items-manager.ts index ebab07bc7..edc277469 100644 --- a/src/core/classes/items-management/items-manager.ts +++ b/src/core/classes/items-management/items-manager.ts @@ -101,10 +101,10 @@ export abstract class CoreItemsManager /** * @inheritdoc */ - protected getSelectedItemPath(route?: ActivatedRouteSnapshot | null): string | null { - if (!route) { - return null; - } - + protected getSelectedItemPathFromRoute(route: ActivatedRouteSnapshot): string | null { return route.params.userId; }