Merge branch 'development' into l10n_development

This commit is contained in:
Feruz M 2020-10-19 23:21:27 +03:00 committed by GitHub
commit 6cf9126bde
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
27 changed files with 152 additions and 157 deletions

View File

@ -143,7 +143,7 @@ android {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode versionMajor * 10000 + versionMinor * 100 + versionPatch
versionName "3.0.5"
versionName "3.0.6"
resValue "string", "build_config_package", "app.esteem.mobile.android"
multiDexEnabled true
// react-native-image-crop-picker

View File

@ -19,3 +19,4 @@
android.useAndroidX=true
android.enableJetifier=true
org.gradle.jvmargs=-Xmx10248m

View File

@ -15,11 +15,11 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>3.0.5</string>
<string>3.0.6</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>2555</string>
<string>2556</string>
<key>LSRequiresIPhoneOS</key>
<true />
<key>NSAppTransportSecurity</key>

View File

@ -15,10 +15,10 @@
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>3.0.5</string>
<string>3.0.6</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>2555</string>
<string>2556</string>
</dict>
</plist>

View File

@ -1100,7 +1100,7 @@
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 2555;
CURRENT_PROJECT_VERSION = 2556;
DEAD_CODE_STRIPPING = NO;
DEVELOPMENT_TEAM = 75B6RXTKGT;
HEADER_SEARCH_PATHS = (
@ -1176,7 +1176,7 @@
CODE_SIGN_ENTITLEMENTS = Ecency/Ecency.entitlements;
CODE_SIGN_IDENTITY = "iPhone Distribution";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 2555;
CURRENT_PROJECT_VERSION = 2556;
DEAD_CODE_STRIPPING = NO;
DEVELOPMENT_TEAM = 75B6RXTKGT;
HEADER_SEARCH_PATHS = (

View File

@ -19,7 +19,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>3.0.5</string>
<string>3.0.6</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleURLTypes</key>

View File

@ -15,10 +15,10 @@
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>3.0.5</string>
<string>3.0.6</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>2555</string>
<string>2556</string>
</dict>
</plist>

View File

@ -17,9 +17,9 @@
<key>CFBundlePackageType</key>
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
<key>CFBundleShortVersionString</key>
<string>3.0.5</string>
<string>3.0.6</string>
<key>CFBundleVersion</key>
<string>2555</string>
<string>2556</string>
<key>NSExtension</key>
<dict>
<key>NSExtensionAttributes</key>

View File

@ -1,6 +1,6 @@
{
"name": "ecency",
"version": "3.0.5",
"version": "3.0.6",
"displayName": "Ecency",
"private": true,
"rnpm": {
@ -34,7 +34,7 @@
"@esteemapp/react-native-multi-slider": "^1.1.0",
"@esteemapp/react-native-render-html": "^4.1.5",
"@esteemapp/react-native-slider": "^0.12.0",
"@hiveio/dhive": "^0.14.1",
"@hiveio/dhive": "^0.14.8",
"@react-native-community/async-storage": "^1.11.0",
"@react-native-community/cameraroll": "^1.3.0",
"@react-native-community/cli-platform-ios": "^4.10.1",

View File

@ -51,17 +51,9 @@ const CommentView = ({
const actionSheet = useRef(null);
useEffect(() => {
getActiveVotes(get(comment, 'author'), get(comment, 'permlink'))
.then((result) => {
result.sort((a, b) => b.rshares - a.rshares);
const _votes = parseActiveVotes(
{ ...comment, active_votes: result },
currentAccountUsername,
);
setActiveVotes(_votes);
})
.catch(() => {});
if (comment) {
setActiveVotes(get(comment, 'active_votes', []));
}
}, [comment]);
const _showSubCommentsToggle = () => {
@ -106,7 +98,7 @@ const CommentView = ({
onPress={() =>
handleOnVotersPress &&
activeVotes.length > 0 &&
handleOnVotersPress(activeVotes)
handleOnVotersPress(activeVotes, comment)
}
text={activeVotes.length}
textStyle={styles.voteCountText}

View File

@ -168,11 +168,12 @@ const CommentsContainer = ({
});
};
const _handleOnVotersPress = (activeVotes) => {
const _handleOnVotersPress = (activeVotes, content) => {
navigation.navigate({
routeName: ROUTES.SCREENS.VOTERS,
params: {
activeVotes,
content,
},
key: get(content, 'permlink'),
});

View File

@ -30,7 +30,7 @@ const PostCardContainer = ({
}) => {
const [activeVotes, setActiveVotes] = useState([]);
const [reblogs, setReblogs] = useState([]);
const [_content, setContent] = useState(null);
const [_content, setContent] = useState(content);
useEffect(() => {
if (isRefresh) {
@ -40,18 +40,12 @@ const PostCardContainer = ({
useEffect(() => {
if (content) {
getActiveVotes(get(content, 'author'), get(content, 'permlink'))
.then((result) => {
result.sort((a, b) => b.rshares - a.rshares);
const _votes = parseActiveVotes({ ...content, active_votes: result });
setActiveVotes(_votes);
})
.catch(() => {});
setActiveVotes(get(content, 'active_votes', []));
getPostReblogs(content).then((result) => {
setReblogs(result);
});
setContent(content);
}
}, [content]);
@ -85,6 +79,7 @@ const PostCardContainer = ({
routeName: ROUTES.SCREENS.VOTERS,
params: {
activeVotes,
content,
},
key: get(content, 'permlink'),
});

View File

@ -41,18 +41,7 @@ const PostDisplayContainer = ({
useEffect(() => {
if (post) {
getActiveVotes(get(post, 'author'), get(post, 'permlink'))
.then((result) => {
result.sort((a, b) => b.rshares - a.rshares);
const _votes = parseActiveVotes(
{ ...post, active_votes: result },
get(currentAccount, 'name'),
);
setActiveVotes(_votes);
})
.catch(() => {});
setActiveVotes(get(post, 'active_votes', []));
getPostReblogs(post).then((result) => {
setReblogs(result);
@ -70,6 +59,7 @@ const PostDisplayContainer = ({
routeName: ROUTES.SCREENS.VOTERS,
params: {
activeVotes,
content: post,
},
// TODO: make unic
key: post.permlink + activeVotes.length,

View File

@ -1,4 +1,4 @@
import React, { useCallback, useState, useEffect } from 'react';
import React, { useCallback, useState, useEffect, useRef } from 'react';
import { useDispatch, useSelector } from 'react-redux';
import get from 'lodash/get';
import unionBy from 'lodash/unionBy';
@ -50,6 +50,7 @@ const PostsContainer = ({
const [selectedFilterValue, setSelectedFilterValue] = useState(
filterOptionsValue && filterOptionsValue[selectedFilterIndex],
);
const elem = useRef(null);
useEffect(() => {
if (isConnected) {
@ -103,6 +104,8 @@ const PostsContainer = ({
dispatch(hidePostsThumbnails(!isHideImages));
};
const checkIfMounted = () => elem.current != null;
const _getPromotePosts = useCallback(async () => {
if (pageType === 'profiles') {
return;
@ -195,8 +198,8 @@ const PostsContainer = ({
_posts = unionBy(posts, _posts, 'permlink');
}
}
if (posts.length < 4 && pageType !== 'profiles') {
console.log('mounted?', checkIfMounted());
if (posts.length <= 4 && pageType !== 'profiles') {
_setFeedPosts(_posts);
}
@ -265,6 +268,7 @@ const PostsContainer = ({
return (
<PostsView
ref={elem}
filterOptions={filterOptions}
handleImagesHide={_handleImagesHide}
handleOnScroll={handleOnScroll}

View File

@ -1,5 +1,5 @@
/* eslint-disable react/jsx-wrap-multilines */
import React, { useRef } from 'react';
import React, { useRef, useEffect, useState } from 'react';
import { FlatList, View, ActivityIndicator, RefreshControl } from 'react-native';
import { useIntl } from 'react-intl';
import { withNavigation } from 'react-navigation';

View File

@ -18,6 +18,15 @@ import styles from './votersDisplayStyles';
const VotersDisplayView = ({ votes, navigation }) => {
const intl = useIntl();
/*getActiveVotes(get(content, 'author'), get(content, 'permlink'))
.then((result) => {
result.sort((a, b) => b.rshares - a.rshares);
const _votes = parseActiveVotes({ ...content, active_votes: result });
setActiveVotes(_votes);
})
.catch(() => {});*/
const _handleOnUserPress = (username) => {
navigation.navigate({
routeName: ROUTES.SCREENS.PROFILE,
@ -29,7 +38,7 @@ const VotersDisplayView = ({ votes, navigation }) => {
};
const _renderItem = ({ item, index }) => {
const value = `$ ${item.value}`;
const value = `$ ${item.reward}`;
const percent = `${item.percent}%`;
return (

View File

@ -341,7 +341,8 @@
"payloadTooLarge": "File size too big, please resize or upload smaller image",
"qoutaExceeded": "Upload quota exceeded",
"invalidImage": "Invalid image, try different file",
"something_wrong": "Something went wrong. Try https://ecency.com until we fix the issue!"
"something_wrong": "Something went wrong.",
"something_wrong_alt": "Try https://ecency.com"
},
"post": {
"reblog_alert": "Are you sure, you want to reblog?",

View File

@ -1,32 +1,20 @@
import { Component } from 'react';
import { Component, useState, useEffect } from 'react';
import { isBefore } from '../utils/time';
import ROUTES from '../constants/routeNames';
class AccountListContainer extends Component {
/* Props
* ------------------------------------------------
* @prop { type } name - Description....
*/
const AccountListContainer = ({ data, navigation, children }) => {
const [vdata, setVData] = useState(data);
const [filterResult, setFilterResult] = useState(null);
const [filterIndex, setFilterIndex] = useState(0);
constructor(props) {
super(props);
this.state = {
data: props.data,
filterResult: null,
filterIndex: 0,
};
}
useEffect(() => {
setVData(data);
}, [data]);
// Component Life Cycles
// Component Functions
_handleSearch = (searchText, key) => {
const { data, filterIndex } = this.state;
const newData = data.filter((item) => {
const _handleSearch = (searchText, key) => {
const newData = vdata.filter((item) => {
const itemName = item[key].toUpperCase();
const _text = searchText.toUpperCase();
@ -34,15 +22,14 @@ class AccountListContainer extends Component {
});
if (filterIndex !== 0) {
this._handleOnVotersDropdownSelect(filterIndex, '', newData);
_handleOnVotersDropdownSelect(filterIndex, '', newData);
} else {
this.setState({ filterResult: newData });
setFilterResult(newData);
}
};
_handleOnVotersDropdownSelect = (index, text, oldData) => {
const { data, filterIndex } = this.state;
const _data = Object.assign([], oldData || data);
const _handleOnVotersDropdownSelect = (index, text, oldData) => {
const _data = Object.assign([], oldData || vdata);
if (filterIndex === index) {
switch (index) {
@ -73,13 +60,11 @@ class AccountListContainer extends Component {
break;
}
}
this.setState({ filterResult: _data, filterIndex: index });
setFilterResult(_data);
setFilterIndex(index);
};
_handleOnUserPress = (username) => {
const { navigation } = this.props;
const _handleOnUserPress = (username) => {
navigation.navigate({
routeName: ROUTES.SCREENS.PROFILE,
params: {
@ -89,22 +74,17 @@ class AccountListContainer extends Component {
});
};
render() {
const { data, filterResult, filterIndex } = this.state;
const { children } = this.props;
return (
children &&
children({
data,
filterResult,
filterIndex,
handleOnVotersDropdownSelect: this._handleOnVotersDropdownSelect,
handleSearch: this._handleSearch,
handleOnUserPress: this._handleOnUserPress,
})
);
}
}
return (
children &&
children({
data,
filterResult,
filterIndex,
handleOnVotersDropdownSelect: _handleOnVotersDropdownSelect,
handleSearch: _handleSearch,
handleOnUserPress: _handleOnUserPress,
})
);
};
export default AccountListContainer;

View File

@ -12,7 +12,7 @@ import { getAccount, claimRewardBalance, getBtcAddress } from '../providers/stee
import { openPinCodeModal } from '../redux/actions/applicationActions';
// Utils
import { groomingWalletData, groomingTransactionData } from '../utils/wallet';
import { groomingWalletData, groomingTransactionData, transferTypes } from '../utils/wallet';
import parseToken from '../utils/parseToken';
import { vestsToSp } from '../utils/conversions';
import { navigate } from '../navigation/service';
@ -73,24 +73,8 @@ const WalletContainer = ({
}, [_getWalletData, selectedUser]);
useEffect(() => {
const _transferHistory = userActivities.filter(
(item) =>
get(item, 'textKey') === 'transfer' ||
get(item, 'textKey') === 'transfer_to_vesting' ||
get(item, 'textKey') === 'transfer_to_savings' ||
get(item, 'textKey') === 'withdraw_vesting' ||
get(item, 'textKey') === 'transfer_from_savings' ||
get(item, 'textKey') === 'convert' ||
get(item, 'textKey') === 'escrow_transfer' ||
get(item, 'textKey') === 'escrow_dispute' ||
get(item, 'textKey') === 'escrow_release' ||
get(item, 'textKey') === 'escrow_approve' ||
get(item, 'textKey') === 'cancel_transfer_from_savings' ||
get(item, 'textKey') === 'delegate_vesting_shares' ||
get(item, 'textKey') === 'fill_convert_request' ||
get(item, 'textKey') === 'fill_transfer_from_savings' ||
get(item, 'textKey') === 'fill_vesting_withdraw' ||
get(item, 'textKey') === 'fill_order',
const _transferHistory = userActivities.filter((item) =>
transferTypes.includes(get(item, 'textKey')),
);
setTransferHistory(_transferHistory);

View File

@ -31,12 +31,13 @@ global.Buffer = global.Buffer || require('buffer').Buffer;
const DEFAULT_SERVER = [
'https://rpc.ecency.com',
'https://anyx.io',
'https://api.pharesim.me',
'https://hive-api.arcange.eu',
'https://api.openhive.network',
'https://api.hive.blog',
'https://api.hivekings.com',
];
let client = new Client(DEFAULT_SERVER, {
timeout: 5000,
timeout: 3000,
rebrandedApi: true,
});
export const checkClient = async () => {
@ -49,7 +50,7 @@ export const checkClient = async () => {
});
client = new Client(selectedServer, {
timeout: 5000,
timeout: 3000,
rebrandedApi: true,
});
};

View File

@ -33,11 +33,16 @@ class ErrorBoundary extends React.Component {
return (
<View style={{ justifyContent: 'center', alignItems: 'center', flex: 1 }}>
<Icon iconType="MaterialIcons" name="error-outline" size={56} />
<Text style={{ fontSize: 30 }}>
<Text style={{ fontSize: 25 }}>
{intl.formatMessage({
id: 'alert.something_wrong',
})}
</Text>
<Text style={{ fontSize: 15 }}>
{intl.formatMessage({
id: 'alert.something_wrong_alt',
})}
</Text>
</View>
);
}

View File

@ -123,7 +123,8 @@ class SettingsContainer extends Component {
let isError = false;
let alertMessage;
const client = new Client(server, {
timeout: 5000,
timeout: 3000,
rebrandedApi: true,
});
dispatch(setApi(''));

View File

@ -1,4 +1,4 @@
import React from 'react';
import React, { useState, useEffect } from 'react';
import { SafeAreaView } from 'react-native';
import { useIntl } from 'react-intl';
import get from 'lodash/get';
@ -9,20 +9,38 @@ import { BasicHeader, FilterBar, VotersDisplay } from '../../../components';
import AccountListContainer from '../../../containers/accountListContainer';
// Utils
import globalStyles from '../../../globalStyles';
import { getActiveVotes } from '../../../providers/steem/dsteem';
import { parseActiveVotes } from '../../../utils/postParser';
const filterOptions = ['rewards', 'percent', 'time'];
const VotersScreen = ({ navigation }) => {
const intl = useIntl();
const [content, setContent] = useState(get(navigation, 'state.params.content'));
const [activeVotes, setActiveVotes] = useState(get(content, 'active_votes') || []);
const [isLoading, setIsLoading] = useState(false);
const headerTitle = intl.formatMessage({
id: 'voters.voters_info',
});
const activeVotes = get(navigation, 'state.params.activeVotes');
useEffect(() => {
if (content) {
getActiveVotes(get(content, 'author'), get(content, 'permlink'))
.then((result) => {
result.sort((a, b) => b.rshares - a.rshares);
const _votes = parseActiveVotes({ ...content, active_votes: result });
setActiveVotes(_votes);
})
.catch(() => {});
}
}, [content]);
//const activeVotes = get(navigation, 'state.params.activeVotes');
//const content = get(navigation, 'state.params.content');
return (
<AccountListContainer data={activeVotes}>
<AccountListContainer data={_activeVotes}>
{({ data, filterResult, filterIndex, handleOnVotersDropdownSelect, handleSearch }) => (
<>
<BasicHeader

View File

@ -71,7 +71,6 @@ export const makeOptions = (postObj) => {
percent_hbd: 10000,
extensions: [[0, { beneficiaries: [] }]],
};
console.log(postObj);
switch (postObj.operationType) {
case 'sp':
a.max_accepted_payout = '1000000.000 HBD';

View File

@ -104,7 +104,7 @@ export const isVoted = (activeVotes, currentUserName) => {
return false;
}
const result = activeVotes.find(
(element) => get(element, 'voter') === currentUserName && get(element, 'percent', 0) > 0,
(element) => get(element, 'voter') === currentUserName && get(element, 'rshares', 0) > 0,
);
if (result) {
return result.percent;
@ -117,7 +117,7 @@ export const isDownVoted = (activeVotes, currentUserName) => {
return false;
}
const result = activeVotes.find(
(element) => get(element, 'voter') === currentUserName && get(element, 'percent') < 0,
(element) => get(element, 'voter') === currentUserName && get(element, 'rshares') < 0,
);
if (result) {
return result.percent;
@ -127,16 +127,17 @@ export const isDownVoted = (activeVotes, currentUserName) => {
export const parseActiveVotes = (post) => {
const totalPayout =
post.total_payout ||
parseFloat(post.pending_payout_value) +
parseFloat(post.total_payout_value) +
parseFloat(post.curator_payout_value);
parseFloat(post.total_payout_value) +
parseFloat(post.curator_payout_value);
const voteRshares = post.active_votes.reduce((a, b) => a + parseFloat(b.rshares), 0);
const ratio = totalPayout / voteRshares || 0;
if (!isEmpty(post.active_votes)) {
forEach(post.active_votes, (value) => {
value.value = (value.rshares * ratio).toFixed(3);
value.reward = (value.rshares * ratio).toFixed(3);
//value.reputation = getReputation(get(value, 'reputation'));
value.percent /= 100;
value.is_down_vote = Math.sign(value.percent) < 0;

View File

@ -2,9 +2,31 @@ import get from 'lodash/get';
import parseDate from './parseDate';
import parseToken from './parseToken';
import { vestsToSp } from './conversions';
import { getState, getFeedHistory, getAccount, getAccountHistory } from '../providers/steem/dsteem';
import { getFeedHistory, getAccount, getAccountHistory } from '../providers/steem/dsteem';
import { getCurrencyTokenRate } from '../providers/esteem/esteem';
export const transferTypes = [
'curation_reward',
'author_reward',
'comment_benefactor_reward',
'claim_reward_balance',
'transfer',
'transfer_to_savings',
'transfer_from_savings',
'transfer_to_vesting',
'withdraw_vesting',
'fill_order',
'escrow_transfer',
'escrow_dispute',
'escrow_release',
'escrow_approve',
'delegate_vesting_shares',
'cancel_transfer_from_savings',
'fill_convert_request',
'fill_transfer_from_savings',
'fill_vesting_withdraw',
];
export const groomingTransactionData = (transaction, steemPerMVests) => {
if (!transaction || !steemPerMVests) {
return [];
@ -224,22 +246,13 @@ export const groomingWalletData = async (user, globalProps, userCurrency) => {
const timeDiff = Math.abs(parseDate(userdata.next_vesting_withdrawal) - new Date());
walletData.nextVestingWithdrawal = Math.round(timeDiff / (1000 * 3600));
/*const history = await getAccountHistory(get(user, 'name'));
const history = await getAccountHistory(get(user, 'name'));
const transfers = history.filter((tx) => {
return tx[1] && tx[1].op && tx[1].op[0] === 'claim_reward_balance'
});
const transfers = history.filter((tx) => transferTypes.includes(get(tx[1], 'op[0]', false)));
const actualTransfers = transfers.reduce((arr, tx) => {
console.log('tx', tx[1])
const transaction = tx[1].op[1];
const date = new Date(`${tx[1].timestamp}Z`);
transaction.date = date;
arr.push(transaction);
return arr;
}, []);
*/
walletData.transactions = [];
transfers.sort(compare);
walletData.transactions = transfers;
return walletData;
};

View File

@ -837,10 +837,10 @@
dependencies:
"@hapi/hoek" "^8.3.0"
"@hiveio/dhive@^0.14.1":
version "0.14.1"
resolved "https://registry.yarnpkg.com/@hiveio/dhive/-/dhive-0.14.1.tgz#1a6273d1544bd97bf2a047baa85a6afb4cecae78"
integrity sha512-80I1alxQW5Cnt61KvAuSa+dPH6V+JNrE/0vR+DgQGH9y8l3xmn+pr4TXNLtSvx37pI8Zt1UEPsgvren/R02WeQ==
"@hiveio/dhive@^0.14.8":
version "0.14.8"
resolved "https://registry.yarnpkg.com/@hiveio/dhive/-/dhive-0.14.8.tgz#7ff2e60c579559d136440e46bd58c55a09d854d9"
integrity sha512-TfnzrnVD6OKLYSb8quHeT8hUjPeR1etIGg6EXaH+lbzgNpmlVBwgmM+uDdGNPRifh4CT8sf+/6fsLvKF2ens/Q==
dependencies:
bs58 "^4.0.1"
bytebuffer "^5.0.1"