Merge pull request #1351 from albertgasset/MOBILE-2431

Mobile 2431
main
Juan Leyva 2018-06-19 16:39:22 +02:00 committed by GitHub
commit 81e7898286
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 15 additions and 7 deletions

View File

@ -139,6 +139,10 @@ export class AddonModChatChatPage {
return this.chatProvider.getMessagesUserData(messagesInfo.messages, this.courseId).then((messages) => {
this.messages = this.messages.concat(messages);
if (messages.length) {
// New messages or beeps, scroll to bottom.
setTimeout(() => this.scrollToBottom());
}
});
});
}

View File

@ -90,9 +90,11 @@ export class AddonModSurveyOfflineProvider {
getAllData(siteId?: string): Promise<any> {
return this.sitesProvider.getSite(siteId).then((site) => {
return site.getDb().getAllRecords(AddonModSurveyOfflineProvider.SURVEY_TABLE).then((entries) => {
return entries.map((entry) => {
entries.forEach((entry) => {
entry.answers = this.textUtils.parseJSON(entry.answers);
});
return entries;
});
});
}

View File

@ -54,8 +54,7 @@ export class AddonRemoteThemesModule {
load: remoteThemesProvider.preloadSites.bind(remoteThemesProvider)
});
let addingSite,
unloadTmpStyles;
let addingSite;
// When a new site is added to the app, add its styles.
eventsProvider.on(CoreEventsProvider.SITE_ADDED, (data) => {
@ -68,9 +67,10 @@ export class AddonRemoteThemesModule {
addingSite = false;
}
if (unloadTmpStyles == data.siteId) {
// This site had some tmp styles loaded, unload them.
// User has logged in, remove tmp styles and enable loaded styles.
if (data.siteId == sitesProvider.getCurrentSiteId()) {
remoteThemesProvider.unloadTmpStyles();
remoteThemesProvider.enable(data.siteId);
}
});
});
@ -86,6 +86,7 @@ export class AddonRemoteThemesModule {
// Enable styles of current site on login.
eventsProvider.on(CoreEventsProvider.LOGIN, (data) => {
remoteThemesProvider.unloadTmpStyles();
remoteThemesProvider.enable(data.siteId);
});
@ -106,10 +107,9 @@ export class AddonRemoteThemesModule {
// Unload temporary styles when site config is "unchecked" in login.
eventsProvider.on(CoreEventsProvider.LOGIN_SITE_UNCHECKED, (data) => {
if (data.siteId && data.siteid == addingSite) {
if (data.siteId && data.siteId === addingSite) {
// The tmp styles are from a site that is being added permanently.
// Wait for the final site styles to be loaded before removing the tmp styles so there is no blink effect.
unloadTmpStyles = data.siteId;
} else {
// The tmp styles are from a site that wasn't added in the end. Just remove them.
remoteThemesProvider.unloadTmpStyles();

View File

@ -14,6 +14,7 @@
import { NgModule } from '@angular/core';
import { IonicPageModule } from 'ionic-angular';
import { CoreDirectivesModule } from '@directives/directives.module';
import { CoreLoginForgottenPasswordPage } from './forgotten-password';
import { TranslateModule } from '@ngx-translate/core';
@ -22,6 +23,7 @@ import { TranslateModule } from '@ngx-translate/core';
CoreLoginForgottenPasswordPage
],
imports: [
CoreDirectivesModule,
IonicPageModule.forChild(CoreLoginForgottenPasswordPage),
TranslateModule.forChild()
]