Merge pull request #1692 from crazyserver/MOBILE-2722-2

Mobile 2722 2
main
Juan Leyva 2018-12-21 14:59:06 +01:00 committed by GitHub
commit f17ae52a15
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 2 deletions

View File

@ -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')) {

View File

@ -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;
}
});

View File

@ -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.