aboutsummaryrefslogtreecommitdiffstats
path: root/packages/meshbay-android
diff options
context:
space:
mode:
Diffstat (limited to 'packages/meshbay-android')
-rw-r--r--packages/meshbay-android/app/src/main/kotlin/org/meshbay/client/MainActivity.kt8
1 files changed, 8 insertions, 0 deletions
diff --git a/packages/meshbay-android/app/src/main/kotlin/org/meshbay/client/MainActivity.kt b/packages/meshbay-android/app/src/main/kotlin/org/meshbay/client/MainActivity.kt
index 6bd2a3f..d523da7 100644
--- a/packages/meshbay-android/app/src/main/kotlin/org/meshbay/client/MainActivity.kt
+++ b/packages/meshbay-android/app/src/main/kotlin/org/meshbay/client/MainActivity.kt
@@ -210,6 +210,9 @@ class MainActivity : Activity() {
// The hub must never become the document origin. A link out
// opens in the person's browser, not in a window holding keys.
if (request.isForMainFrame && (url.scheme == "https" || url.scheme == "http")) openExternally(url)
+ // The recovery screen's "e-mail it to myself" (docs/MESHBAY_DESIGN.md
+ // §3.6): the person's own mail application sends it, never the hub.
+ if (request.isForMainFrame && url.scheme == "mailto") openMail(url)
return true
}
}
@@ -391,6 +394,11 @@ class MainActivity : Activity() {
private fun refused() = WebResourceResponse("text/plain", "utf-8", 403, "Forbidden", emptyMap(), "".byteInputStream())
+ private fun openMail(url: Uri) {
+ try { startActivity(Intent(Intent.ACTION_SENDTO, url)) }
+ catch (e: android.content.ActivityNotFoundException) { Log.w(Bridge.TAG, "no mail application") }
+ }
+
private fun openExternally(url: Uri) {
try { startActivity(Intent(Intent.ACTION_VIEW, url).addCategory(Intent.CATEGORY_BROWSABLE)) }
catch (e: android.content.ActivityNotFoundException) { Log.w(Bridge.TAG, "no browser for $url") }