Skip to content

Commit

Permalink
MOBILE-4266 app: isOnline always returned true on webapp
Browse files Browse the repository at this point in the history
  • Loading branch information
crazyserver committed Jan 31, 2024
1 parent 2c9091c commit bcc6cfd
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/core/services/network.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,15 @@ export class CoreNetworkService extends Network {
return;
}

const type = this.connectionType;
// We cannot use navigator.onLine because it has issues in some devices.
// See https://bugs.chromium.org/p/chromium/issues/detail?id=811122
if (!CorePlatform.isAndroid()) {
this.online = navigator.onLine;

return;
}

const type = this.connectionType;
let online = type !== null && type !== CoreNetworkConnection.NONE && type !== CoreNetworkConnection.UNKNOWN;

// Double check we are not online because we cannot rely 100% in Cordova APIs.
Expand Down

0 comments on commit bcc6cfd

Please sign in to comment.