merged with master

This commit is contained in:
u-e 2019-01-30 11:57:44 +03:00
commit 4dcaa6b1c4
3 changed files with 34 additions and 16 deletions

View File

@ -58,9 +58,11 @@ class PostDropdownContainer extends PureComponent {
case '0':
await writeToClipboard(getPostUrl(content.url));
this.alertTimer = setTimeout(() => {
Alert.alert(intl.formatMessage({
id: 'alert.copied',
}));
Alert.alert(
intl.formatMessage({
id: 'alert.copied',
}),
);
this.alertTimer = 0;
}, 300);
break;
@ -104,12 +106,12 @@ class PostDropdownContainer extends PureComponent {
const { currentAccount, content, intl } = this.props;
addBookmark(currentAccount.name, content.author, content.permlink)
.then(() => {
Alert.alert(intl.formatMessage({ id: 'bookmarks.added' }));
Alert.alert(intl.formatMessage({ id: 'bookmarks.added' }));
})
.catch(() => {
Alert.alert(intl.formatMessage({ id: 'alert.fail' }));
});
}
};
_reblog = () => {
const {
@ -163,12 +165,17 @@ class PostDropdownContainer extends PureComponent {
};
render() {
const { intl } = this.props;
const { intl, currentAccount, content } = this.props;
let _OPTIONS = OPTIONS;
if (content.author === currentAccount.name) {
_OPTIONS = OPTIONS.filter(item => item !== 'reblog');
}
return (
<Fragment>
<PostDropdownView
options={OPTIONS.map(item => intl.formatMessage({ id: `post_dropdown.${item}` }).toUpperCase())}
options={_OPTIONS.map(item => intl.formatMessage({ id: `post_dropdown.${item}` }).toUpperCase())}
handleOnDropdownSelect={this._handleOnDropdownSelect}
{...this.props}
/>

View File

@ -54,6 +54,7 @@ class TransactionView extends PureComponent {
{transactions
&& transactions.map((item, index) => {
const transactionData = groomingTransactionData(item, steemPerMVests, formatNumber);
const value = transactionData.value.split(' ');
return (
<CollapsibleCard
@ -75,9 +76,9 @@ class TransactionView extends PureComponent {
isBlackText
iconName={transactionData.icon}
iconType="MaterialIcons"
rightText={transactionData.value}
rightText={`${Math.round(value[0] * 1000) / 1000} ${value[1]}`}
/>
)}
)}
>
{(!!transactionData.details || !!transactionData.memo) && (
<WalletLineItem

View File

@ -6,6 +6,7 @@ const md = new Remarkable({ html: true, breaks: true, linkify: true });
// const onlyImageLinkRegex = /([\n]http(s?):)([/|.|\w|\s|-])*\.(?:jpg|gif|png|PNG|GIF|JPG)/g;
// const onlyImageDoubleLinkRegex = /(\nhttps)(.*)(?=jpg|gif|png|PNG|GIF|JPG|)/g;
// const pullRightLeftRegex = /(<div class="[^"]*?pull-[^"]*?">(.*?)(<[/]div>))/g;
// const markdownLinkRegex = /(?:__|[])|\[(.*?)\]\(.*?\)/g;
const copiedPostRegex = /\/(.*)\/(@[\w.\d-]+)\/(.*)/i;
const postRegex = /^https?:\/\/(.*)\/(.*)\/(@[\w.\d-]+)\/(.*)/i;
const youTubeRegex = /(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/watch\?v=|youtu\.be\/)([^& \n<]+)(?:[^ \n<]+)?/g;
@ -15,13 +16,12 @@ const authorNameRegex = /(^|[^a-zA-Z0-9_!#$%&*@\/]|(^|[^a-zA-Z0-9_+~.-\/]))[@
const tagsRegex = /(^|\s|>)(#[-a-z\d]+)/gi;
const centerRegex = /(<center>)/g;
const imgRegex = /(https?:\/\/.*\.(?:tiff?|jpe?g|gif|png|svg|ico|PNG|GIF|JPG))/g;
const linkRegex = /[-a-zA-Z0-9@:%_\+.~#?&//=]{2,256}\.[a-z]{2,4}\b(\/[-a-zA-Z0-9@:%_\+.~#?&//=]*)?/gi;
const linkRegex = /[-a-zA-Z0-9@:%+.~#?&//=]{2,256}\.[a-z]{2,4}\b(\/[-a-zA-Z0-9@:%+.~#?&//=]*)?/gi;
const markdownImageRegex = /!\[[^\]]*\]\((.*?)\s*("(?:.*[^"])")?\s*\)/g;
const urlRegex = /(http|ftp|https):\/\/([\w_-]+(?:(?:\.[\w_-]+)+))([\w.,@?^=%&:/~+#-]*[\w@?^=%&/~+#-])?/gm;
const aTagRegex = /(<\s*a[^>]*>(.*?)<\s*[/]\s*a>)/g;
const imgTagRegex = /(<img[^>]*>)/g;
const iframeRegex = /(?:<iframe[^>]*)(?:(?:\/>)|(?:>.*?<\/iframe>))/g;
//const markdownLinkRegex = /(?:__|[])|\[(.*?)\]\(.*?\)/g;
export const markDown2Html = (input) => {
if (!input) {
@ -77,7 +77,7 @@ export const markDown2Html = (input) => {
output = handleATag(output);
}
// if (markdownLinkRegex.test(output)) {
// if (copiedPostRegex.test(output)) {
// output = handleMarkdownLink(output);
// }
@ -126,7 +126,7 @@ const handleATag = input => input.replace(aTagRegex, (link) => {
return link;
});
const handleMarkdownLink = input => input.replace(markdownLinkRegex, (link) => {
const handleMarkdownLink = input => input.replace(copiedPostRegex, (link) => {
const postMatch = link.match(copiedPostRegex);
if (postMatch) {
@ -156,11 +156,21 @@ const handleLinks = input => input.replace(linkRegex, (link) => {
) {
const imageMatch = link.match(imgRegex);
if (imageMatch[0].indexOf('.gif') > 0) return gifBody(imageMatch[0]);
if (imageMatch) {
if (imageMatch[0].indexOf('.gif') > 0) {
return gifBody(imageMatch[0]);
}
if (imageMatch && imageMatch[0]) {
return imageBody(imageMatch[0]);
if (imageMatch[0]) {
return imageBody(imageMatch[0]);
}
} else if (link.trim().indexOf('ipfs.busy.org') > 0) {
return imageBody(link);
}
return link;
} if (link.trim().indexOf('ipfs.busy.org') > 0) {
return imageBody(link);
}
}