Skip to content

Commit

Permalink
fix: mailto on android (#311)
Browse files Browse the repository at this point in the history
  • Loading branch information
aanorbel authored Nov 27, 2024
1 parent 5f331c2 commit 63e2baa
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<resources>
<string name="shareEmailTo" translatable="false">mailto:[email protected]</string>
<string name="shareEmailTo" translatable="false">[email protected]</string>
<string name="shareSubject" translatable="false">[bug-report] OONI Probe %1$s</string>
<string name="version" translatable="false">%1$s: %2$s</string>
</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 :
Expand All @@ -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 {
Expand All @@ -188,7 +187,7 @@ class SetupDependencies(
}
return true
} else {
UIPasteboard.generalPasteboard.string = email
UIPasteboard.generalPasteboard.string = action.to
return false
}
}
Expand Down

0 comments on commit 63e2baa

Please sign in to comment.