FEATURE: disable native share API on non tablets/phones

Native share API works fantastically on phones/tablets but on full desktop
it is confusing.
This commit is contained in:
Sam Saffron 2019-05-02 13:18:29 +10:00
parent a2babcafd8
commit 157dc5e298
1 changed files with 5 additions and 0 deletions

View File

@ -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"