aboutsummaryrefslogtreecommitdiff
path: root/core/src/main/kotlin/ca/allanwang/kau/email
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2017-09-23 15:14:12 -0400
committerGitHub <noreply@github.com>2017-09-23 15:14:12 -0400
commita647df3c32b77eff3e6ba8a78799dc7eb42ba11c (patch)
treee15593d81626e0ab4e3443c0d2bdd3b21162c083 /core/src/main/kotlin/ca/allanwang/kau/email
parentf3e7098e52f8caa86be7922f5b07eade6f36cc57 (diff)
downloadkau-a647df3c32b77eff3e6ba8a78799dc7eb42ba11c.tar.gz
kau-a647df3c32b77eff3e6ba8a78799dc7eb42ba11c.tar.bz2
kau-a647df3c32b77eff3e6ba8a78799dc7eb42ba11c.zip
v3.4.1 (#63)
* Check browser intent before launching (#54) * Update changelog * fix/misc (#55) * Add kapt plugin * Fix kau vector * Debug lintRelease * Revert debug * Update dependencies * Check context finishing state before showing dialog (#61) * Keep copy of shared pref rather than application context (#60) * Keep copy of shared pref rather than application context * Add back preference name * Add resolver checks (#62)
Diffstat (limited to 'core/src/main/kotlin/ca/allanwang/kau/email')
-rw-r--r--core/src/main/kotlin/ca/allanwang/kau/email/EmailBuilder.kt6
1 files changed, 5 insertions, 1 deletions
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 88a0945..8c6acff 100644
--- a/core/src/main/kotlin/ca/allanwang/kau/email/EmailBuilder.kt
+++ b/core/src/main/kotlin/ca/allanwang/kau/email/EmailBuilder.kt
@@ -13,6 +13,7 @@ import ca.allanwang.kau.logging.KL
import ca.allanwang.kau.utils.installerPackageName
import ca.allanwang.kau.utils.isAppInstalled
import ca.allanwang.kau.utils.string
+import ca.allanwang.kau.utils.toast
/**
@@ -76,7 +77,10 @@ class EmailBuilder(val email: String, val subject: String) {
emailBuilder.append("\n").append(footer)
intent.putExtra(Intent.EXTRA_TEXT, emailBuilder.toString())
- context.startActivity(Intent.createChooser(intent, context.resources.getString(R.string.kau_send_via)))
+ if (intent.resolveActivity(context.packageManager) != null)
+ context.startActivity(Intent.createChooser(intent, context.resources.getString(R.string.kau_send_via)))
+ else
+ context.toast("Cannot resolve email activity", log = true)
}
}