Merge pull request #1365 from dpalou/MOBILE-2431

Mobile 2431
main
Juan Leyva 2018-06-21 23:01:19 +02:00 committed by GitHub
commit b3b4411b43
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 43 additions and 11 deletions

View File

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<widget id="com.moodle.moodlemobile" version="3.5.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>Moodle Mobile</name>
<description>Moodle Mobile official app</description>
<name>Moodle</name>
<description>Moodle official app</description>
<author email="mobile@moodle.com" href="http://moodle.com">Moodle Mobile team</author>
<content src="index.html" />
<access origin="*" />

View File

@ -381,8 +381,7 @@ export class AddonModGlossaryIndexComponent extends CoreCourseModuleMainActivity
*/
protected eventReceived(data: any): void {
if (this.glossary && this.glossary.id === data.glossaryId) {
this.loaded = false;
this.loadContent();
this.showLoadingAndRefresh(false);
// Check completion since it could be configured to complete once the user adds a new discussion or replies.
this.courseProvider.checkModuleCompletion(this.courseId, this.module.completionstatus);

View File

@ -795,4 +795,23 @@ ion-alert.core-inapp-notification {
margin-bottom: 5px;
}
}
}
}
.core-icon-with-badge {
position: relative;
.icon {
font-size: 32px;
}
.core-icon-badge {
width: auto;
height: auto;
margin: 0;
position: absolute;
top: -18px;
right: -8px;
color: red;
font-size: 16px;
}
}

View File

@ -27,6 +27,7 @@ import { CoreTimeUtilsProvider } from '@providers/utils/time';
import { CoreUtilsProvider } from '@providers/utils/utils';
import { CoreCourseOptionsDelegate, CoreCourseOptionsHandlerToDisplay } from './options-delegate';
import { CoreSiteHomeProvider } from '@core/sitehome/providers/sitehome';
import { CoreCoursesProvider } from '@core/courses/providers/courses';
import { CoreCourseProvider } from './course';
import { CoreCourseModuleDelegate } from './module-delegate';
import { CoreCourseModulePrefetchDelegate } from './module-prefetch-delegate';
@ -120,7 +121,8 @@ export class CoreCourseHelperProvider {
private utils: CoreUtilsProvider, private translate: TranslateService, private loginHelper: CoreLoginHelperProvider,
private courseOptionsDelegate: CoreCourseOptionsDelegate, private siteHomeProvider: CoreSiteHomeProvider,
private eventsProvider: CoreEventsProvider, private fileHelper: CoreFileHelperProvider,
private appProvider: CoreAppProvider, private fileProvider: CoreFileProvider, private injector: Injector) { }
private appProvider: CoreAppProvider, private fileProvider: CoreFileProvider, private injector: Injector,
private coursesProvider: CoreCoursesProvider) { }
/**
* This function treats every module on the sections provided to load the handler data, treat completion
@ -1004,6 +1006,10 @@ export class CoreCourseHelperProvider {
}
});
// Prefetch other data needed to render the course.
promises.push(this.coursesProvider.getCoursesByField('id', course.id));
promises.push(this.courseProvider.getActivitiesCompletionStatus(course.id));
return this.utils.allPromises(promises);
}).then(() => {
// Download success, mark the course as downloaded.

View File

@ -115,6 +115,10 @@ export class CoreCoursesProvider {
return courseIds;
});
} else {
if (courseIds.length > 1 && courseIds.indexOf(siteHomeId) == -1) {
courseIds.push(siteHomeId);
}
return courseIds;
}
});

View File

@ -17,6 +17,7 @@ import {
LoadingController, Loading, ToastController, Toast, AlertController, Alert, Platform, Content,
ModalController
} from 'ionic-angular';
import { DomSanitizer } from '@angular/platform-browser';
import { TranslateService } from '@ngx-translate/core';
import { CoreTextUtilsProvider } from './text';
import { CoreAppProvider } from '../app';
@ -42,7 +43,7 @@ export class CoreDomUtilsProvider {
constructor(private translate: TranslateService, private loadingCtrl: LoadingController, private toastCtrl: ToastController,
private alertCtrl: AlertController, private textUtils: CoreTextUtilsProvider, private appProvider: CoreAppProvider,
private platform: Platform, private configProvider: CoreConfigProvider, private urlUtils: CoreUrlUtilsProvider,
private modalCtrl: ModalController) { }
private modalCtrl: ModalController, private sanitizer: DomSanitizer) { }
/**
* Equivalent to element.closest(). If the browser doesn't support element.closest, it will
@ -474,13 +475,16 @@ export class CoreDomUtilsProvider {
* Given an error message, return a suitable error title.
*
* @param {string} message The error message.
* @return {string} Title.
* @return {any} Title.
*/
private getErrorTitle(message: string): string {
private getErrorTitle(message: string): any {
if (message == this.translate.instant('core.networkerrormsg') ||
message == this.translate.instant('core.fileuploader.errormustbeonlinetoupload')) {
return '<span class="core-icon-with-badge"><i class="icon ion-wifi"></i>\
<i class="icon ion-alert-circled core-icon-badge"></i></span>';
return this.sanitizer.bypassSecurityTrustHtml('<div text-center><span class="core-icon-with-badge">' +
'<ion-icon role="img" class="icon fa fa-wifi" aria-label="wifi"></ion-icon>' +
'<ion-icon class="icon fa fa-exclamation-triangle core-icon-badge"></ion-icon>' +
'</span></div>');
}
return this.textUtils.decodeHTML(this.translate.instant('core.error'));