summaryrefslogtreecommitdiffhomepage
path: root/android/lib/common/src
diff options
context:
space:
mode:
authorJonatan Rhodin <jonatan.rhodin@mullvad.net>2025-08-14 14:27:26 +0200
committerJonatan Rhodin <jonatan.rhodin@mullvad.net>2025-08-22 13:49:04 +0200
commitc5b594a4d081579b66930fd696cbc5c440288e8f (patch)
tree8157fb9e969d031cd8404b79c4ea52e10523bde1 /android/lib/common/src
parent744950926a5295de0d829a7bcdddfff0711308bb (diff)
downloadmullvadvpn-c5b594a4d081579b66930fd696cbc5c440288e8f.tar.xz
mullvadvpn-c5b594a4d081579b66930fd696cbc5c440288e8f.zip
Improve connect on start up information
Diffstat (limited to 'android/lib/common/src')
-rw-r--r--android/lib/common/src/main/kotlin/net/mullvad/mullvadvpn/lib/common/util/ContextExtensions.kt12
1 files changed, 12 insertions, 0 deletions
diff --git a/android/lib/common/src/main/kotlin/net/mullvad/mullvadvpn/lib/common/util/ContextExtensions.kt b/android/lib/common/src/main/kotlin/net/mullvad/mullvadvpn/lib/common/util/ContextExtensions.kt
index 2d82bc56f4..9da4243631 100644
--- a/android/lib/common/src/main/kotlin/net/mullvad/mullvadvpn/lib/common/util/ContextExtensions.kt
+++ b/android/lib/common/src/main/kotlin/net/mullvad/mullvadvpn/lib/common/util/ContextExtensions.kt
@@ -31,3 +31,15 @@ fun Context.openVpnSettings(): Either<ActivityNotFoundException, Unit> =
}
.onLeft { Logger.e("Failed to open VPN settings", it) }
.mapLeft { it as? ActivityNotFoundException ?: throw it }
+
+fun Context.openAppDetailsSettings(): Either<ActivityNotFoundException, Unit> =
+ Either.catch {
+ val intent =
+ Intent(
+ "android.settings.APPLICATION_DETAILS_SETTINGS",
+ "package:$packageName".toUri(),
+ )
+ startActivity(intent)
+ }
+ .onLeft { Logger.e("Failed to open app details settings", it) }
+ .mapLeft { it as? ActivityNotFoundException ?: throw it }