Merge pull request #1404 from esteemapp/bugfix/various

WIP: Bugfix/various
This commit is contained in:
Feruz M 2019-12-16 20:31:39 +02:00 committed by GitHub
commit 766943e062
23 changed files with 110 additions and 45 deletions

View File

@ -296,8 +296,6 @@ PODS:
- RSKImageCropper
- RNReanimated (1.3.0):
- React
- RNScreens (2.0.0-alpha.18):
- React
- RNSVG (9.11.1):
- React
- RNVectorIcons (6.6.0):
@ -357,7 +355,6 @@ DEPENDENCIES:
- RNIap (from `../node_modules/react-native-iap`)
- RNImageCropPicker (from `../node_modules/react-native-image-crop-picker`)
- RNReanimated (from `../node_modules/react-native-reanimated`)
- RNScreens (from `../node_modules/react-native-screens`)
- RNSVG (from `../node_modules/react-native-svg`)
- RNVectorIcons (from `../node_modules/react-native-vector-icons`)
- Yoga (from `../node_modules/react-native/ReactCommon/yoga`)
@ -461,8 +458,6 @@ EXTERNAL SOURCES:
:path: "../node_modules/react-native-image-crop-picker"
RNReanimated:
:path: "../node_modules/react-native-reanimated"
RNScreens:
:path: "../node_modules/react-native-screens"
RNSVG:
:path: "../node_modules/react-native-svg"
RNVectorIcons:
@ -520,7 +515,6 @@ SPEC CHECKSUMS:
RNIap: b4c77c8bc4501203f4b743126a05da23f10f40b4
RNImageCropPicker: bfb3ea9c8622f290532e2fe63f369e0d5a52f597
RNReanimated: 6abbbae2e5e72609d85aabd92a982a94566885f1
RNScreens: 5a7b407132e42765bb136932d2a84bdb90c3ef33
RNSVG: be27aa7c58819f97399388ae53d7fa0572f32c7f
RNVectorIcons: 0bb4def82230be1333ddaeee9fcba45f0b288ed4
RSKImageCropper: a446db0e8444a036b34f3c43db01b2373baa4b2a

View File

@ -24,10 +24,9 @@
"dependencies": {
"@babel/runtime": "^7.5.5",
"@esteemapp/esteem-render-helpers": "^1.2.2",
"@ptomasroos/react-native-multi-slider": "^1.0.0",
"@react-native-community/cameraroll": "^1.3.0",
"@esteemapp/react-native-autocomplete-input": "^4.2.1",
"@esteemapp/react-native-multi-slider": "^1.1.0",
"@react-native-community/cameraroll": "^1.3.0",
"@react-native-community/netinfo": "^4.1.3",
"appcenter": "^2.6.0",
"appcenter-analytics": "^2.6.0",

View File

@ -10,7 +10,7 @@ export default EStyleSheet.create({
borderColor: '$primaryLightBackground',
marginRight: 0,
marginLeft: 0,
marginTop: 10,
marginTop: 0,
},
textWrapper: {
flexDirection: 'row',

View File

@ -57,7 +57,7 @@ const CommentView = ({
date={getTimeFromNow(comment.created)}
name={comment.author}
reputation={comment.author_reputation}
size={avatarSize || 24}
size={avatarSize || 36}
currentAccountUsername={currentAccountUsername}
isShowOwnerIndicator={mainAuthor === comment.author}
isHideImage={isHideImage}
@ -156,7 +156,7 @@ const CommentView = ({
commentNumber={commentNumber + 1}
marginLeft={20}
isShowSubComments={true}
avatarSize={avatarSize || 16}
avatarSize={avatarSize || 24}
author={comment.author}
permlink={comment.permlink}
commentCount={comment.children}

View File

@ -158,7 +158,7 @@ class NotificationView extends PureComponent {
);
render() {
const { readAllNotification, getActivities, isNotificationRefreshing } = this.props;
const { readAllNotification, getActivities, isNotificationRefreshing, intl } = this.props;
const { filters, selectedFilter, selectedIndex } = this.state;
const _notifications = this._getNotificationsArrays();
@ -166,7 +166,9 @@ class NotificationView extends PureComponent {
<View style={styles.container}>
<FilterBar
dropdownIconName="arrow-drop-down"
options={filters.map(item => item.value)}
options={filters.map(item =>
intl.formatMessage({ id: `notification.${item.key}` }).toUpperCase(),
)}
defaultText="ALL"
onDropdownSelect={this._handleOnDropdownSelect}
rightIconName="playlist-add-check"

View File

@ -41,6 +41,10 @@ export default EStyleSheet.create({
title: {
color: '$primaryDarkGray',
},
moreinfo: {
color: '$primaryBlack',
flex: 1,
},
description: {
color: '$primaryBlack',
fontSize: 12,

View File

@ -15,7 +15,7 @@ const NotificationLineView = ({ notification, handleOnPressNotification }) => {
const intl = useIntl();
let _title;
let titleExtra = '';
let _moreinfo = '';
useEffect(() => {
setIsRead(notification.read);
}, [notification]);
@ -33,7 +33,6 @@ const NotificationLineView = ({ notification, handleOnPressNotification }) => {
titleExtra = notification.amount;
} else if (notification.weight) {
const _percent = `${parseFloat((notification.weight / 100).toFixed(2))}% `;
titleExtra = _percent;
}
@ -41,6 +40,18 @@ const NotificationLineView = ({ notification, handleOnPressNotification }) => {
id: `notification.${notification.type}`,
})}`;
if (
notification.type === 'vote' ||
notification.type === 'reblog' ||
(notification.type === 'mention' && notification.post)
) {
_moreinfo = notification.title || notification.permlink;
}
if (notification.type === 'reply' || (notification.type === 'mention' && !notification.post)) {
_moreinfo = notification.parent_title || notification.parent_permlink || notification.permlink;
}
return (
<TouchableHighlight onPress={_handleOnNotificationPress}>
<View
@ -54,7 +65,10 @@ const NotificationLineView = ({ notification, handleOnPressNotification }) => {
<View style={styles.body}>
<View style={styles.titleWrapper}>
<Text style={styles.name}>{notification.source} </Text>
<Text style={styles.title}>{_title}</Text>
<Text style={styles.title}>{_title} </Text>
<Text style={styles.moreinfo} numberOfLines={1} ellipsizeMode={4}>
{_moreinfo}
</Text>
</View>
{notification.description && (
<Text numberOfLines={1} style={styles.description}>

View File

@ -102,7 +102,7 @@ class PostCardView extends Component {
name={get(content, 'author')}
profileOnPress={this._handleOnUserPress}
reputation={get(content, 'author_reputation')}
size={32}
size={36}
tag={content.category}
rebloggedBy={rebloggedBy}
isPromoted={get(content, 'is_promoted')}

View File

@ -34,7 +34,12 @@ const PostBody = ({
}
try {
const data = JSON.parse(get(event, 'nativeEvent.data'));
let data = {};
try {
data = JSON.parse(get(event, 'nativeEvent.data'));
} catch (error) {
data = {};
}
const { type, href, author, category, permlink, tag, proposal, videoHref } = data;

View File

@ -57,7 +57,7 @@ class PostListItemView extends Component {
date={isFormatedDate ? created : getTimeFromNow(created, true)}
name={username}
reputation={reputation}
size={32}
size={36}
tag={mainTag}
/>
<IconButton

View File

@ -202,7 +202,7 @@ class PostDisplayView extends PureComponent {
currentAccountUsername={name}
reputation={post.author_reputation}
tag={post.category}
size={16}
size={36}
/>
<PostBody body={post.body} />
<View style={styles.footer}>

View File

@ -351,7 +351,10 @@ const PostsView = ({
{filterOptions && isShowFilterBar && (
<FilterBar
dropdownIconName="arrow-drop-down"
options={filterOptions}
//options={filterOptions}
options={filterOptions.map(item =>
intl.formatMessage({ id: `home.${item.toLowerCase()}` }).toUpperCase(),
)}
selectedOptionIndex={selectedFilterIndex}
defaultText={filterOptions[selectedOptionIndex]}
rightIconName="view-module"

View File

@ -114,7 +114,7 @@ class ProfileView extends PureComponent {
defaultTitle={intl.formatMessage({
id: 'profile.details',
})}
expanded
expanded={!isOwnProfile}
isExpanded={isSummaryOpen}
handleOnExpanded={this._handleOnSummaryExpanded}
moreHeight={collapsibleMoreHeight}

View File

@ -74,7 +74,12 @@ const SearchModalContainer = ({
getPurePost(author, permlink).then(post => {
if (post.id !== 0) {
const result = {};
const metadata = JSON.parse(get(post, 'json_metadata', ''));
let metadata = {};
try {
metadata = JSON.parse(get(post, 'json_metadata', ''));
} catch (error) {
metadata = {};
}
if (get(metadata, 'image', false) && metadata.image.length > 0) {
[result.image] = metadata.image;
} else {

View File

@ -54,7 +54,7 @@ export default EStyleSheet.create({
alignItems: 'center',
},
searchItemImageWrapper: {
flex: 1,
flex: 2,
},
searchItemTextWrapper: {
flex: 10,

View File

@ -56,7 +56,7 @@ export default EStyleSheet.create({
color: '$iconColor',
fontSize: 20,
marginRight: 5,
width: 25,
width: 20,
},
listItemText: {
color: '$primaryDarkGray',

View File

@ -28,6 +28,9 @@
"reblog_title": "Points for reblog",
"login_title": "Points for login",
"checkin_title": "Points for heartbeat",
"referral": "Referral",
"referral_title": "Referral rewards",
"referral_desc": "Invite friends and earn ESTM",
"checkin_extra_title": "Usage bonus",
"no_activity": "No recent activity",
"outgoing_transfer_description": "",
@ -100,14 +103,14 @@
}
},
"notification": {
"vote": "likes your post",
"unvote": "unvoted your post",
"reply": "replied to your post",
"mention": "mentioned you",
"vote": "voted",
"unvote": "unvoted",
"reply": "replied to",
"mention": "mentioned in",
"follow": "followed you",
"unfollow": "unfollowed you",
"ignore": "ignored you",
"reblog": "reblogged your post",
"reblog": "reblogged",
"transfer": "transferred",
"notification": "Notifications",
"leaderboard": "Leaderboard",
@ -117,7 +120,11 @@
"yesterday": "Yesterday",
"this_week": "This Week",
"this_month": "This Month",
"older_then": "Older Than A Month"
"older_then": "Older Than A Month",
"activities": "All",
"replies": "Replies",
"mentions": "Mentions",
"reblogs": "Reblogs"
},
"leaderboard": {
"daily": "DAILY",
@ -206,7 +213,10 @@
},
"home": {
"feed": "Feed",
"popular": "Popular"
"popular": "Popular",
"top": "Top",
"hot": "Hot",
"new": "New"
},
"side_menu": {
"profile": "Profile",

View File

@ -15,6 +15,14 @@ export default {
iconType: 'MaterialIcons',
point: 0.1,
},
160: {
icon: 'target',
textKey: 'referral_title',
nameKey: 'wallet.referral',
descriptionKey: 'wallet.referral_desc',
iconType: 'MaterialCommunityIcons',
point: 100,
},
150: {
icon: 'arrow-collapse-all',
textKey: 'delegation_title',
@ -82,6 +90,9 @@ export default {
};
export const POINTS_KEYS = [
{
type: 160,
},
{
type: 150,
},

View File

@ -156,7 +156,15 @@ export const getUser = async user => {
get(globalProperties, 'total_vesting_fund_steem'),
);
_account.about = has(_account, 'json_metadata') && JSON.parse(get(_account, 'json_metadata'));
if (has(_account, 'json_metadata')) {
try {
_account.about = JSON.parse(get(_account, 'json_metadata'));
} catch (e) {
//alert(e);
_account.about = {};
}
}
_account.avatar = getAvatar(get(_account, 'about'));
_account.display_name = getName(get(_account, 'about'));

View File

@ -71,18 +71,20 @@ export const catchDraftImage = body => {
};
export const getResizedImage = (url, size = 640) => {
//TODO: implement fallback onError, for steemitimages is down case
if (!url) {
return '';
}
/*
if (url.includes('img.esteem.ws')) {
return `https://img.esteem.ws/${size}x0/${url}`;
return `${url.replace('img.esteem.ws/', `img.esteem.ws/${size}/`)}`;
}
if (url.includes('img.esteem.app')) {
return `https://img.esteem.app/${size}x0/${url}`;
return `${url.replace('img.esteem.app/', `img.esteem.app/${size}/`)}`;
}
*/
return `https://steemitimages.com/${size}x0/${url}`;
};

View File

@ -31,7 +31,11 @@ export const parsePost = async (post, currentUserName, isPromoted) => {
post.markdownBody = post.body;
}
post.is_promoted = isPromoted;
post.json_metadata = JSON.parse(post.json_metadata);
try {
post.json_metadata = JSON.parse(post.json_metadata);
} catch (error) {
post.json_metadata = {};
}
post.image = postImage(post.json_metadata, post.body);
post.active_votes = activeVotes;
post.vote_count = post.active_votes.length;
@ -66,10 +70,9 @@ const postImage = (metaData, body) => {
const urlRegex = /(http|ftp|https):\/\/([\w_-]+(?:(?:\.[\w_-]+)+))([\w.,@?^=%&:/~+#-]*[\w@?^=%&/~+#-])?/gm;
const imageRegex = /(http(s?):)([/|.|\w|\s|-])*\.(?:jpg|gif|png)/g;
let imageLink;
if (metaData && metaData.image && metaData.image[0]) {
[imageLink] = metaData.image;
} else if (body && markdownImageRegex.test(body)) {
} else if (!imageLink && body && markdownImageRegex.test(body)) {
const markdownMatch = body.match(markdownImageRegex);
if (markdownMatch[0]) {
const firstMarkdownMatch = markdownMatch[0];

View File

@ -1319,11 +1319,6 @@
"@types/istanbul-reports" "^1.1.1"
"@types/yargs" "^13.0.0"
"@ptomasroos/react-native-multi-slider@^1.0.0":
version "1.0.0"
resolved "https://registry.yarnpkg.com/@ptomasroos/react-native-multi-slider/-/react-native-multi-slider-1.0.0.tgz#a4ea27b1320b93a1db9f696c24789695df6c9f30"
integrity sha512-NpX22rQLArg9widwMzGf7XsInTDf6mfY/D1XaDVjglNkVphj3NSN37+nF6MofArCxC++1P+jHv0SGWbmJQwy4g==
"@react-native-community/cameraroll@^1.3.0":
version "1.3.0"
resolved "https://registry.yarnpkg.com/@react-native-community/cameraroll/-/cameraroll-1.3.0.tgz#a340334440f4d08280da839130ef51c931b07483"
@ -1359,6 +1354,16 @@
js-yaml "^3.13.1"
xcode "^2.0.0"
"@react-native-community/cli-tools@^2.8.3":
version "2.8.3"
resolved "https://registry.yarnpkg.com/@react-native-community/cli-tools/-/cli-tools-2.8.3.tgz#0e2249f48cf4603fb8d740a9f0715c31ac131ceb"
integrity sha512-N5Pz+pR+GFq3JApjd0SW4jp9KC7kbKsMH65QLRh30JNsxdPvNkYox6/ZZdkvdXaI5ev3EckR7eqlcwi5gpVTYQ==
dependencies:
chalk "^2.4.2"
lodash "^4.17.5"
mime "^2.4.1"
node-fetch "^2.5.0"
"@react-native-community/cli-tools@^3.0.0":
version "3.0.0"
resolved "https://registry.yarnpkg.com/@react-native-community/cli-tools/-/cli-tools-3.0.0.tgz#fe48b80822ed7e49b8af051f9fe41e22a2a710b1"