Merge pull request #5915 from jjaffeux/sharing-macos-chrome

FIX: sharing popup not showing on macos/chrome
This commit is contained in:
Rafael dos Santos Silva 2018-06-04 20:38:10 -03:00 committed by GitHub
commit 74c33a5316
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -83,10 +83,7 @@ export default Ember.Component.extend({
_webShare(url) {
// We can pass title and text too, but most share targets do their own oneboxing
navigator.share({
url: url
})
.catch((error) => console.warn('Error sharing', error));
return navigator.share({ url });
},
didInsertElement() {
@ -118,7 +115,13 @@ export default Ember.Component.extend({
// use native webshare only when the user clicks on the "chain" icon
// navigator.share needs HTTPS, returns undefined on HTTP
if (navigator.share && !$currentTarget.hasClass('post-date')) {
this._webShare(url);
this._webShare(url)
.catch(error => {
console.warn('Error sharing', error);
// if navigator fails for unexpected reason fallback to popup
this._showUrl($currentTarget, url);
});
} else {
this._showUrl($currentTarget, url);
}