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/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; } }); 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.