diff --git a/app/capabilities.js b/app/capabilities.js
index 33b9daf8..781518c2 100644
--- a/app/capabilities.js
+++ b/app/capabilities.js
@@ -1,4 +1,4 @@
-/* global AUTH_CONFIG */
+/* global AUTH_CONFIG LOCALE */
import { browserName } from './utils';
async function checkCrypto() {
@@ -90,7 +90,8 @@ export default async function getCapabilities() {
} catch (e) {
account = false;
}
- const share = !!navigator.share;
+ const share =
+ typeof navigator.share === 'function' && LOCALE.startsWith('en'); // en until strings merge
return {
account,
diff --git a/app/ui/archiveTile.js b/app/ui/archiveTile.js
index 9428b142..fea82de7 100644
--- a/app/ui/archiveTile.js
+++ b/app/ui/archiveTile.js
@@ -167,8 +167,17 @@ function archiveDetails(translate, archive) {
module.exports = function(state, emit, archive) {
const copyOrShare =
- platform() !== 'android'
+ state.capabilities.share || platform() === 'android'
? html`
+
+ `
+ : html`
${state.translate('copyLinkButton')}
- `
- : html`
-
`;
const dl =
platform() === 'web'
@@ -248,9 +248,24 @@ module.exports = function(state, emit, archive) {
emit('delete', archive);
}
- function share(event) {
+ async function share(event) {
event.stopPropagation();
- Android.shareUrl(archive.url);
+ if (state.capabilities.share) {
+ try {
+ await navigator.share({
+ title: state.translate('-send-brand'),
+ text: `Download "${
+ archive.name
+ }" with Firefox Send: simple, safe file sharing`,
+ //state.translate('shareMessage', { name }),
+ url: archive.url
+ });
+ } catch (e) {
+ // ignore
+ }
+ } else {
+ Android.shareUrl(archive.url);
+ }
}
};
diff --git a/app/ui/shareDialog.js b/app/ui/shareDialog.js
index 6cd3acfb..ebe42af6 100644
--- a/app/ui/shareDialog.js
+++ b/app/ui/shareDialog.js
@@ -3,7 +3,7 @@ const html = require('choo/html');
/* Possible strings for l10n
shareLinkDescription = Share the link to your file:
shareLinkButton = Share link
-shareMessage = Download { $name } with { -send-brand }: simple, safe file sharing
+shareMessage = Download "{ $name }" with { -send-brand }: simple, safe file sharing
*/
module.exports = function(name, url) {
@@ -48,14 +48,17 @@ module.exports = function(name, url) {
try {
await navigator.share({
title: state.translate('-send-brand'),
- text: `Download ${name} with Firefox Send: simple, safe file sharing`,
+ text: `Download "${name}" with Firefox Send: simple, safe file sharing`,
//state.translate('shareMessage', { name }),
url
});
} catch (e) {
+ if (e.code === e.ABORT_ERR) {
+ return;
+ }
console.error(e);
}
- setTimeout(close, 1000);
+ close();
}
};
};
diff --git a/assets/share-24.svg b/assets/share-24.svg
index 484dad12..6a5580f8 100644
--- a/assets/share-24.svg
+++ b/assets/share-24.svg
@@ -1,4 +1,4 @@
-
\ No newline at end of file
+
\ No newline at end of file