diff --git a/src/core/course/components/format/format.ts b/src/core/course/components/format/format.ts
index b6ec4c1de..cd9a0bd00 100644
--- a/src/core/course/components/format/format.ts
+++ b/src/core/course/components/format/format.ts
@@ -250,25 +250,30 @@ export class CoreCourseFormatComponent implements OnInit, OnChanges, OnDestroy {
this.selectedSection = newSection;
this.data.section = this.selectedSection;
- // Select next and previous sections to show the arrows.
- const i = this.sections.findIndex((value, index) => {
- return this.compareSections(value, this.selectedSection);
- });
+ if (newSection.id != this.allSectionsId) {
+ // Select next and previous sections to show the arrows.
+ const i = this.sections.findIndex((value, index) => {
+ return this.compareSections(value, this.selectedSection);
+ });
- let j;
- for (j = i - 1; j >= 1; j--) {
- if (this.sections[j].uservisible !== false && this.sections[j].hasContent) {
- break;
+ let j;
+ for (j = i - 1; j >= 1; j--) {
+ if (this.sections[j].uservisible !== false && this.sections[j].hasContent) {
+ break;
+ }
}
- }
- this.previousSection = j >= 1 ? this.sections[j] : null;
+ this.previousSection = j >= 1 ? this.sections[j] : null;
- for (j = i + 1; j < this.sections.length; j++) {
- if (this.sections[j].uservisible !== false && this.sections[j].hasContent) {
- break;
+ for (j = i + 1; j < this.sections.length; j++) {
+ if (this.sections[j].uservisible !== false && this.sections[j].hasContent) {
+ break;
+ }
}
+ this.nextSection = j < this.sections.length ? this.sections[j] : null;
+ } else {
+ this.previousSection = null;
+ this.nextSection = null;
}
- this.nextSection = j < this.sections.length ? this.sections[j] : null;
if (this.moduleId && typeof previousValue == 'undefined') {
setTimeout(() => {
diff --git a/src/core/course/providers/helper.ts b/src/core/course/providers/helper.ts
index 87eb371d9..eb3f239b5 100644
--- a/src/core/course/providers/helper.ts
+++ b/src/core/course/providers/helper.ts
@@ -153,7 +153,7 @@ export class CoreCourseHelperProvider {
}
// Check if the module is stealth.
- module.isStealth = !module.visibleoncoursepage || (module.visible && !section.visible);
+ module.isStealth = module.visibleoncoursepage === 0 || (module.visible && !section.visible);
});
});
@@ -539,6 +539,10 @@ export class CoreCourseHelperProvider {
return this.downloadModuleWithMainFileIfNeeded(module, courseId, component, componentId, files, siteId)
.then((result) => {
if (result.path.indexOf('http') === 0) {
+ /* In iOS, if we use the same URL in embedded browser and background download then the download only
+ downloads a few bytes (cached ones). Add a hash to the URL so both URLs are different. */
+ result.path = result.path + '#moodlemobile-embedded';
+
return this.utils.openOnlineFile(result.path).catch((error) => {
// Error opening the file, some apps don't allow opening online files.
if (!this.fileProvider.isAvailable()) {
diff --git a/src/core/settings/pages/space-usage/space-usage.html b/src/core/settings/pages/space-usage/space-usage.html
index d2eef1677..1d2af6c8d 100644
--- a/src/core/settings/pages/space-usage/space-usage.html
+++ b/src/core/settings/pages/space-usage/space-usage.html
@@ -20,9 +20,5 @@
{{ 'core.settings.total' | translate }}
{{ totalUsage | coreBytesToSize }}
-
- {{ 'core.settings.estimatedfreespace' | translate }}
- {{ freeSpace | coreBytesToSize }}
-
diff --git a/src/core/settings/pages/space-usage/space-usage.ts b/src/core/settings/pages/space-usage/space-usage.ts
index 0f10c8545..3fec9f5d1 100644
--- a/src/core/settings/pages/space-usage/space-usage.ts
+++ b/src/core/settings/pages/space-usage/space-usage.ts
@@ -16,7 +16,6 @@ import { Component, } from '@angular/core';
import { IonicPage } from 'ionic-angular';
import { TranslateService } from '@ngx-translate/core';
import { CoreAppProvider } from '@providers/app';
-import { CoreFileProvider } from '@providers/file';
import { CoreFilepoolProvider } from '@providers/filepool';
import { CoreSitesProvider } from '@providers/sites';
import { CoreTextUtilsProvider } from '@providers/utils/text';
@@ -36,14 +35,11 @@ export class CoreSettingsSpaceUsagePage {
sites = [];
currentSiteId = '';
totalUsage = 0;
- freeSpace = 0;
- showFreeSpace = true;
- constructor(private fileProvider: CoreFileProvider, private filePoolProvider: CoreFilepoolProvider,
+ constructor(private filePoolProvider: CoreFilepoolProvider,
private sitesProvider: CoreSitesProvider, private textUtils: CoreTextUtilsProvider,
private translate: TranslateService, private domUtils: CoreDomUtilsProvider, appProvider: CoreAppProvider) {
this.currentSiteId = this.sitesProvider.getCurrentSiteId();
- this.showFreeSpace = !appProvider.isDesktop();
}
/**
@@ -91,26 +87,7 @@ export class CoreSettingsSpaceUsagePage {
}
/**
- * Convenience function to calculate free space in the device.
- *
- * @return {Promise} Resolved when done.
- */
- protected calculateFreeSpace(): Promise {
- if (this.fileProvider.isAvailable()) {
- return this.fileProvider.calculateFreeSpace().then((freeSpace) => {
- this.freeSpace = freeSpace;
- }).catch(() => {
- this.freeSpace = 0;
- });
- } else {
- this.freeSpace = 0;
-
- return Promise.resolve(null);
- }
- }
-
- /**
- * Convenience function to calculate space usage and free space in the device.
+ * Convenience function to calculate space usage.
*
* @return {Promise} Resolved when done.
*/
@@ -119,10 +96,6 @@ export class CoreSettingsSpaceUsagePage {
this.calculateSizeUsage().then(() => this.calculateTotalUsage()),
];
- if (this.showFreeSpace) {
- promises.push(this.calculateFreeSpace());
- }
-
return Promise.all(promises);
}
@@ -138,7 +111,7 @@ export class CoreSettingsSpaceUsagePage {
}
/**
- * Convenience function to update site size, along with total usage and free space.
+ * Convenience function to update site size, along with total usage.
*
* @param {any} site Site object with space usage.
* @param {number} newUsage New space usage of the site in bytes.
@@ -147,7 +120,6 @@ export class CoreSettingsSpaceUsagePage {
const oldUsage = site.spaceUsage;
site.spaceUsage = newUsage;
this.totalUsage -= oldUsage - newUsage;
- this.freeSpace += oldUsage - newUsage;
}
/**
diff --git a/src/core/settings/pages/synchronization/synchronization.html b/src/core/settings/pages/synchronization/synchronization.html
index 8bc615145..cf802612b 100644
--- a/src/core/settings/pages/synchronization/synchronization.html
+++ b/src/core/settings/pages/synchronization/synchronization.html
@@ -8,7 +8,7 @@
{{ 'core.settings.syncsettings' | translate }}
-
+
{{ 'core.settings.enablesyncwifi' | translate }}
@@ -16,7 +16,7 @@
{{ 'core.settings.sites' | translate }}
-
+
{{ site.fullName }}
{{ site.siteUrl }}
diff --git a/src/core/sharedfiles/pages/list/list.ts b/src/core/sharedfiles/pages/list/list.ts
index ad3f6f136..db1f706b5 100644
--- a/src/core/sharedfiles/pages/list/list.ts
+++ b/src/core/sharedfiles/pages/list/list.ts
@@ -121,10 +121,10 @@ export class CoreSharedFilesListPage implements OnInit, OnDestroy {
* Called when a file is renamed. Update the list.
*
* @param {number} index Position of the file.
- * @param {any} file New FileEntry.
+ * @param {any} data Data containing the new FileEntry.
*/
- fileRenamed(index: number, file: any): void {
- this.files[index] = file;
+ fileRenamed(index: number, data: any): void {
+ this.files[index] = data.file;
}
/**
diff --git a/src/core/sitehome/components/index/index.ts b/src/core/sitehome/components/index/index.ts
index b11a585c9..df8452399 100644
--- a/src/core/sitehome/components/index/index.ts
+++ b/src/core/sitehome/components/index/index.ts
@@ -146,7 +146,7 @@ export class CoreSiteHomeIndexComponent implements OnInit {
if (hasNewsItem && this.block && this.block.modules) {
// Remove forum activity (news one only) to prevent duplicates.
- this.siteHomeProvider.getNewsForum(this.siteHomeId).then((forum) => {
+ return this.siteHomeProvider.getNewsForum(this.siteHomeId).then((forum) => {
// Search the module that belongs to site news.
for (let i = 0; i < this.block.modules.length; i++) {
const module = this.block.modules[i];
diff --git a/src/core/user/pages/about/about.html b/src/core/user/pages/about/about.html
index f5db37701..3e6932169 100644
--- a/src/core/user/pages/about/about.html
+++ b/src/core/user/pages/about/about.html
@@ -31,10 +31,7 @@
{{ 'core.user.address' | translate}}
-
-
-
-
+
diff --git a/src/core/user/pages/about/about.ts b/src/core/user/pages/about/about.ts
index 9d9b77a05..2054e9754 100644
--- a/src/core/user/pages/about/about.ts
+++ b/src/core/user/pages/about/about.ts
@@ -13,6 +13,7 @@
// limitations under the License.
import { Component } from '@angular/core';
+import { DomSanitizer } from '@angular/platform-browser';
import { IonicPage, NavParams, Platform } from 'ionic-angular';
import { CoreUserProvider } from '../../providers/user';
import { CoreUserHelperProvider } from '../../providers/helper';
@@ -41,7 +42,7 @@ export class CoreUserAboutPage {
title: string;
constructor(navParams: NavParams, private userProvider: CoreUserProvider, private userHelper: CoreUserHelperProvider,
- private domUtils: CoreDomUtilsProvider, private eventsProvider: CoreEventsProvider,
+ private domUtils: CoreDomUtilsProvider, private eventsProvider: CoreEventsProvider, private sanitizer: DomSanitizer,
private sitesProvider: CoreSitesProvider, private platform: Platform) {
this.userId = navParams.get('userId');
@@ -68,7 +69,8 @@ export class CoreUserAboutPage {
if (user.address) {
user.address = this.userHelper.formatAddress(user.address, user.city, user.country);
- user.encodedAddress = encodeURIComponent(user.address);
+ user.encodedAddress = this.sanitizer.bypassSecurityTrustUrl(
+ (this.isAndroid ? 'geo:0,0?q=' : 'http://maps.google.com?q=') + encodeURIComponent(user.address));
}
this.hasContact = user.email || user.phone1 || user.phone2 || user.city || user.country || user.address;
diff --git a/src/providers/file-helper.ts b/src/providers/file-helper.ts
index 4bd5d3f37..79c76d1fc 100644
--- a/src/providers/file-helper.ts
+++ b/src/providers/file-helper.ts
@@ -56,6 +56,10 @@ export class CoreFileHelperProvider {
}
if (url.indexOf('http') === 0) {
+ /* In iOS, if we use the same URL in embedded browser and background download then the download only
+ downloads a few bytes (cached ones). Add a hash to the URL so both URLs are different. */
+ url = url + '#moodlemobile-embedded';
+
return this.utils.openOnlineFile(url).catch((error) => {
// Error opening the file, some apps don't allow opening online files.
if (!this.fileProvider.isAvailable()) {
diff --git a/src/providers/file.ts b/src/providers/file.ts
index 15ac2513a..6b7469f32 100644
--- a/src/providers/file.ts
+++ b/src/providers/file.ts
@@ -360,12 +360,19 @@ export class CoreFileProvider {
/**
* Calculate the free space in the disk.
+ * Please notice that this function isn't reliable and it's not documented in the Cordova File plugin.
*
* @return {Promise} Promise resolved with the estimated free space in bytes.
*/
calculateFreeSpace(): Promise {
return this.file.getFreeDiskSpace().then((size) => {
- return size; // GetFreeDiskSpace returns KB.
+ if (this.platform.is('ios')) {
+ // In iOS the size is in bytes.
+ return Number(size);
+ }
+
+ // The size is in KB, convert it to bytes.
+ return Number(size) * 1024;
});
}