From 72c7e0503a5deb3f737e582704b4f9f865e1bbc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pau=20Ferrer=20Oca=C3=B1a?= Date: Tue, 10 Dec 2024 10:19:41 +0100 Subject: [PATCH] MOBILE-4653 core: Remove and protect unused code --- .../mainmenu/components/user-menu/user-menu.ts | 4 ++-- src/core/features/mainmenu/pages/home/home.ts | 17 +---------------- 2 files changed, 3 insertions(+), 18 deletions(-) diff --git a/src/core/features/mainmenu/components/user-menu/user-menu.ts b/src/core/features/mainmenu/components/user-menu/user-menu.ts index 6fbb49298..0cb2ba4d5 100644 --- a/src/core/features/mainmenu/components/user-menu/user-menu.ts +++ b/src/core/features/mainmenu/components/user-menu/user-menu.ts @@ -50,9 +50,7 @@ import { CoreSiteLogoComponent } from '@/core/components/site-logo/site-logo'; }) export class CoreMainMenuUserMenuComponent implements OnInit, OnDestroy { - siteId?: string; siteInfo?: CoreSiteInfo; - siteName?: string; siteUrl?: string; displaySiteUrl = false; handlers: CoreUserProfileHandlerData[] = []; @@ -63,6 +61,8 @@ export class CoreMainMenuUserMenuComponent implements OnInit, OnDestroy { displayContactSupport = false; removeAccountOnLogout = false; + protected siteId?: string; + protected siteName?: string; protected subscription!: Subscription; /** diff --git a/src/core/features/mainmenu/pages/home/home.ts b/src/core/features/mainmenu/pages/home/home.ts index 31dacfced..d1fd26cb1 100644 --- a/src/core/features/mainmenu/pages/home/home.ts +++ b/src/core/features/mainmenu/pages/home/home.ts @@ -16,7 +16,7 @@ import { Component, OnInit, ViewChild } from '@angular/core'; import { Subscription } from 'rxjs'; import { CoreSites } from '@services/sites'; -import { CoreEventObserver, CoreEvents } from '@singletons/events'; +import { CoreEventObserver } from '@singletons/events'; import { CoreTabsOutletComponent, CoreTabsOutletTab } from '@components/tabs-outlet/tabs-outlet'; import { CoreMainMenuHomeDelegate, CoreMainMenuHomeHandlerToDisplay } from '../../services/home-delegate'; import { CoreArray } from '@singletons/array'; @@ -44,16 +44,9 @@ export class CoreMainMenuHomePage implements OnInit { * @inheritdoc */ async ngOnInit(): Promise { - await this.loadSiteName(); - this.subscription = CoreMainMenuHomeDelegate.getHandlersObservable().subscribe((handlers) => { handlers && this.initHandlers(handlers); }); - - // Refresh the enabled flags if site is updated. - this.updateSiteObserver = CoreEvents.on(CoreEvents.SITE_UPDATED, async () => { - await this.loadSiteName(); - }, CoreSites.getCurrentSiteId()); } /** @@ -92,14 +85,6 @@ export class CoreMainMenuHomePage implements OnInit { }, 50); } - /** - * Load the site name. - */ - protected async loadSiteName(): Promise { - const site = CoreSites.getRequiredCurrentSite(); - this.siteName = await site.getSiteName() || ''; - } - /** * Tab was selected. */