Updated StatusSharePopover and navigator.canShare() functionality
• Updated: - StatusSharePopover links and urls - navigator.canShare() functionality in StatusContainer
This commit is contained in:
parent
a8a83a70d6
commit
3dadf3d268
@ -41,7 +41,11 @@ class StatusSharePopover extends ImmutablePureComponent {
|
|||||||
render() {
|
render() {
|
||||||
const { intl, status } = this.props
|
const { intl, status } = this.props
|
||||||
|
|
||||||
const mailToHref = !status ? undefined : `mailto:?subject=Gab&body=${status.get('url')}`
|
if (!status) return <div />
|
||||||
|
|
||||||
|
const encodedStatusUrl = encodeURIComponent(status.get('url'))
|
||||||
|
const mailToHref = `mailto:?subject=Gab&body=${encodedStatusUrl}`
|
||||||
|
const content = status.get('contentHtml')
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<PopoverLayout
|
<PopoverLayout
|
||||||
@ -60,6 +64,7 @@ class StatusSharePopover extends ImmutablePureComponent {
|
|||||||
color='black'
|
color='black'
|
||||||
backgroundColor='secondary'
|
backgroundColor='secondary'
|
||||||
onClick={this.handleCopy}
|
onClick={this.handleCopy}
|
||||||
|
title={intl.formatMessage(messages.copy)}
|
||||||
className={[_s.jcCenter, _s.aiCenter, _s.mr15, _s.px10].join(' ')}
|
className={[_s.jcCenter, _s.aiCenter, _s.mr15, _s.px10].join(' ')}
|
||||||
/>
|
/>
|
||||||
<Button
|
<Button
|
||||||
@ -68,7 +73,8 @@ class StatusSharePopover extends ImmutablePureComponent {
|
|||||||
iconClassName={_s.inheritFill}
|
iconClassName={_s.inheritFill}
|
||||||
color='white'
|
color='white'
|
||||||
backgroundColor='none'
|
backgroundColor='none'
|
||||||
href='sms://?body=Hello'
|
href={`sms:+&body=${encodedStatusUrl}`}
|
||||||
|
title='Share via text message'
|
||||||
className={[_s.jcCenter, _s.aiCenter, _s.mr15, _s.px10, _s.bgSMS].join(' ')}
|
className={[_s.jcCenter, _s.aiCenter, _s.mr15, _s.px10, _s.bgSMS].join(' ')}
|
||||||
/>
|
/>
|
||||||
<Button
|
<Button
|
||||||
@ -77,7 +83,8 @@ class StatusSharePopover extends ImmutablePureComponent {
|
|||||||
iconClassName={_s.inheritFill}
|
iconClassName={_s.inheritFill}
|
||||||
color='white'
|
color='white'
|
||||||
backgroundColor='none'
|
backgroundColor='none'
|
||||||
href='https://www.facebook.com/sharer/sharer.php?u=#url'
|
href={`https://www.facebook.com/sharer/sharer.php?u=${encodedStatusUrl}`}
|
||||||
|
title='Share on Facebook'
|
||||||
className={[_s.jcCenter, _s.aiCenter, _s.mr15, _s.px10, _s.bgFacebook].join(' ')}
|
className={[_s.jcCenter, _s.aiCenter, _s.mr15, _s.px10, _s.bgFacebook].join(' ')}
|
||||||
/>
|
/>
|
||||||
<Button
|
<Button
|
||||||
@ -86,7 +93,8 @@ class StatusSharePopover extends ImmutablePureComponent {
|
|||||||
iconClassName={_s.inheritFill}
|
iconClassName={_s.inheritFill}
|
||||||
color='white'
|
color='white'
|
||||||
backgroundColor='none'
|
backgroundColor='none'
|
||||||
href='https://twitter.com/intent/tweet?url=gab.com'
|
href={`https://twitter.com/intent/tweet?url=${encodedStatusUrl}`}
|
||||||
|
title='Share on Twitter'
|
||||||
className={[_s.jcCenter, _s.aiCenter, _s.mr15, _s.px10, _s.bgTwitter].join(' ')}
|
className={[_s.jcCenter, _s.aiCenter, _s.mr15, _s.px10, _s.bgTwitter].join(' ')}
|
||||||
/>
|
/>
|
||||||
<Button
|
<Button
|
||||||
@ -95,7 +103,8 @@ class StatusSharePopover extends ImmutablePureComponent {
|
|||||||
iconClassName={_s.inheritFill}
|
iconClassName={_s.inheritFill}
|
||||||
color='white'
|
color='white'
|
||||||
backgroundColor='none'
|
backgroundColor='none'
|
||||||
href='https://telegram.me/share/?url=gab.com'
|
href={`https://telegram.me/share/?url=${encodedStatusUrl}`}
|
||||||
|
title='Share on Telegram'
|
||||||
className={[_s.jcCenter, _s.aiCenter, _s.mr15, _s.px10, _s.bgTelegram].join(' ')}
|
className={[_s.jcCenter, _s.aiCenter, _s.mr15, _s.px10, _s.bgTelegram].join(' ')}
|
||||||
/>
|
/>
|
||||||
<Button
|
<Button
|
||||||
@ -104,7 +113,8 @@ class StatusSharePopover extends ImmutablePureComponent {
|
|||||||
iconClassName={_s.inheritFill}
|
iconClassName={_s.inheritFill}
|
||||||
color='white'
|
color='white'
|
||||||
backgroundColor='none'
|
backgroundColor='none'
|
||||||
href='http://www.reddit.com/submit?url=gab.com&title=Post%20to%20Reddit%20via%20URL'
|
href={`http://www.reddit.com/submit?url=${encodedStatusUrl}&title=Gab`}
|
||||||
|
title='Share on Reddit'
|
||||||
className={[_s.jcCenter, _s.aiCenter, _s.px10, _s.mr15, _s.bgReddit].join(' ')}
|
className={[_s.jcCenter, _s.aiCenter, _s.px10, _s.mr15, _s.bgReddit].join(' ')}
|
||||||
/>
|
/>
|
||||||
<Button
|
<Button
|
||||||
@ -113,7 +123,8 @@ class StatusSharePopover extends ImmutablePureComponent {
|
|||||||
iconClassName={_s.inheritFill}
|
iconClassName={_s.inheritFill}
|
||||||
color='white'
|
color='white'
|
||||||
backgroundColor='black'
|
backgroundColor='black'
|
||||||
href='mailto:?body=gab.com'
|
href={mailToHref}
|
||||||
|
title='Share via email'
|
||||||
className={[_s.jcCenter, _s.aiCenter, _s.mr10, _s.px10].join(' ')}
|
className={[_s.jcCenter, _s.aiCenter, _s.mr10, _s.px10].join(' ')}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
@ -303,15 +303,14 @@ const mapDispatchToProps = (dispatch) => ({
|
|||||||
},
|
},
|
||||||
|
|
||||||
onShare (targetRef, status) {
|
onShare (targetRef, status) {
|
||||||
if (!!navigator && navigator.share) {
|
if (!!navigator && navigator.share && navigator.canShare()) {
|
||||||
console.log("CAN SHARE")
|
|
||||||
const url = status.get('url')
|
const url = status.get('url')
|
||||||
navigator.share({
|
navigator.share({
|
||||||
url,
|
url,
|
||||||
title: 'Test title',
|
title: 'Check out this post on Gab',
|
||||||
text: 'Check out gab',
|
text: 'Check out this post on Gab',
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
console.log('Successful share')
|
//
|
||||||
}).catch((error) => {
|
}).catch((error) => {
|
||||||
console.log('Error sharing', error)
|
console.log('Error sharing', error)
|
||||||
})
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user