From 63e2baaa15f5ae1bfdffe0faf768643d631458d0 Mon Sep 17 00:00:00 2001 From: Norbel AMBANUMBEN Date: Wed, 27 Nov 2024 12:11:10 +0100 Subject: [PATCH] fix: `mailto` on android (#311) --- .../src/commonMain/composeResources/values/untraslatable.xml | 2 +- .../kotlin/org/ooni/probe/domain/SendSupportEmail.kt | 1 - .../src/iosMain/kotlin/org/ooni/probe/SetupDependencies.kt | 5 ++--- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/composeApp/src/commonMain/composeResources/values/untraslatable.xml b/composeApp/src/commonMain/composeResources/values/untraslatable.xml index 9bd0951e..d4ff1224 100644 --- a/composeApp/src/commonMain/composeResources/values/untraslatable.xml +++ b/composeApp/src/commonMain/composeResources/values/untraslatable.xml @@ -1,5 +1,5 @@ - mailto:bugs@openobservatory.org + bugs@openobservatory.org [bug-report] OONI Probe %1$s %1$s: %2$s diff --git a/composeApp/src/commonMain/kotlin/org/ooni/probe/domain/SendSupportEmail.kt b/composeApp/src/commonMain/kotlin/org/ooni/probe/domain/SendSupportEmail.kt index 4289f140..29b4cd34 100644 --- a/composeApp/src/commonMain/kotlin/org/ooni/probe/domain/SendSupportEmail.kt +++ b/composeApp/src/commonMain/kotlin/org/ooni/probe/domain/SendSupportEmail.kt @@ -14,7 +14,6 @@ class SendSupportEmail( private val launchAction: (PlatformAction) -> Boolean, ) { suspend operator fun invoke() { - getString(Res.string.shareEmailTo) val supportEmail = getString(Res.string.shareEmailTo) val subject = getString(Res.string.shareSubject, platformInfo.version) val chooserTitle = getString(Res.string.Settings_SendEmail_Label) diff --git a/composeApp/src/iosMain/kotlin/org/ooni/probe/SetupDependencies.kt b/composeApp/src/iosMain/kotlin/org/ooni/probe/SetupDependencies.kt index 308d98bc..0ef4c7ff 100644 --- a/composeApp/src/iosMain/kotlin/org/ooni/probe/SetupDependencies.kt +++ b/composeApp/src/iosMain/kotlin/org/ooni/probe/SetupDependencies.kt @@ -162,7 +162,6 @@ class SetupDependencies( private fun sendMail(action: PlatformAction.Mail): Boolean { MFMailComposeViewController.canSendMail().let { canSendMail -> - val email = action.to.removePrefix("mailto:") if (canSendMail) { MFMailComposeViewController().apply { mailComposeDelegate = object : @@ -176,7 +175,7 @@ class SetupDependencies( controller.dismissViewControllerAnimated(true, null) } } - setToRecipients(listOf(email)) + setToRecipients(listOf(action.to)) setSubject(action.subject) setMessageBody(action.body, isHTML = false) }.let { @@ -188,7 +187,7 @@ class SetupDependencies( } return true } else { - UIPasteboard.generalPasteboard.string = email + UIPasteboard.generalPasteboard.string = action.to return false } }