summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-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
-rw-r--r--gui/locales/messages.pot3
3 files changed, 14 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>
diff --git a/gui/locales/messages.pot b/gui/locales/messages.pot
index db9fb1e92c..dc50a1aad9 100644
--- a/gui/locales/messages.pot
+++ b/gui/locales/messages.pot
@@ -1623,6 +1623,9 @@ msgstr ""
msgid "Always-on VPN might be enabled for another app"
msgstr ""
+msgid "Blocking internet (device offline)"
+msgstr ""
+
msgid "Copied Mullvad account number to clipboard"
msgstr ""