Suresh Maidaragi
12/07/2023, 9:03 AMJan Holešovský
12/07/2023, 10:07 AMSuresh Maidaragi
12/07/2023, 10:10 AMJan Holešovský
12/07/2023, 10:22 AMSuresh Maidaragi
12/07/2023, 10:23 AMJan Holešovský
12/07/2023, 10:23 AMJan Holešovský
12/07/2023, 10:25 AMJan Holešovský
12/07/2023, 10:26 AMSuresh Maidaragi
12/07/2023, 10:27 AMSuresh Maidaragi
12/07/2023, 10:28 AMSuresh Maidaragi
12/07/2023, 10:28 AMJan Holešovský
12/07/2023, 10:28 AMJan Holešovský
12/07/2023, 10:31 AMSpoudel347
12/07/2023, 12:44 PMval uriHandler = LocalUriHandler.current
LaunchedEffect(Unit) {
uriHandler.openUri("tel:9999999999")
}
Suresh Maidaragi
12/07/2023, 12:48 PMSuresh Maidaragi
12/07/2023, 12:56 PMSpoudel347
12/07/2023, 1:00 PMtel:
schema doesn't work on an ios simulator but works on the actual device.Spoudel347
12/07/2023, 1:00 PMSuresh Maidaragi
12/07/2023, 1:00 PMSuresh Maidaragi
12/07/2023, 1:01 PMSuresh Maidaragi
12/07/2023, 1:02 PMexpect class PhoneDialer() {
fun dialNumber(phoneNumber: Number)
fun openURL(url: String)
}
actual class PhoneDialer actual constructor() : KoinComponent {
private val context: Context by inject<Context>()
actual fun dialNumber(phoneNumber: Number) {
val intent = Intent(Intent.ACTION_DIAL).apply {
data = Uri.parse("tel:$phoneNumber")
}
context.startActivity(intent)
}
actual fun openURL(url: String) {
}
}
actual class PhoneDialer actual constructor() {
actual fun dialNumber(phoneNumber: Number) {
val phoneURL = NSURL(string = "tel://$phoneNumber")
if (UIApplication.sharedApplication.canOpenURL(phoneURL)) {
UIApplication.sharedApplication.openURL(phoneURL)
} else {
println("Cannot open dialer")
}
}
actual fun openURL(url: String) {
val webURL = NSURL(string = url)
if (UIApplication.sharedApplication.canOpenURL(webURL)) {
UIApplication.sharedApplication.openURL(webURL)
} else {
println("Cannot open URL")
}
}
}
I was about to write thisSpoudel347
12/07/2023, 1:03 PM