diff --git a/CHANGELOG.md b/CHANGELOG.md index cf7342b5..00f6a3ab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,9 @@ and this application adheres to [Semantic Versioning](https://semver.org/spec/v2 - The Message text field on the Send Form screen has been updated to provide the Return key on the software keyboard and make auto-capitalization on the beginning of every sentence or new line. +### Fixed +- `EmailUtils.newMailActivityIntent` has been updated to produce an `Intent` that more e-mail clients can understand + ## [1.2 (731)] - 2024-09-16 ### Changed diff --git a/docs/whatsNew/WHATS_NEW_EN.md b/docs/whatsNew/WHATS_NEW_EN.md index 857e146b..a60d23b1 100644 --- a/docs/whatsNew/WHATS_NEW_EN.md +++ b/docs/whatsNew/WHATS_NEW_EN.md @@ -16,6 +16,9 @@ directly impact users rather than highlighting other key architectural updates.* - The Message text field on the Send Form screen has been updated to provide the Return key on the software keyboard and make auto-capitalization on the beginning of every sentence or new line. +### Fixed +- `EmailUtils.newMailActivityIntent` has been updated to produce an `Intent` that more e-mail clients can understand + ## [1.2 (731)] - 2024-09-16 ### Added diff --git a/ui-lib/src/main/java/co/electriccoin/zcash/ui/util/EmailUtil.kt b/ui-lib/src/main/java/co/electriccoin/zcash/ui/util/EmailUtil.kt index c179b926..9558fd9c 100644 --- a/ui-lib/src/main/java/co/electriccoin/zcash/ui/util/EmailUtil.kt +++ b/ui-lib/src/main/java/co/electriccoin/zcash/ui/util/EmailUtil.kt @@ -1,3 +1,5 @@ +@file:Suppress("UnusedPrivateMember") + package co.electriccoin.zcash.ui.util import android.content.Intent @@ -24,7 +26,7 @@ object EmailUtil { recipientAddress: String, messageSubject: String, messageBody: String - ): Intent = newIntentAsUri(recipientAddress, messageSubject, messageBody) + ): Intent = newIntentAsUriAndExtras(recipientAddress, messageSubject, messageBody) private fun newIntentAsUri( recipientAddress: String, @@ -69,6 +71,24 @@ object EmailUtil { } } + // This approach combines both adding data to Uri and Extras to ensure that most of the available e-mail client + // apps can understand the output Intent. Tested with Gmail, Proton mail, Yahoo, and Seznam.cz. + private fun newIntentAsUriAndExtras( + recipientAddress: String, + messageSubject: String, + messageBody: String + ) = Intent(Intent.ACTION_SENDTO).apply { + data = Uri.parse(newMailToUriString(recipientAddress, messageSubject, messageBody)) + putExtra( + Intent.EXTRA_EMAIL, + arrayOf( + recipientAddress + ) + ) + putExtra(Intent.EXTRA_SUBJECT, messageSubject) + putExtra(Intent.EXTRA_TEXT, messageBody) + } + internal fun formatMessage( prefix: String? = null, body: String? = null,