From ed19df5c8e1020a12358efe55e9afa1f27fdb22b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pau=20Ferrer=20Oca=C3=B1a?= Date: Thu, 28 Oct 2021 11:14:49 +0200 Subject: [PATCH] MOBILE-3807 usermenu: Hide usermenu button when the path is not main --- .../user-menu-button/user-menu-button.html | 12 +++--------- .../user-menu-button/user-menu-button.ts | 16 ++++++++++++---- 2 files changed, 15 insertions(+), 13 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 1d9f61bde..998f7e7c0 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,9 +1,3 @@ - \ No newline at end of file + + 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 c1acf9857..d95001748 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,8 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. -import { Component } from '@angular/core'; +import { Component, OnInit } from '@angular/core'; import { CoreSiteInfo } from '@classes/site'; +import { IonRouterOutlet } from '@ionic/angular'; import { CoreSites } from '@services/sites'; import { CoreDomUtils } from '@services/utils/dom'; import { CoreMainMenuUserMenuComponent } from '../user-menu/user-menu'; @@ -27,17 +28,24 @@ import { CoreMainMenuUserMenuComponent } from '../user-menu/user-menu'; selector: 'core-user-menu-button', templateUrl: 'user-menu-button.html', }) -export class CoreMainMenuUserButtonComponent { +export class CoreMainMenuUserButtonComponent implements OnInit { siteInfo?: CoreSiteInfo; + isMainScreen = false; - constructor() { + constructor(protected routerOutlet: IonRouterOutlet) { const currentSite = CoreSites.getRequiredCurrentSite(); - // @TODO: Check if the page where I currently am is at level 0. this.siteInfo = currentSite.getInfo(); } + /** + * @inheritdoc + */ + ngOnInit(): void { + this.isMainScreen = !this.routerOutlet.canGoBack(); + } + /** * Open User menu *