From 84d6ea5118d4c167c5ab973f01bbb5abe2a08663 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pau=20Ferrer=20Oca=C3=B1a?= Date: Fri, 21 Dec 2018 13:28:47 +0100 Subject: [PATCH 1/2] MOBILE-2722 sitehome: Reset blocks list when not suported --- src/core/sitehome/components/index/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/sitehome/components/index/index.ts b/src/core/sitehome/components/index/index.ts index be5e0bda3..9bf86850d 100644 --- a/src/core/sitehome/components/index/index.ts +++ b/src/core/sitehome/components/index/index.ts @@ -158,6 +158,7 @@ export class CoreSiteHomeIndexComponent implements OnInit { if (canGetBlocks) { this.domUtils.showErrorModal(error); } + this.blocks = []; // Cannot get the blocks, just show site main menu if needed. if (sections[0] && this.courseHelper.sectionHasContent(sections[0])) { @@ -166,7 +167,6 @@ export class CoreSiteHomeIndexComponent implements OnInit { }); this.hasSupportedBlock = true; } else { - this.blocks = []; this.hasSupportedBlock = false; } }); From 597480c48fe020c31db5b102dd1a70aec77ec319 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pau=20Ferrer=20Oca=C3=B1a?= Date: Fri, 21 Dec 2018 13:42:37 +0100 Subject: [PATCH 2/2] MOBILE-2722 site: Add version class when adding site --- src/app/app.component.ts | 10 ++++++++++ src/providers/sites.ts | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/app/app.component.ts b/src/app/app.component.ts index a896c24d1..5c1f462b4 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -154,6 +154,16 @@ export class MoodleMobileApp implements OnInit { } }); + this.eventsProvider.on(CoreEventsProvider.SITE_ADDED, (data) => { + if (data.siteId == this.sitesProvider.getCurrentSiteId()) { + loadCustomStrings(); + + // Add version classes to body. + this.removeVersionClass(); + this.addVersionClass(this.sitesProvider.getReleaseNumber(data.release || '')); + } + }); + // Pause Youtube videos in Android when app is put in background or screen is locked. this.platform.pause.subscribe(() => { if (!this.platform.is('android')) { diff --git a/src/providers/sites.ts b/src/providers/sites.ts index b08fc0fd9..0d6a63aac 100644 --- a/src/providers/sites.ts +++ b/src/providers/sites.ts @@ -488,7 +488,7 @@ export class CoreSitesProvider { this.sites[siteId] = candidateSite; // Store session. this.login(siteId); - this.eventsProvider.trigger(CoreEventsProvider.SITE_ADDED, {}, siteId); + this.eventsProvider.trigger(CoreEventsProvider.SITE_ADDED, info, siteId); if (this.siteTablesSchemas.length) { // Create tables in the site's database.