MOBILE-3914 menu: Fix more badge calculation

main
Pau Ferrer Ocaña 2021-11-16 22:47:54 +01:00
parent 3cfa76f7f7
commit ee6263a006
1 changed files with 7 additions and 2 deletions

View File

@ -183,8 +183,13 @@ export class CoreMainMenuPage implements OnInit, OnDestroy {
return;
}
const numItems = CoreMainMenu.getNumItems();
this.moreBadge = this.allHandlers.some((handler, index) => (handler.onlyInMore || index >= numItems) && !!handler.badge);
// Calculate the main handlers not to display them in this view.
const mainHandlers = this.allHandlers
.filter((handler) => !handler.onlyInMore)
.slice(0, CoreMainMenu.getNumItems());
// Use only the handlers that don't appear in the main view.
this.moreBadge = this.allHandlers.some((handler) => mainHandlers.indexOf(handler) == -1 && !!handler.badge);
}
/**