MOBILE-2654 settings: Fix wifi connection check
parent
8f99fab2e4
commit
5faf831480
|
@ -613,7 +613,7 @@ export class CoreCourseHelperProvider {
|
|||
return this.filepoolProvider.getPackageStatus(siteId, component, componentId).then((status) => {
|
||||
result.status = status;
|
||||
|
||||
const isWifi = !this.appProvider.isNetworkAccessLimited(),
|
||||
const isWifi = this.appProvider.isWifi(),
|
||||
isOnline = this.appProvider.isOnline();
|
||||
|
||||
if (status === CoreConstants.DOWNLOADED) {
|
||||
|
@ -642,7 +642,7 @@ export class CoreCourseHelperProvider {
|
|||
});
|
||||
}, () => {
|
||||
// Start the download if in wifi, but return the URL right away so the file is opened.
|
||||
if (isWifi && isOnline) {
|
||||
if (isWifi) {
|
||||
this.downloadModule(module, courseId, component, componentId, files, siteId);
|
||||
}
|
||||
|
||||
|
|
|
@ -99,7 +99,7 @@ export class CoreSettingsAboutPage {
|
|||
});
|
||||
|
||||
this.networkStatus = appProvider.isOnline() ? 'core.online' : 'core.offline';
|
||||
this.wifiConnection = appProvider.isNetworkAccessLimited() ? 'core.no' : 'core.yes';
|
||||
this.wifiConnection = appProvider.isWifi() ? 'core.yes' : 'core.no';
|
||||
this.deviceWebWorkers = !!window['Worker'] && !!window['URL'] ? 'core.yes' : 'core.no';
|
||||
this.device = device;
|
||||
|
||||
|
|
|
@ -219,7 +219,7 @@ export class CoreExternalContentDirective implements AfterViewInit {
|
|||
clickableEl.addEventListener(eventName, () => {
|
||||
// User played media or opened a downloadable link.
|
||||
// Download the file if in wifi and it hasn't been downloaded already (for big files).
|
||||
if (!this.appProvider.isNetworkAccessLimited()) {
|
||||
if (this.appProvider.isWifi()) {
|
||||
// We aren't using the result, so it doesn't matter which of the 2 functions we call.
|
||||
this.filepoolProvider.getUrlByUrl(siteId, url, this.component, this.componentId, 0, false);
|
||||
}
|
||||
|
|
|
@ -244,6 +244,15 @@ export class CoreAppProvider {
|
|||
return limited.indexOf(type) > -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if device uses a wifi connection.
|
||||
*
|
||||
* @return {boolean} Whether the device uses a wifi connection.
|
||||
*/
|
||||
isWifi(): boolean {
|
||||
return this.isOnline() && !this.isNetworkAccessLimited();
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the app is running in a Windows environment.
|
||||
*
|
||||
|
|
|
@ -162,7 +162,7 @@ export class CoreCronDelegate {
|
|||
if (isSync) {
|
||||
// Check network connection.
|
||||
promise = this.configProvider.get(CoreConstants.SETTINGS_SYNC_ONLY_ON_WIFI, false).then((syncOnlyOnWifi) => {
|
||||
return !syncOnlyOnWifi || !this.appProvider.isNetworkAccessLimited();
|
||||
return !syncOnlyOnWifi || this.appProvider.isWifi();
|
||||
});
|
||||
} else {
|
||||
promise = Promise.resolve(true);
|
||||
|
|
|
@ -132,7 +132,7 @@ export class CoreFileHelperProvider {
|
|||
|
||||
return promise.then((state) => {
|
||||
// The file system is available.
|
||||
const isWifi = !this.appProvider.isNetworkAccessLimited(),
|
||||
const isWifi = this.appProvider.isWifi(),
|
||||
isOnline = this.appProvider.isOnline();
|
||||
|
||||
if (state == CoreConstants.DOWNLOADED) {
|
||||
|
@ -160,7 +160,7 @@ export class CoreFileHelperProvider {
|
|||
return this.downloadFile(fileUrl, component, componentId, timemodified, onProgress, file, siteId);
|
||||
}, () => {
|
||||
// Start the download if in wifi, but return the URL right away so the file is opened.
|
||||
if (isWifi && isOnline) {
|
||||
if (isWifi) {
|
||||
this.downloadFile(fileUrl, component, componentId, timemodified, onProgress, file, siteId);
|
||||
}
|
||||
|
||||
|
|
|
@ -775,7 +775,7 @@ export class CoreFilepoolProvider {
|
|||
|
||||
// Calculate the size of the file.
|
||||
return promise.then((size) => {
|
||||
const isWifi = !this.appProvider.isNetworkAccessLimited(),
|
||||
const isWifi = this.appProvider.isWifi(),
|
||||
sizeUnknown = size <= 0;
|
||||
|
||||
if (!sizeUnknown) {
|
||||
|
|
Loading…
Reference in New Issue