-
-
Notifications
You must be signed in to change notification settings - Fork 917
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reserve statusbar for something else
- Loading branch information
1 parent
8f6ffd5
commit 45b59d2
Showing
7 changed files
with
1 addition
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,17 @@ | ||
import { get as getConfig } from "../ConfigStorage"; | ||
import CONFIGURATOR from "../data_storage"; | ||
|
||
export function ispConnected() { | ||
const connected = navigator.onLine; | ||
const isMetered = getConfig('meteredConnection').meteredConnection; | ||
|
||
// navigator.connection is not available | ||
if (!navigator.connection) { | ||
return connected && !isMetered; | ||
} | ||
|
||
// navigator.connection is available | ||
const type = navigator.connection.effectiveType; | ||
const downlink = navigator.connection.downlink; | ||
const rtt = navigator.connection.rtt; | ||
|
||
if (isMetered || type === 'none' || !connected) { | ||
CONFIGURATOR.networkStatus = 'Offline'; | ||
if (isMetered || navigator.connection.effectiveType === 'none' || !connected) { | ||
return false; | ||
} else if (type === 'slow-2g' || type === '2g' || downlink < 0.115 || rtt > 1000) { | ||
CONFIGURATOR.networkStatus = 'Slow'; | ||
return true; | ||
} | ||
|
||
CONFIGURATOR.networkStatus = 'Online'; | ||
return true; | ||
} | ||
|