FEATURE: disable native share API on non tablets/phones

FEATURE: disable native share API on non tablets/phones

Native share API works fantastically on phones/tablets but on full desktop it is confusing.

diff --git a/app/assets/javascripts/discourse/lib/pwa-utils.js.es6 b/app/assets/javascripts/discourse/lib/pwa-utils.js.es6
index 0cbc621..c1833da 100644
--- a/app/assets/javascripts/discourse/lib/pwa-utils.js.es6
+++ b/app/assets/javascripts/discourse/lib/pwa-utils.js.es6
@@ -1,5 +1,10 @@
 export function nativeShare(data) {
+  const caps = Discourse.__container__.lookup("capabilities:main");
   return new Ember.RSVP.Promise((resolve, reject) => {
+    if (!(caps.isIOS || caps.isAndroid || caps.isWinphone)) {
+      reject();
+      return;
+    }
     if (
       window.location.protocol === "https:" &&
       typeof window.navigator.share !== "undefined"

GitHub sha: 157dc5e2

1 Like