MOBILE-3639 core: Remove Network warnings in browser

main
Dani Palou 2021-03-30 13:24:45 +02:00
parent 53d808ad76
commit 76611fabae
1 changed files with 7 additions and 5 deletions

View File

@ -334,10 +334,14 @@ export class CoreAppProvider {
return false; return false;
} }
if (!this.isMobile()) {
return navigator.onLine;
}
let online = Network.type !== null && Network.type != Network.Connection.NONE && let online = Network.type !== null && Network.type != Network.Connection.NONE &&
Network.type != Network.Connection.UNKNOWN; Network.type != Network.Connection.UNKNOWN;
// Double check we are not online because we cannot rely 100% in Cordova APIs. Also, check it in browser. // Double check we are not online because we cannot rely 100% in Cordova APIs.
if (!online && navigator.onLine) { if (!online && navigator.onLine) {
online = true; online = true;
} }
@ -351,9 +355,7 @@ export class CoreAppProvider {
* @return Whether the device uses a limited connection. * @return Whether the device uses a limited connection.
*/ */
isNetworkAccessLimited(): boolean { isNetworkAccessLimited(): boolean {
const type = Network.type; if (!this.isMobile()) {
if (type === null) {
// Plugin not defined, probably in browser.
return false; return false;
} }
@ -364,7 +366,7 @@ export class CoreAppProvider {
Network.Connection.CELL, Network.Connection.CELL,
]; ];
return limited.indexOf(type) > -1; return limited.indexOf(Network.type) > -1;
} }
/** /**