summaryrefslogtreecommitdiffhomepage
path: root/android/app/src/main/kotlin
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/app/src/main/kotlin
parent7807a1c469a48413e6f68f3008e078429c3ce63d (diff)
downloadmullvadvpn-56c7ad9bb18cbbf91c44eef752df9639d4b8048b.tar.xz
mullvadvpn-56c7ad9bb18cbbf91c44eef752df9639d4b8048b.zip
Clarify device offline push notification
Diffstat (limited to 'android/app/src/main/kotlin')
-rw-r--r--android/app/src/main/kotlin/net/mullvad/mullvadvpn/service/notifications/TunnelStateNotification.kt11
1 files changed, 10 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) {