A platform for community discussion. Free, open, simple.
s/share/nativeShare (#7038)
Joffrey JAFFEUX9618300d690c
diff --git a/app/assets/javascripts/discourse/initializers/topic-footer-buttons.js.es6 b/app/assets/javascripts/discourse/initializers/topic-footer-buttons.js.es6index 812ac3f7d4c..b538e0453e1 100644--- a/app/assets/javascripts/discourse/initializers/topic-footer-buttons.js.es6+++ b/app/assets/javascripts/discourse/initializers/topic-footer-buttons.js.es6@@ -1,5 +1,5 @@import showModal from "discourse/lib/show-modal";-import { share } from "discourse/lib/pwa-utils";+import { nativeShare } from "discourse/lib/pwa-utils";import { registerTopicFooterButton } from "discourse/lib/register-topic-footer-button";export default {@@ -13,7 +13,7 @@ export default {label: "topic.share.title",title: "topic.share.help",action() {- share({ url: this.get("topic.shareUrl") }).catch(() =>+ nativeShare({ url: this.get("topic.shareUrl") }).catch(() =>showModal("share-and-invite", {modalClass: "share-and-invite",panels: [diff --git a/app/assets/javascripts/discourse/lib/pwa-utils.js.es6 b/app/assets/javascripts/discourse/lib/pwa-utils.js.es6index ff53576c00b..5fdbe63f281 100644--- a/app/assets/javascripts/discourse/lib/pwa-utils.js.es6+++ b/app/assets/javascripts/discourse/lib/pwa-utils.js.es6@@ -1,4 +1,4 @@-export function share(data) {+export function nativeShare(data) {return new Ember.RSVP.Promise((resolve, reject) => {if (window.location.protocol === "https:" &&diff --git a/app/assets/javascripts/discourse/widgets/post.js.es6 b/app/assets/javascripts/discourse/widgets/post.js.es6index b076c125e07..7710e75fede 100644--- a/app/assets/javascripts/discourse/widgets/post.js.es6+++ b/app/assets/javascripts/discourse/widgets/post.js.es6@@ -2,7 +2,7 @@ import PostCooked from "discourse/widgets/post-cooked";import DecoratorHelper from "discourse/widgets/decorator-helper";import { createWidget, applyDecorators } from "discourse/widgets/widget";import { iconNode } from "discourse-common/lib/icon-library";-import { share } from "discourse/lib/pwa-utils";+import { nativeShare } from "discourse/lib/pwa-utils";import { transformBasicPost } from "discourse/lib/transform-post";import { postTransformCallbacks } from "discourse/widgets/post-stream";import { h } from "virtual-dom";@@ -282,7 +282,7 @@ createWidget("post-date", {// use native webshare when available// navigator.share needs HTTPS, returns undefined on HTTP- share({ url: this.attrs.shareUrl }).catch(modalFallback);+ nativeShare({ url: this.attrs.shareUrl }).catch(modalFallback);}});