NSC: improve connectivity message
This commit is contained in:
parent
aa2ae1b99f
commit
51e4a98497
3 changed files with 10 additions and 2 deletions
|
@ -7,4 +7,7 @@ class EventNetworkChange(
|
||||||
var ssid: String = "",
|
var ssid: String = "",
|
||||||
var roaming: Boolean = false,
|
var roaming: Boolean = false,
|
||||||
var metered: Boolean = false
|
var metered: Boolean = false
|
||||||
) : Event()
|
) : Event() {
|
||||||
|
val isAnyConnection : Boolean
|
||||||
|
get() = mobileConnected || wifiConnected
|
||||||
|
}
|
|
@ -84,7 +84,11 @@ class ReceiverDelegate @Inject constructor(
|
||||||
val newNetworkState = calculateStatus(ev)
|
val newNetworkState = calculateStatus(ev)
|
||||||
if (newNetworkState != allowedNetworkState) {
|
if (newNetworkState != allowedNetworkState) {
|
||||||
allowedNetworkState = newNetworkState
|
allowedNetworkState = newNetworkState
|
||||||
if (!newNetworkState) blockingReason = rh.gs(R.string.blocked_by_connectivity)
|
if (!newNetworkState) {
|
||||||
|
blockingReason =
|
||||||
|
if (!ev.isAnyConnection) rh.gs(R.string.no_connectivity)
|
||||||
|
else rh.gs(R.string.blocked_by_connectivity)
|
||||||
|
}
|
||||||
processStateChange()
|
processStateChange()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,6 +41,7 @@
|
||||||
<string name="description_ns_client_v3">Synchronizes your data with Nightscout using v3 API</string>
|
<string name="description_ns_client_v3">Synchronizes your data with Nightscout using v3 API</string>
|
||||||
<string name="blocked_by_charging">Blocked by charging options</string>
|
<string name="blocked_by_charging">Blocked by charging options</string>
|
||||||
<string name="blocked_by_connectivity">Blocked by connectivity options</string>
|
<string name="blocked_by_connectivity">Blocked by connectivity options</string>
|
||||||
|
<string name="no_connectivity">No connectivity</string>
|
||||||
<string name="unsupported_ns_version">Unsupported version of Nightscout</string>
|
<string name="unsupported_ns_version">Unsupported version of Nightscout</string>
|
||||||
<string name="openaps_short">OAPS</string>
|
<string name="openaps_short">OAPS</string>
|
||||||
<string name="uploader_short">UPLD</string>
|
<string name="uploader_short">UPLD</string>
|
||||||
|
|
Loading…
Reference in a new issue