diff --git a/shared/domain/src/iosMain/kotlin/fr/androidmakers/domain/utils/UrlOpener.ios.kt b/shared/domain/src/iosMain/kotlin/fr/androidmakers/domain/utils/UrlOpener.ios.kt index c25b855d..97bcc1ab 100644 --- a/shared/domain/src/iosMain/kotlin/fr/androidmakers/domain/utils/UrlOpener.ios.kt +++ b/shared/domain/src/iosMain/kotlin/fr/androidmakers/domain/utils/UrlOpener.ios.kt @@ -2,13 +2,24 @@ package fr.androidmakers.domain.utils import platform.Foundation.NSURL import platform.UIKit.UIApplication +import platform.darwin.dispatch_async +import platform.darwin.dispatch_get_main_queue actual class UrlOpener { actual fun openUrl(url: String): Boolean { val urlObj = NSURL(string = url) return if (UIApplication.sharedApplication.canOpenURL(urlObj)) { - UIApplication.sharedApplication.openURL(urlObj) + val application = UIApplication.sharedApplication + + application.openURL(url = urlObj, options = emptyMap()) { + if (!it) { + println("Could not open $url") + } + } true - } else { false } + } else { + false + } } } +