From fcea6c311cd7a357d30e2d5e5ca5ffc89b553113 Mon Sep 17 00:00:00 2001 From: Dani Palou Date: Mon, 10 Jun 2024 16:53:25 +0200 Subject: [PATCH] MOBILE-4470 user-menu: Fix interval running forever in tablet In tablet the user-menu-button at the top right was hidden using CSS, but this button has a user tour associated. This meant that the user tour kept looking for the button to be visible forever, checking it every 50ms. --- .../components/user-menu-button/user-menu-button.html | 4 ++-- .../components/user-menu-button/user-menu-button.scss | 4 ---- .../components/user-menu-button/user-menu-button.ts | 9 ++++----- 3 files changed, 6 insertions(+), 11 deletions(-) diff --git a/src/core/features/mainmenu/components/user-menu-button/user-menu-button.html b/src/core/features/mainmenu/components/user-menu-button/user-menu-button.html index 766db041e..03cb08f3b 100644 --- a/src/core/features/mainmenu/components/user-menu-button/user-menu-button.html +++ b/src/core/features/mainmenu/components/user-menu-button/user-menu-button.html @@ -1,3 +1,3 @@ - diff --git a/src/core/features/mainmenu/components/user-menu-button/user-menu-button.scss b/src/core/features/mainmenu/components/user-menu-button/user-menu-button.scss index 4e2aba989..9e1de95e2 100644 --- a/src/core/features/mainmenu/components/user-menu-button/user-menu-button.scss +++ b/src/core/features/mainmenu/components/user-menu-button/user-menu-button.scss @@ -1,7 +1,3 @@ -:host-context(ion-tabs.placement-side ion-toolbar) { - display: none; -} - :host core-user-avatar { --userpicture-padding: 6px !important; } diff --git a/src/core/features/mainmenu/components/user-menu-button/user-menu-button.ts b/src/core/features/mainmenu/components/user-menu-button/user-menu-button.ts index 9d83a9e83..e747efdeb 100644 --- a/src/core/features/mainmenu/components/user-menu-button/user-menu-button.ts +++ b/src/core/features/mainmenu/components/user-menu-button/user-menu-button.ts @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -import { Component, Input, OnInit } from '@angular/core'; +import { Component, Input, OnInit, Optional } from '@angular/core'; import { CoreSiteInfo } from '@classes/sites/unauthenticated-site'; import { CoreUserTourDirectiveOptions } from '@directives/user-tour'; import { CoreUserToursAlignment, CoreUserToursSide } from '@features/usertours/services/user-tours'; @@ -22,6 +22,7 @@ import { CoreSites } from '@services/sites'; import { CoreDomUtils } from '@services/utils/dom'; import { CoreMainMenuUserMenuTourComponent } from '../user-menu-tour/user-menu-tour'; import { CoreMainMenuUserMenuComponent } from '../user-menu/user-menu'; +import { CoreMainMenuPage } from '@features/mainmenu/pages/menu/menu'; /** * Component to display an avatar on the header to open user menu. @@ -45,10 +46,8 @@ export class CoreMainMenuUserButtonComponent implements OnInit { side: CoreScreen.isMobile ? CoreUserToursSide.Start : CoreUserToursSide.End, }; - constructor(protected routerOutlet: IonRouterOutlet) { - const currentSite = CoreSites.getRequiredCurrentSite(); - - this.siteInfo = currentSite.getInfo(); + constructor(protected routerOutlet: IonRouterOutlet, @Optional() protected menuPage: CoreMainMenuPage | null) { + this.siteInfo = CoreSites.getCurrentSite()?.getInfo(); } /**