From fea8de4bd215aa1933b695a93b1fa8d01e9f0bda Mon Sep 17 00:00:00 2001 From: Allan Wang Date: Sat, 6 Jan 2018 18:05:25 -0500 Subject: Add breakpoint to email builder --- core/src/main/kotlin/ca/allanwang/kau/email/EmailBuilder.kt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'core/src/main') diff --git a/core/src/main/kotlin/ca/allanwang/kau/email/EmailBuilder.kt b/core/src/main/kotlin/ca/allanwang/kau/email/EmailBuilder.kt index 6576657..ea552b8 100644 --- a/core/src/main/kotlin/ca/allanwang/kau/email/EmailBuilder.kt +++ b/core/src/main/kotlin/ca/allanwang/kau/email/EmailBuilder.kt @@ -33,7 +33,7 @@ class EmailBuilder(val email: String, val subject: String) { data class Package(val packageName: String, val appName: String) - fun execute(context: Context) { + fun getIntent(context: Context): Intent { val intent = Intent(Intent.ACTION_VIEW, Uri.parse("mailto:$email")) intent.putExtra(Intent.EXTRA_SUBJECT, subject) val emailBuilder = StringBuilder() @@ -77,6 +77,11 @@ class EmailBuilder(val email: String, val subject: String) { emailBuilder.append("\n").append(footer) intent.putExtra(Intent.EXTRA_TEXT, emailBuilder.toString()) + return intent + } + + fun execute(context: Context) { + val intent = getIntent(context) if (intent.resolveActivity(context.packageManager) != null) context.startActivity(Intent.createChooser(intent, context.resources.getString(R.string.kau_send_via))) else -- cgit v1.2.3