diff --git a/android/app/src/main/java/org/mozilla/sendandroid/MainActivity.kt b/android/app/src/main/java/org/mozilla/sendandroid/MainActivity.kt
index e0a5730e..2d953c00 100644
--- a/android/app/src/main/java/org/mozilla/sendandroid/MainActivity.kt
+++ b/android/app/src/main/java/org/mozilla/sendandroid/MainActivity.kt
@@ -35,6 +35,11 @@ class WebAppInterface(private val mContext: MainActivity) {
fun beginOAuthFlow() {
mContext.beginOAuthFlow();
}
+
+ @JavascriptInterface
+ fun shareUrl(url: String) {
+ mContext.shareUrl(url)
+ }
}
class MainActivity : AppCompatActivity(), AdvancedWebView.Listener {
@@ -94,6 +99,14 @@ class MainActivity : AppCompatActivity(), AdvancedWebView.Listener {
})
}
+ fun shareUrl(url: String) {
+ val shareIntent = Intent()
+ shareIntent.action = Intent.ACTION_SEND
+ shareIntent.type = "text/plain"
+ shareIntent.putExtra(Intent.EXTRA_TEXT, url);
+ startActivity(Intent.createChooser(shareIntent, ""))
+ }
+
@SuppressLint("NewApi")
override fun onResume() {
super.onResume()
diff --git a/app/ui/archiveTile.js b/app/ui/archiveTile.js
index 04a161ed..da1131cd 100644
--- a/app/ui/archiveTile.js
+++ b/app/ui/archiveTile.js
@@ -1,7 +1,16 @@
+/* global Android */
+
const html = require('choo/html');
const raw = require('choo/html/raw');
const assets = require('../../common/assets');
-const { bytes, copyToClipboard, list, percent, timeLeft } = require('../utils');
+const {
+ browserName,
+ bytes,
+ copyToClipboard,
+ list,
+ percent,
+ timeLeft
+} = require('../utils');
const expiryOptions = require('./expiryOptions');
function expiryInfo(translate, archive) {
@@ -140,6 +149,26 @@ function archiveDetails(translate, archive) {
}
module.exports = function(state, emit, archive) {
+ const copyOrShare =
+ browserName() !== 'android-app'
+ ? html`
+
+ `
+ : html`
+
+ `;
return html`
${archiveDetails(state.translate, archive)}
-
+ ${copyOrShare}
`;
function copy(event) {
@@ -185,6 +209,11 @@ module.exports = function(state, emit, archive) {
event.stopPropagation();
emit('delete', { file: archive, location: 'success-screen' });
}
+
+ function share(event) {
+ event.stopPropagation();
+ Android.shareUrl(archive.url);
+ }
};
module.exports.wip = function(state, emit) {
diff --git a/assets/share-16.svg b/assets/share-16.svg
new file mode 100644
index 00000000..507f199f
--- /dev/null
+++ b/assets/share-16.svg
@@ -0,0 +1 @@
+
\ No newline at end of file