Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions composeApp/src/iosMain/kotlin/org/ooni/probe/SetupDependencies.kt
Original file line number Diff line number Diff line change
Expand Up @@ -345,13 +345,20 @@ class SetupDependencies(
}

private fun openUrl(openUrl: PlatformAction.OpenUrl): Boolean {
val url = openUrl.url
return NSURL.URLWithString(url)?.let {
if (UIApplication.sharedApplication.canOpenURL(it)) {
UIApplication.sharedApplication.openURL(it)
val urlString = openUrl.url
return NSURL.URLWithString(urlString)?.let { nsUrlString ->
if (UIApplication.sharedApplication.canOpenURL(nsUrlString)) {
UIApplication.sharedApplication.openURL(url = nsUrlString, options = emptyMap<Any?, Any>(), completionHandler = {
isSuccessfullyOpened ->
if (isSuccessfullyOpened) {
Logger.i { "Successfully opened URL: $urlString" }
} else {
Logger.e { "Failed to open URL: $urlString" }
}
})
return@let true
} else {
Logger.e { "Cannot open URL: $url" }
Logger.e { "Cannot open URL: $urlString" }
return@let false
}
} ?: false
Expand Down
Loading