mirror of
https://github.com/discourse/discourse.git
synced 2025-06-06 23:07:28 +08:00
s/share/nativeShare (#7038)
This commit is contained in:
@ -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: [
|
||||
|
@ -1,4 +1,4 @@
|
||||
export function share(data) {
|
||||
export function nativeShare(data) {
|
||||
return new Ember.RSVP.Promise((resolve, reject) => {
|
||||
if (
|
||||
window.location.protocol === "https:" &&
|
||||
|
@ -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);
|
||||
}
|
||||
});
|
||||
|
||||
|
Reference in New Issue
Block a user