summaryrefslogtreecommitdiffhomepage
path: root/android
diff options
context:
space:
mode:
authorAlbin <albin@mullvad.net>2023-02-22 15:54:19 +0100
committerAlbin <albin@mullvad.net>2023-04-13 09:36:49 +0200
commit56c7ad9bb18cbbf91c44eef752df9639d4b8048b (patch)
tree4e7c70aa7ca679ed07b881cf8f5474e6cee54f75 /android
parent7807a1c469a48413e6f68f3008e078429c3ce63d (diff)
downloadmullvadvpn-56c7ad9bb18cbbf91c44eef752df9639d4b8048b.tar.xz
mullvadvpn-56c7ad9bb18cbbf91c44eef752df9639d4b8048b.zip
Clarify device offline push notification
Diffstat (limited to 'android')
-rw-r--r--android/app/src/main/kotlin/net/mullvad/mullvadvpn/service/notifications/TunnelStateNotification.kt11
-rw-r--r--android/app/src/main/res/values/strings.xml1
2 files changed, 11 insertions, 1 deletions
diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/service/notifications/TunnelStateNotification.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/service/notifications/TunnelStateNotification.kt
index 0a2aa186f8..f58f3b6ad6 100644
--- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/service/notifications/TunnelStateNotification.kt
+++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/service/notifications/TunnelStateNotification.kt
@@ -13,6 +13,7 @@ import net.mullvad.mullvadvpn.ui.MainActivity
import net.mullvad.mullvadvpn.util.SdkUtils
import net.mullvad.mullvadvpn.util.getErrorNotificationResources
import net.mullvad.talpid.tunnel.ActionAfterDisconnect
+import net.mullvad.talpid.tunnel.ErrorStateCause
class TunnelStateNotification(val context: Context) {
companion object {
@@ -50,10 +51,18 @@ class TunnelStateNotification(val context: Context) {
}
}
is TunnelState.Error -> {
- state.errorState.getErrorNotificationResources(context).titleResourceId
+ if (state.isDeviceOffline()) {
+ R.string.blocking_internet_device_offline
+ } else {
+ state.errorState.getErrorNotificationResources(context).titleResourceId
+ }
}
}
+ private fun TunnelState.isDeviceOffline(): Boolean {
+ return (this as? TunnelState.Error)?.errorState?.cause is ErrorStateCause.IsOffline
+ }
+
private val shouldDisplayOngoingNotification: Boolean
get() =
when (tunnelState) {
diff --git a/android/app/src/main/res/values/strings.xml b/android/app/src/main/res/values/strings.xml
index b63ad7ba68..228ded723a 100644
--- a/android/app/src/main/res/values/strings.xml
+++ b/android/app/src/main/res/values/strings.xml
@@ -108,6 +108,7 @@
<string name="in_address">In</string>
<string name="out_address">Out</string>
<string name="blocking_internet">Blocking internet</string>
+ <string name="blocking_internet_device_offline">Blocking internet (device offline)</string>
<string name="not_blocking_internet">YOU MIGHT BE LEAKING NETWORK TRAFFIC</string>
<string name="failed_to_block_internet">Failed to block all network traffic. Please
troubleshoot or report the problem to us.</string>