FIX: improves share/invite behavior on mobile and especially iOS (#7416)
This commit is contained in:
parent
dc60128355
commit
d4e788c136
|
@ -1,5 +1,4 @@
|
||||||
import showModal from "discourse/lib/show-modal";
|
import showModal from "discourse/lib/show-modal";
|
||||||
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 +12,6 @@ export default {
|
||||||
label: "topic.share.title",
|
label: "topic.share.title",
|
||||||
title: "topic.share.help",
|
title: "topic.share.help",
|
||||||
action() {
|
action() {
|
||||||
const modal = () => {
|
|
||||||
const panels = [
|
const panels = [
|
||||||
{
|
{
|
||||||
id: "share",
|
id: "share",
|
||||||
|
@ -48,9 +46,6 @@ export default {
|
||||||
modalClass: "share-and-invite",
|
modalClass: "share-and-invite",
|
||||||
panels
|
panels
|
||||||
});
|
});
|
||||||
};
|
|
||||||
|
|
||||||
nativeShare({ url: this.get("topic.shareUrl") }).then(null, modal);
|
|
||||||
},
|
},
|
||||||
dropdown() {
|
dropdown() {
|
||||||
return this.site.mobileView;
|
return this.site.mobileView;
|
||||||
|
|
|
@ -8,7 +8,7 @@ export function nativeShare(data) {
|
||||||
.share(data)
|
.share(data)
|
||||||
.then(resolve)
|
.then(resolve)
|
||||||
.catch(e => {
|
.catch(e => {
|
||||||
if (e.message === "Share canceled") {
|
if (e.name === "AbortError") {
|
||||||
// closing share panel do nothing
|
// closing share panel do nothing
|
||||||
} else {
|
} else {
|
||||||
reject();
|
reject();
|
||||||
|
|
Loading…
Reference in New Issue