Merge pull request #446 from esteemapp/feature/share

Feature/share
This commit is contained in:
uğur erdal 2019-01-19 22:15:56 +03:00 committed by GitHub
commit 746a0d5e54
6 changed files with 43 additions and 6 deletions

View File

@ -1,7 +1,7 @@
import React, { PureComponent, Fragment } from 'react';
import { connect } from 'react-redux';
import { withNavigation } from 'react-navigation';
import { Alert } from 'react-native';
import { Alert, Share } from 'react-native';
import ActionSheet from 'react-native-actionsheet';
import { injectIntl } from 'react-intl';
@ -16,6 +16,7 @@ import { default as ROUTES } from '../../../constants/routeNames';
// Utilities
import { writeToClipboard } from '../../../utils/clipboard';
import { getPostUrl } from '../../../utils/post';
// Component
import PostDropdownView from '../view/postDropdownView';
@ -40,7 +41,7 @@ class PostDropdownContainer extends PureComponent {
switch (index) {
case '0':
writeToClipboard(`https://steemit.com${content.url}`);
writeToClipboard(getPostUrl(content.url));
break;
case '1':
@ -52,12 +53,26 @@ class PostDropdownContainer extends PureComponent {
case '2':
this._replyNavigation();
break;
case '3':
setTimeout(() => {
this._share();
}, 500);
break;
default:
break;
}
};
_share = () => {
const { content } = this.props;
Share.share({
message: content.title,
url: getPostUrl(content.url),
});
};
_reblog = () => {
const {
currentAccount, content, isLoggedIn, pinCode, intl,
@ -115,7 +130,7 @@ class PostDropdownContainer extends PureComponent {
return (
<Fragment>
<PostDropdownView
options={OPTIONS}
options={OPTIONS.map(item => intl.formatMessage({ id: `post_dropdown.${item}` }).toUpperCase())}
handleOnDropdownSelect={this._handleOnDropdownSelect}
{...this.props}
/>

View File

@ -179,5 +179,11 @@
"author_payout": "Author Payout",
"curation_payout": "Curation Payout",
"payout_date": "Payout"
},
"post_dropdown": {
"copy": "copy link",
"reblog": "reblog",
"reply": "reply",
"share": "share"
}
}

View File

@ -179,5 +179,11 @@
"author_payout": "Автору",
"curation_payout": "Кураторам",
"payout_date": "Выплата"
},
"post_dropdown": {
"copy": "copy link",
"reblog": "reblog",
"reply": "reply",
"share": "share"
}
}

View File

@ -179,5 +179,11 @@
"author_payout": "Yazar Ödemeleri",
"curation_payout": "Küratör Ödemeleri",
"payout_date": "Ödeme"
},
"post_dropdown": {
"copy": "kopyala",
"reblog": "reblog",
"reply": "cevapla",
"share": "paylaş"
}
}

View File

@ -1,3 +1 @@
export default ['COPY LINK', 'REBLOG', 'REPLY'];
export const VALUE = ['copy', 'reblog', 'reply'];
export default ['copy', 'reblog', 'reply', 'share'];

View File

@ -12,3 +12,9 @@ export const postSumTotal = (content) => {
? parseToken(content.total_payout_value) + parseToken(content.curator_payout_value)
: 0;
};
export const getPostUrl = (url) => {
const BASE_URL = 'https://steemit.com';
return BASE_URL + url;
};