mirror of
https://github.com/discourse/discourse.git
synced 2025-06-07 22:46:01 +08:00
s/share/nativeShare (#7038)
This commit is contained in:
@ -1,5 +1,5 @@
|
|||||||
import showModal from "discourse/lib/show-modal";
|
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";
|
import { registerTopicFooterButton } from "discourse/lib/register-topic-footer-button";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
@ -13,7 +13,7 @@ export default {
|
|||||||
label: "topic.share.title",
|
label: "topic.share.title",
|
||||||
title: "topic.share.help",
|
title: "topic.share.help",
|
||||||
action() {
|
action() {
|
||||||
share({ url: this.get("topic.shareUrl") }).catch(() =>
|
nativeShare({ url: this.get("topic.shareUrl") }).catch(() =>
|
||||||
showModal("share-and-invite", {
|
showModal("share-and-invite", {
|
||||||
modalClass: "share-and-invite",
|
modalClass: "share-and-invite",
|
||||||
panels: [
|
panels: [
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
export function share(data) {
|
export function nativeShare(data) {
|
||||||
return new Ember.RSVP.Promise((resolve, reject) => {
|
return new Ember.RSVP.Promise((resolve, reject) => {
|
||||||
if (
|
if (
|
||||||
window.location.protocol === "https:" &&
|
window.location.protocol === "https:" &&
|
||||||
|
@ -2,7 +2,7 @@ import PostCooked from "discourse/widgets/post-cooked";
|
|||||||
import DecoratorHelper from "discourse/widgets/decorator-helper";
|
import DecoratorHelper from "discourse/widgets/decorator-helper";
|
||||||
import { createWidget, applyDecorators } from "discourse/widgets/widget";
|
import { createWidget, applyDecorators } from "discourse/widgets/widget";
|
||||||
import { iconNode } from "discourse-common/lib/icon-library";
|
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 { transformBasicPost } from "discourse/lib/transform-post";
|
||||||
import { postTransformCallbacks } from "discourse/widgets/post-stream";
|
import { postTransformCallbacks } from "discourse/widgets/post-stream";
|
||||||
import { h } from "virtual-dom";
|
import { h } from "virtual-dom";
|
||||||
@ -282,7 +282,7 @@ createWidget("post-date", {
|
|||||||
|
|
||||||
// use native webshare when available
|
// use native webshare when available
|
||||||
// navigator.share needs HTTPS, returns undefined on HTTP
|
// navigator.share needs HTTPS, returns undefined on HTTP
|
||||||
share({ url: this.attrs.shareUrl }).catch(modalFallback);
|
nativeShare({ url: this.attrs.shareUrl }).catch(modalFallback);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user