summaryrefslogtreecommitdiffhomepage
path: root/android/app/src
diff options
context:
space:
mode:
Diffstat (limited to 'android/app/src')
-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>