s/share/nativeShare (#7038)

This commit is contained in:
Joffrey JAFFEUX
2019-02-20 20:03:30 +01:00
committed by GitHub
parent 994a09e5e8
commit 9618300d69
3 changed files with 5 additions and 5 deletions

View File

@ -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: [

View File

@ -1,4 +1,4 @@
export function share(data) {
export function nativeShare(data) {
return new Ember.RSVP.Promise((resolve, reject) => {
if (
window.location.protocol === "https:" &&

View File

@ -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);
}
});