NSC: improve connectivity message

This commit is contained in:
Milos Kozak 2023-10-30 14:02:26 +01:00
parent aa2ae1b99f
commit 51e4a98497
3 changed files with 10 additions and 2 deletions

View file

@ -7,4 +7,7 @@ class EventNetworkChange(
var ssid: String = "",
var roaming: Boolean = false,
var metered: Boolean = false
) : Event()
) : Event() {
val isAnyConnection : Boolean
get() = mobileConnected || wifiConnected
}

View file

@ -84,7 +84,11 @@ class ReceiverDelegate @Inject constructor(
val newNetworkState = calculateStatus(ev)
if (newNetworkState != allowedNetworkState) {
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()
}
}

View file

@ -41,6 +41,7 @@
<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_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="openaps_short">OAPS</string>
<string name="uploader_short">UPLD</string>