Set text and URL separately for `navigator.share`
Apparently for most mobile OSses `url` is a required share option
This commit is contained in:
parent
dc8c5fbf82
commit
8b86e2f123
|
@ -3,9 +3,7 @@
|
||||||
require "cgi"
|
require "cgi"
|
||||||
|
|
||||||
class Ajax::AnswerController < AjaxController
|
class Ajax::AnswerController < AjaxController
|
||||||
include SocialHelper::TwitterMethods
|
include SocialHelper
|
||||||
include SocialHelper::TumblrMethods
|
|
||||||
include SocialHelper::TelegramMethods
|
|
||||||
|
|
||||||
def create
|
def create
|
||||||
params.require :id
|
params.require :id
|
||||||
|
@ -73,6 +71,8 @@ class Ajax::AnswerController < AjaxController
|
||||||
private
|
private
|
||||||
|
|
||||||
def sharing_hash(answer) = {
|
def sharing_hash(answer) = {
|
||||||
|
url: answer_share_url(answer),
|
||||||
|
text: prepare_tweet(answer, nil, true),
|
||||||
twitter: twitter_share_url(answer),
|
twitter: twitter_share_url(answer),
|
||||||
tumblr: tumblr_share_url(answer),
|
tumblr: tumblr_share_url(answer),
|
||||||
telegram: telegram_share_url(answer),
|
telegram: telegram_share_url(answer),
|
||||||
|
|
|
@ -32,7 +32,8 @@ export function answerEntryHandler(event: Event): void {
|
||||||
|
|
||||||
const shareButton = inboxEntry.querySelector<HTMLButtonElement>('[data-controller="share"]');
|
const shareButton = inboxEntry.querySelector<HTMLButtonElement>('[data-controller="share"]');
|
||||||
if (shareButton != null) {
|
if (shareButton != null) {
|
||||||
shareButton.dataset.shareTextValue = decodeURIComponent(data.sharing.custom).replaceAll('+', ' ');
|
shareButton.dataset.shareUrlValue = data.sharing.url;
|
||||||
|
shareButton.dataset.shareTextValue = data.sharing.text;
|
||||||
}
|
}
|
||||||
|
|
||||||
const sharing = inboxEntry.querySelector<HTMLElement>('.inbox-entry__sharing');
|
const sharing = inboxEntry.querySelector<HTMLElement>('.inbox-entry__sharing');
|
||||||
|
|
Loading…
Reference in New Issue