summaryrefslogtreecommitdiffhomepage
path: root/android/lib/common/src
diff options
context:
space:
mode:
authorJonatan Rhodin <jonatan.rhodin@mullvad.net>2025-08-22 14:23:25 +0200
committerJonatan Rhodin <jonatan.rhodin@mullvad.net>2025-08-22 14:23:25 +0200
commit056774af87263998aae923bc8783c9d46f6f0542 (patch)
tree8157fb9e969d031cd8404b79c4ea52e10523bde1 /android/lib/common/src
parent744950926a5295de0d829a7bcdddfff0711308bb (diff)
parentc5b594a4d081579b66930fd696cbc5c440288e8f (diff)
downloadmullvadvpn-056774af87263998aae923bc8783c9d46f6f0542.tar.xz
mullvadvpn-056774af87263998aae923bc8783c9d46f6f0542.zip
Merge branch 'connect-on-start-up-does-not-seems-to-work-if-app-installed-droid-2132'
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 }