mirror of
https://github.com/ecency/ecency-mobile.git
synced 2024-12-01 00:43:12 +03:00
linting and log details
This commit is contained in:
parent
2cd1c84337
commit
95e41ba263
@ -36,7 +36,7 @@ class ExampleContainer extends Component {
|
||||
}
|
||||
}
|
||||
|
||||
const mapStateToProps = state => ({
|
||||
const mapStateToProps = (state) => ({
|
||||
user: state.user.user,
|
||||
});
|
||||
|
||||
|
@ -127,7 +127,7 @@ class PulseAnimation extends Component {
|
||||
<View style={containerStyle}>
|
||||
{started && (
|
||||
<View style={pulseWrapperStyle}>
|
||||
{pulses.map(pulse => (
|
||||
{pulses.map((pulse) => (
|
||||
<View
|
||||
key={pulse.pulseKey}
|
||||
style={[
|
||||
|
@ -51,7 +51,7 @@ class BasicHeaderView extends Component {
|
||||
}
|
||||
};
|
||||
|
||||
_handleOnSearch = value => {
|
||||
_handleOnSearch = (value) => {
|
||||
const { handleOnSearch } = this.props;
|
||||
|
||||
handleOnSearch(value);
|
||||
@ -59,7 +59,7 @@ class BasicHeaderView extends Component {
|
||||
|
||||
_handleOnInputChange = () => {};
|
||||
|
||||
_handleDatePickerChange = datePickerValue => {
|
||||
_handleDatePickerChange = (datePickerValue) => {
|
||||
const { handleDatePickerChange } = this.props;
|
||||
|
||||
if (handleDatePickerChange) {
|
||||
@ -153,7 +153,7 @@ class BasicHeaderView extends Component {
|
||||
|
||||
{isInputVisible && (
|
||||
<TextInput
|
||||
onChangeText={value => this._handleOnSearch(value)}
|
||||
onChangeText={(value) => this._handleOnSearch(value)}
|
||||
autoFocus
|
||||
placeholder={intl.formatMessage({
|
||||
id: 'basic_header.search',
|
||||
|
@ -5,12 +5,12 @@ import { IconButton } from '../../../iconButton';
|
||||
|
||||
import styles from './chipStyle';
|
||||
|
||||
const Chip = props => (
|
||||
const Chip = (props) => (
|
||||
<View style={[styles.wrapper, props.isPin && styles.isPin]}>
|
||||
<TextInput
|
||||
style={[styles.textInput, props.removeButton && styles.textInputWithButton]}
|
||||
allowFontScaling
|
||||
onChangeText={text => props.handleOnChange(text)}
|
||||
onChangeText={(text) => props.handleOnChange(text)}
|
||||
onBlur={() => props.handleOnBlur()}
|
||||
{...props}
|
||||
/>
|
||||
|
@ -14,7 +14,7 @@ const BoostPlaceHolder = () => {
|
||||
const ratio = (HEIGHT - 300) / 50 / 1.3;
|
||||
const listElements = [];
|
||||
|
||||
times(parseInt(ratio), i => {
|
||||
times(parseInt(ratio), (i) => {
|
||||
listElements.push(
|
||||
<ThemeContainer>
|
||||
{({ isDarkTheme }) => {
|
||||
|
@ -11,7 +11,7 @@ const ListPlaceHolderView = () => {
|
||||
const ratio = (HEIGHT - 300) / 50;
|
||||
const listElements = [];
|
||||
|
||||
times(parseInt(ratio), i => {
|
||||
times(parseInt(ratio), (i) => {
|
||||
listElements.push(<ListItemPlaceHolder key={i} />);
|
||||
});
|
||||
|
||||
|
@ -10,11 +10,11 @@ import styles from './walletDetailsPlaceHolderStyles';
|
||||
|
||||
const HEIGHT = Dimensions.get('window').height;
|
||||
|
||||
const listPlaceHolderView = color => {
|
||||
const listPlaceHolderView = (color) => {
|
||||
const ratio = (HEIGHT - 300) / 50;
|
||||
const listElements = [];
|
||||
|
||||
times(parseInt(ratio), i => {
|
||||
times(parseInt(ratio), (i) => {
|
||||
listElements.push(
|
||||
<View key={i} style={styles.textWrapper}>
|
||||
<Placeholder.Box animate="fade" height={30} width="100%" radius={5} color={color} />
|
||||
|
@ -33,7 +33,7 @@ class TagContainer extends PureComponent {
|
||||
|
||||
if (value.startsWith('hive-')) {
|
||||
getCommunity(value)
|
||||
.then(r => {
|
||||
.then((r) => {
|
||||
this.setState({ label: r });
|
||||
return r;
|
||||
})
|
||||
|
@ -51,11 +51,11 @@ const BottomTabBarView = ({
|
||||
selectedIndex={index}
|
||||
circleBackgroundColor="#357ce6"
|
||||
backgroundColor={isDarkTheme ? '#2e3d51' : '#f6f6f6'}
|
||||
onChange={i => _jumpTo(routes[i], index, routes, jumpTo)}
|
||||
onChange={(i) => _jumpTo(routes[i], index, routes, jumpTo)}
|
||||
activeTintColor={activeTintColor}
|
||||
inactiveTintColor={inactiveTintColor}
|
||||
>
|
||||
{routes.map(route => (
|
||||
{routes.map((route) => (
|
||||
<TabBar.Item
|
||||
icon={renderIcon({
|
||||
route,
|
||||
|
@ -41,11 +41,11 @@ export default class TabBar extends Component {
|
||||
animating: false,
|
||||
};
|
||||
|
||||
this.state.circleRadius.addListener(circleRadius => {
|
||||
this.state.circleRadius.addListener((circleRadius) => {
|
||||
this._myCircle.setNativeProps({ cx: parseInt(circleRadius.value, 10) });
|
||||
});
|
||||
|
||||
this.state.pathD.addListener(a => {
|
||||
this.state.pathD.addListener((a) => {
|
||||
this.setState({
|
||||
pathX: parseInt(a.value, 10),
|
||||
});
|
||||
@ -70,7 +70,7 @@ export default class TabBar extends Component {
|
||||
}
|
||||
};
|
||||
|
||||
_move = index => {
|
||||
_move = (index) => {
|
||||
const { animateConstant, pathD, circleRadius } = this.state;
|
||||
|
||||
this.setState({ selectedIndex: index, animating: true });
|
||||
@ -124,18 +124,23 @@ export default class TabBar extends Component {
|
||||
>
|
||||
<AnimatedPath
|
||||
fill={backgroundColor}
|
||||
d={`M${31 + pathX}.454074,80.6628108 C${42 + pathX}.339255,102.895752 ${64 +
|
||||
pathX}.692432,118.142857 ${90 + pathX}.5,118.142857 C${116 +
|
||||
pathX}.658561,118.142857 ${139 + pathX}.26813,102.478199 ${149 +
|
||||
pathX}.983671,79.7518248 C${154 + pathX}.222383,70.7620241 ${170 +
|
||||
pathX}.571658,50 ${197 + pathX}.357095,50 C${247 +
|
||||
pathX}.055518,50 561.603153,50 661,50 L661,156 L0,156 L0,50 C99.6668047,50 ${-66 +
|
||||
pathX}.416908,50 ${-16 + pathX}.250311,50 C${11 + pathX}.065333,50 ${26 +
|
||||
pathX}.941653,71.4462087 ${31 + pathX}.454074,80.6628108 Z`}
|
||||
d={`M${31 + pathX}.454074,80.6628108 C${42 + pathX}.339255,102.895752 ${
|
||||
64 + pathX
|
||||
}.692432,118.142857 ${90 + pathX}.5,118.142857 C${116 + pathX}.658561,118.142857 ${
|
||||
139 + pathX
|
||||
}.26813,102.478199 ${149 + pathX}.983671,79.7518248 C${154 + pathX}.222383,70.7620241 ${
|
||||
170 + pathX
|
||||
}.571658,50 ${197 + pathX}.357095,50 C${
|
||||
247 + pathX
|
||||
}.055518,50 561.603153,50 661,50 L661,156 L0,156 L0,50 C99.6668047,50 ${
|
||||
-66 + pathX
|
||||
}.416908,50 ${-16 + pathX}.250311,50 C${11 + pathX}.065333,50 ${
|
||||
26 + pathX
|
||||
}.941653,71.4462087 ${31 + pathX}.454074,80.6628108 Z`}
|
||||
/>
|
||||
<AnimatedCircle
|
||||
// eslint-disable-next-line no-return-assign
|
||||
ref={ref => (this._myCircle = ref)}
|
||||
ref={(ref) => (this._myCircle = ref)}
|
||||
fill={circleBackgroundColor}
|
||||
cx={circleRadius}
|
||||
cy="50.5"
|
||||
|
@ -1,6 +1,6 @@
|
||||
import EStyleSheet from 'react-native-extended-stylesheet';
|
||||
|
||||
export const getCheckBackground = isCheck =>
|
||||
export const getCheckBackground = (isCheck) =>
|
||||
EStyleSheet.create({
|
||||
backgroundColor: isCheck ? '$primaryBlue' : '#FFF',
|
||||
});
|
||||
|
@ -33,7 +33,7 @@ class CollapsibleCardView extends PureComponent {
|
||||
}
|
||||
|
||||
// Component Functions
|
||||
_initContentHeight = event => {
|
||||
_initContentHeight = (event) => {
|
||||
if (this.anime.contentHeight > 0) {
|
||||
return;
|
||||
}
|
||||
@ -118,7 +118,7 @@ class CollapsibleCardView extends PureComponent {
|
||||
|
||||
<Animated.View
|
||||
style={[styles.content, { height: this.anime.height, opacity: expanded ? 1 : 0 }]}
|
||||
onLayout={e => this._initContentHeight(e)}
|
||||
onLayout={(e) => this._initContentHeight(e)}
|
||||
>
|
||||
<View style={[!fitContent && !noContainer && styles.contentBody]}>{children}</View>
|
||||
</Animated.View>
|
||||
|
@ -128,7 +128,7 @@ const CommentView = ({
|
||||
title={intl.formatMessage({ id: 'alert.delete' })}
|
||||
destructiveButtonIndex={0}
|
||||
cancelButtonIndex={1}
|
||||
onPress={index => {
|
||||
onPress={(index) => {
|
||||
index === 0 ? handleDeleteComment(comment.permlink) : null;
|
||||
}}
|
||||
/>
|
||||
|
@ -61,12 +61,12 @@ const CommentsContainer = ({
|
||||
const _shortComments = (sortOrder, _comments) => {
|
||||
const sortedComments = _comments || lcomments;
|
||||
|
||||
const allPayout = c =>
|
||||
const allPayout = (c) =>
|
||||
parseFloat(get(c, 'pending_payout_value').split(' ')[0]) +
|
||||
parseFloat(get(c, 'total_payout_value').split(' ')[0]) +
|
||||
parseFloat(get(c, 'curator_payout_value').split(' ')[0]);
|
||||
|
||||
const absNegative = a => a.net_rshares < 0;
|
||||
const absNegative = (a) => a.net_rshares < 0;
|
||||
|
||||
const sortOrders = {
|
||||
trending: (a, b) => {
|
||||
@ -145,7 +145,7 @@ const CommentsContainer = ({
|
||||
fetchPost();
|
||||
} else if (author && permlink) {
|
||||
await getComments(author, permlink, name)
|
||||
.then(__comments => {
|
||||
.then((__comments) => {
|
||||
if (selectedFilter) {
|
||||
const sortComments = _shortComments(selectedFilter, __comments);
|
||||
setLComments(sortComments);
|
||||
@ -157,7 +157,7 @@ const CommentsContainer = ({
|
||||
}
|
||||
};
|
||||
|
||||
const _handleOnReplyPress = item => {
|
||||
const _handleOnReplyPress = (item) => {
|
||||
navigation.navigate({
|
||||
routeName: ROUTES.SCREENS.EDITOR,
|
||||
params: {
|
||||
@ -168,7 +168,7 @@ const CommentsContainer = ({
|
||||
});
|
||||
};
|
||||
|
||||
const _handleOnVotersPress = activeVotes => {
|
||||
const _handleOnVotersPress = (activeVotes) => {
|
||||
navigation.navigate({
|
||||
routeName: ROUTES.SCREENS.VOTERS,
|
||||
params: {
|
||||
@ -178,7 +178,7 @@ const CommentsContainer = ({
|
||||
});
|
||||
};
|
||||
|
||||
const _handleOnEditPress = item => {
|
||||
const _handleOnEditPress = (item) => {
|
||||
navigation.navigate({
|
||||
routeName: ROUTES.SCREENS.EDITOR,
|
||||
params: {
|
||||
@ -190,14 +190,14 @@ const CommentsContainer = ({
|
||||
});
|
||||
};
|
||||
|
||||
const _handleDeleteComment = _permlink => {
|
||||
const _handleDeleteComment = (_permlink) => {
|
||||
let filteredComments;
|
||||
|
||||
deleteComment(currentAccount, pinCode, _permlink).then(() => {
|
||||
if (lcomments.length > 0) {
|
||||
filteredComments = lcomments.filter(item => item.permlink !== _permlink);
|
||||
filteredComments = lcomments.filter((item) => item.permlink !== _permlink);
|
||||
} else {
|
||||
filteredComments = comments.filter(item => item.permlink !== _permlink);
|
||||
filteredComments = comments.filter((item) => item.permlink !== _permlink);
|
||||
}
|
||||
setLComments(filteredComments);
|
||||
});
|
||||
@ -255,7 +255,7 @@ const CommentsContainer = ({
|
||||
);
|
||||
};
|
||||
|
||||
const mapStateToProps = state => ({
|
||||
const mapStateToProps = (state) => ({
|
||||
isLoggedIn: state.application.isLoggedIn,
|
||||
currentAccount: state.account.currentAccount,
|
||||
pinCode: state.application.pin,
|
||||
|
@ -42,7 +42,7 @@ const CommentsView = ({
|
||||
const intl = useIntl();
|
||||
const commentMenu = useRef();
|
||||
|
||||
const _openCommentMenu = item => {
|
||||
const _openCommentMenu = (item) => {
|
||||
setSelectedComment(item);
|
||||
commentMenu.current.show();
|
||||
};
|
||||
@ -106,14 +106,14 @@ const CommentsView = ({
|
||||
handleOnLongPress={() => _openCommentMenu(item)}
|
||||
/>
|
||||
)}
|
||||
keyExtractor={item => get(item, 'permlink')}
|
||||
keyExtractor={(item) => get(item, 'permlink')}
|
||||
/>
|
||||
<ActionSheet
|
||||
ref={commentMenu}
|
||||
options={menuItems}
|
||||
title={get(selectedComment, 'summary')}
|
||||
cancelButtonIndex={2}
|
||||
onPress={index => handleOnPressCommentMenu(index, selectedComment)}
|
||||
onPress={(index) => handleOnPressCommentMenu(index, selectedComment)}
|
||||
/>
|
||||
</Fragment>
|
||||
);
|
||||
|
@ -33,9 +33,9 @@ const CommentsDisplayView = ({
|
||||
<Fragment>
|
||||
<FilterBar
|
||||
dropdownIconName="arrow-drop-down"
|
||||
options={VALUE.map(val => intl.formatMessage({ id: `comment_filter.${val}` }))}
|
||||
options={VALUE.map((val) => intl.formatMessage({ id: `comment_filter.${val}` }))}
|
||||
defaultText={intl.formatMessage({ id: `comment_filter.${VALUE[0]}` })}
|
||||
onDropdownSelect={selectedIndex =>
|
||||
onDropdownSelect={(selectedIndex) =>
|
||||
_handleOnDropdownSelect(COMMENT_FILTER[selectedIndex], selectedIndex)
|
||||
}
|
||||
selectedOptionIndex={selectedOptionIndex}
|
||||
|
@ -76,10 +76,12 @@ class DateTimePickerView extends PureComponent {
|
||||
cancelBtnText={intl.formatMessage({
|
||||
id: 'alert.cancel',
|
||||
})}
|
||||
onDateChange={_datePickerValue => this._setValue(!date ? 'date' : 'time', _datePickerValue)}
|
||||
onDateChange={(_datePickerValue) =>
|
||||
this._setValue(!date ? 'date' : 'time', _datePickerValue)
|
||||
}
|
||||
hideText
|
||||
is24Hour
|
||||
ref={picker => {
|
||||
ref={(picker) => {
|
||||
this.datePicker = picker;
|
||||
}}
|
||||
disabled={disabled}
|
||||
|
@ -75,7 +75,7 @@ const DropdownButtonView = ({
|
||||
dropdownTextStyle={[dropdownTextStyle || styles.dropdownText]}
|
||||
dropdownTextHighlightStyle={styles.dropdownTextHighlight}
|
||||
options={options}
|
||||
onSelect={e => onSelect && onSelect(e, options[e])}
|
||||
onSelect={(e) => onSelect && onSelect(e, options[e])}
|
||||
defaultIndex={selectedOptionIndex}
|
||||
defaultValue={defaultText}
|
||||
renderSeparator={() => null}
|
||||
|
@ -28,7 +28,7 @@ export default class TagAreaView extends Component {
|
||||
_handleOnChange = (text, i) => {
|
||||
if (text.indexOf(' ') > 0) {
|
||||
let ssp = [];
|
||||
ssp = text.split(' ').filter(iii => iii);
|
||||
ssp = text.split(' ').filter((iii) => iii);
|
||||
if (ssp.length > 1) {
|
||||
for (let ii = i; ii < i + ssp.length; ii++) {
|
||||
const element = ssp[ii - i];
|
||||
@ -50,7 +50,7 @@ export default class TagAreaView extends Component {
|
||||
}
|
||||
};
|
||||
|
||||
_handleOnBlur = i => {
|
||||
_handleOnBlur = (i) => {
|
||||
this._handleTagAdded(i);
|
||||
};
|
||||
|
||||
@ -79,7 +79,7 @@ export default class TagAreaView extends Component {
|
||||
this.setState({ currentText: '' });
|
||||
};
|
||||
|
||||
_handleTagRemove = i => {
|
||||
_handleTagRemove = (i) => {
|
||||
const { chips } = this.state;
|
||||
const { handleTagChanged } = this.props;
|
||||
|
||||
@ -126,7 +126,7 @@ export default class TagAreaView extends Component {
|
||||
<Chip
|
||||
// eslint-disable-next-line react/no-array-index-key
|
||||
key={i}
|
||||
refs={input => {
|
||||
refs={(input) => {
|
||||
this.inputs[i] = input;
|
||||
}}
|
||||
isPin={i === 0 && chips[1]}
|
||||
@ -138,7 +138,7 @@ export default class TagAreaView extends Component {
|
||||
placeholder="tags"
|
||||
autoFocus={i !== 0 && chips.length - 1 === i}
|
||||
multiline={false}
|
||||
handleOnChange={text => this._handleOnChange(text, i)}
|
||||
handleOnChange={(text) => this._handleOnChange(text, i)}
|
||||
handleOnBlur={() => this._handleOnBlur(i)}
|
||||
blurOnSubmit
|
||||
value={
|
||||
|
@ -31,26 +31,26 @@ const TagInput = ({
|
||||
}, [value]);
|
||||
|
||||
// Component Functions
|
||||
const _handleOnChange = _text => {
|
||||
const _handleOnChange = (_text) => {
|
||||
setText(_text.replace(/,/g, ' ').replace(/#/g, ''));
|
||||
|
||||
let cats = _text.split(' ');
|
||||
if (handleTagChanged && cats.length > 0) {
|
||||
cats.length > 10
|
||||
? setWarning(intl.formatMessage({ id: 'editor.limited_tags' }))
|
||||
: cats.find(c => c.length > 24)
|
||||
: cats.find((c) => c.length > 24)
|
||||
? setWarning(intl.formatMessage({ id: 'editor.limited_length' }))
|
||||
: cats.find(c => c.split('-').length > 2)
|
||||
: cats.find((c) => c.split('-').length > 2)
|
||||
? setWarning(intl.formatMessage({ id: 'editor.limited_dash' }))
|
||||
: cats.find(c => c.indexOf(',') >= 0)
|
||||
: cats.find((c) => c.indexOf(',') >= 0)
|
||||
? setWarning(intl.formatMessage({ id: 'editor.limited_space' }))
|
||||
: cats.find(c => /[A-Z]/.test(c))
|
||||
: cats.find((c) => /[A-Z]/.test(c))
|
||||
? setWarning(intl.formatMessage({ id: 'editor.limited_lowercase' }))
|
||||
: cats.find(c => !/^[a-z0-9-#]+$/.test(c))
|
||||
: cats.find((c) => !/^[a-z0-9-#]+$/.test(c))
|
||||
? setWarning(intl.formatMessage({ id: 'editor.limited_characters' }))
|
||||
: cats.find(c => !/^[a-z-#]/.test(c))
|
||||
: cats.find((c) => !/^[a-z-#]/.test(c))
|
||||
? setWarning(intl.formatMessage({ id: 'editor.limited_firstchar' }))
|
||||
: cats.find(c => !/[a-z0-9]$/.test(c))
|
||||
: cats.find((c) => !/[a-z0-9]$/.test(c))
|
||||
? setWarning(intl.formatMessage({ id: 'editor.limited_lastchar' }))
|
||||
: setWarning(null);
|
||||
|
||||
@ -64,19 +64,19 @@ const TagInput = ({
|
||||
if (handleTagChanged && cats.length > 0) {
|
||||
cats.length > 10
|
||||
? setWarning(intl.formatMessage({ id: 'editor.limited_tags' }))
|
||||
: cats.find(c => c.length > 24)
|
||||
: cats.find((c) => c.length > 24)
|
||||
? setWarning(intl.formatMessage({ id: 'editor.limited_length' }))
|
||||
: cats.find(c => c.split('-').length > 2)
|
||||
: cats.find((c) => c.split('-').length > 2)
|
||||
? setWarning(intl.formatMessage({ id: 'editor.limited_dash' }))
|
||||
: cats.find(c => c.indexOf(',') >= 0)
|
||||
: cats.find((c) => c.indexOf(',') >= 0)
|
||||
? setWarning(intl.formatMessage({ id: 'editor.limited_space' }))
|
||||
: cats.find(c => /[A-Z]/.test(c))
|
||||
: cats.find((c) => /[A-Z]/.test(c))
|
||||
? setWarning(intl.formatMessage({ id: 'editor.limited_lowercase' }))
|
||||
: cats.find(c => !/^[a-z0-9-#]+$/.test(c))
|
||||
: cats.find((c) => !/^[a-z0-9-#]+$/.test(c))
|
||||
? setWarning(intl.formatMessage({ id: 'editor.limited_characters' }))
|
||||
: cats.find(c => !/^[a-z-#]/.test(c))
|
||||
: cats.find((c) => !/^[a-z-#]/.test(c))
|
||||
? setWarning(intl.formatMessage({ id: 'editor.limited_firstchar' }))
|
||||
: cats.find(c => !/[a-z0-9]$/.test(c))
|
||||
: cats.find((c) => !/[a-z0-9]$/.test(c))
|
||||
? setWarning(intl.formatMessage({ id: 'editor.limited_lastchar' }))
|
||||
: setWarning(null);
|
||||
handleTagChanged([...cats]);
|
||||
@ -98,7 +98,7 @@ const TagInput = ({
|
||||
})}
|
||||
multiline
|
||||
autoFocus={autoFocus}
|
||||
onChangeText={textT => _handleOnChange(textT)}
|
||||
onChangeText={(textT) => _handleOnChange(textT)}
|
||||
onBlur={() => _handleOnBlur()}
|
||||
value={text}
|
||||
/>
|
||||
|
@ -25,7 +25,7 @@ export default class TitleAreaView extends Component {
|
||||
}
|
||||
|
||||
// Component Life Cycles
|
||||
UNSAFE_componentWillReceiveProps = nextProps => {
|
||||
UNSAFE_componentWillReceiveProps = (nextProps) => {
|
||||
const { text } = this.state;
|
||||
if (nextProps.value !== text) {
|
||||
this.setState({ text: nextProps.value });
|
||||
@ -33,7 +33,7 @@ export default class TitleAreaView extends Component {
|
||||
};
|
||||
|
||||
// Component Functions
|
||||
_handleOnChange = text => {
|
||||
_handleOnChange = (text) => {
|
||||
const { onChange, handleIsValid, componentID } = this.props;
|
||||
if (onChange) {
|
||||
onChange(text);
|
||||
@ -62,11 +62,11 @@ export default class TitleAreaView extends Component {
|
||||
})}
|
||||
multiline
|
||||
numberOfLines={4}
|
||||
onContentSizeChange={event => {
|
||||
onContentSizeChange={(event) => {
|
||||
this.setState({ height: event.nativeEvent.contentSize.height });
|
||||
}}
|
||||
autoFocus={autoFocus}
|
||||
onChangeText={textT => this._handleOnChange(textT)}
|
||||
onChangeText={(textT) => this._handleOnChange(textT)}
|
||||
value={text}
|
||||
/>
|
||||
)}
|
||||
|
@ -35,7 +35,7 @@ const FormInputView = ({
|
||||
|
||||
const isIos = Platform.OS === 'ios';
|
||||
|
||||
const _handleOnChange = text => {
|
||||
const _handleOnChange = (text) => {
|
||||
setValue(text);
|
||||
|
||||
if (onChange) {
|
||||
|
@ -19,7 +19,7 @@ const FormattedCurrency = ({
|
||||
);
|
||||
};
|
||||
|
||||
const mapStateToProps = state => ({
|
||||
const mapStateToProps = (state) => ({
|
||||
currency: state.application.currency,
|
||||
});
|
||||
|
||||
|
@ -9,7 +9,7 @@ import { IconButton, PopoverWrapper } from '..';
|
||||
|
||||
const HorizontalIconList = ({ options, optionsKeys }) => {
|
||||
const intl = useIntl();
|
||||
const _getTranslation = id => {
|
||||
const _getTranslation = (id) => {
|
||||
let translation;
|
||||
|
||||
try {
|
||||
@ -26,7 +26,7 @@ const HorizontalIconList = ({ options, optionsKeys }) => {
|
||||
<FlatList
|
||||
style={styles.iconsList}
|
||||
data={optionsKeys}
|
||||
keyExtractor={item => get(item, 'type', Math.random()).toString()}
|
||||
keyExtractor={(item) => get(item, 'type', Math.random()).toString()}
|
||||
horizontal
|
||||
renderItem={({ item }) => (
|
||||
<PopoverWrapper text={_getTranslation(get(options[get(item, 'type')], 'descriptionKey'))}>
|
||||
|
@ -18,7 +18,7 @@ class IconContainer extends PureComponent {
|
||||
}
|
||||
}
|
||||
|
||||
const mapStateToProps = state => ({
|
||||
const mapStateToProps = (state) => ({
|
||||
unreadActivityCount: state.account.currentAccount.unread_activity_count || 0,
|
||||
});
|
||||
|
||||
|
@ -59,7 +59,7 @@ class IconView extends PureComponent {
|
||||
}
|
||||
};
|
||||
|
||||
_getIconWithBadge = badgeCount => {
|
||||
_getIconWithBadge = (badgeCount) => {
|
||||
const { badgeStyle, badgeTextStyle } = this.props;
|
||||
|
||||
return (
|
||||
|
@ -38,7 +38,7 @@ class LeaderboardContainer extends PureComponent {
|
||||
}
|
||||
}
|
||||
|
||||
_handleOnUserPress = username => {
|
||||
_handleOnUserPress = (username) => {
|
||||
const { navigation } = this.props;
|
||||
|
||||
navigation.navigate({
|
||||
@ -91,7 +91,7 @@ class LeaderboardContainer extends PureComponent {
|
||||
}
|
||||
}
|
||||
|
||||
const mapStateToProps = state => ({
|
||||
const mapStateToProps = (state) => ({
|
||||
isConnected: state.application.isConnected,
|
||||
});
|
||||
|
||||
|
@ -44,10 +44,10 @@ class LeaderboardView extends PureComponent {
|
||||
<Fragment>
|
||||
<FilterBar
|
||||
dropdownIconName="arrow-drop-down"
|
||||
options={VALUE.map(val => intl.formatMessage({ id: `leaderboard.${val}` }))}
|
||||
options={VALUE.map((val) => intl.formatMessage({ id: `leaderboard.${val}` }))}
|
||||
selectedOptionIndex={selectedIndex}
|
||||
defaultText={intl.formatMessage({ id: `leaderboard.${VALUE[0]}` })}
|
||||
onDropdownSelect={selectedIndexM =>
|
||||
onDropdownSelect={(selectedIndexM) =>
|
||||
fetchLeaderBoard(FILTER_OPTIONS[selectedIndexM], selectedIndexM)
|
||||
}
|
||||
/>
|
||||
@ -66,7 +66,7 @@ class LeaderboardView extends PureComponent {
|
||||
<FlatList
|
||||
data={users}
|
||||
refreshing={refreshing}
|
||||
keyExtractor={item => get(item, '_id', Math.random()).toString()}
|
||||
keyExtractor={(item) => get(item, '_id', Math.random()).toString()}
|
||||
removeClippedSubviews={false}
|
||||
ListEmptyComponent={<ListPlaceHolder />}
|
||||
onRefresh={() => fetchLeaderBoard()}
|
||||
|
@ -7,7 +7,7 @@ import LOGO from '../../assets/esteem_logo_transparent.png';
|
||||
import styles from './logoStyles';
|
||||
import globalStyles from '../../globalStyles';
|
||||
|
||||
const Logo = props => (
|
||||
const Logo = (props) => (
|
||||
<View style={globalStyles.container}>
|
||||
<Image
|
||||
source={props.source ? props.source : LOGO}
|
||||
|
@ -3,7 +3,7 @@ import regexValidator from './webLinkValidator';
|
||||
export const replaceBetween = (text, selection, what) =>
|
||||
text.substring(0, selection.start) + what + text.substring(selection.end);
|
||||
|
||||
export const isStringWebLink = text => {
|
||||
export const isStringWebLink = (text) => {
|
||||
const pattern = regexValidator;
|
||||
return pattern.test(text);
|
||||
};
|
||||
|
@ -94,7 +94,7 @@ const MarkdownEditorView = ({
|
||||
}, [text]);
|
||||
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
const _changeText = useCallback(input => {
|
||||
const _changeText = useCallback((input) => {
|
||||
setText(input);
|
||||
|
||||
if (onChange) {
|
||||
@ -110,7 +110,7 @@ const MarkdownEditorView = ({
|
||||
}
|
||||
});
|
||||
|
||||
const _handleOnSelectionChange = async event => {
|
||||
const _handleOnSelectionChange = async (event) => {
|
||||
setSelection(event.nativeEvent.selection);
|
||||
};
|
||||
|
||||
@ -202,7 +202,7 @@ const MarkdownEditorView = ({
|
||||
</StickyBar>
|
||||
);
|
||||
|
||||
const _handleClear = index => {
|
||||
const _handleClear = (index) => {
|
||||
if (index === 0) {
|
||||
initialFields();
|
||||
setText('');
|
||||
@ -256,7 +256,7 @@ const MarkdownEditorView = ({
|
||||
}),
|
||||
]}
|
||||
cancelButtonIndex={2}
|
||||
onPress={index => {
|
||||
onPress={(index) => {
|
||||
handleOpenImagePicker(index === 0 ? 'image' : index === 1 && 'camera');
|
||||
}}
|
||||
/>
|
||||
|
@ -43,7 +43,7 @@ class NotificationView extends PureComponent {
|
||||
|
||||
// Component Functions
|
||||
|
||||
_handleOnDropdownSelect = async index => {
|
||||
_handleOnDropdownSelect = async (index) => {
|
||||
const { getActivities, changeSelectedFilter } = this.props;
|
||||
const { filters } = this.state;
|
||||
|
||||
@ -52,7 +52,7 @@ class NotificationView extends PureComponent {
|
||||
getActivities(null, filters[index].key, false);
|
||||
};
|
||||
|
||||
_renderList = data => {
|
||||
_renderList = (data) => {
|
||||
const { navigateToNotificationRoute } = this.props;
|
||||
|
||||
return (
|
||||
@ -60,7 +60,7 @@ class NotificationView extends PureComponent {
|
||||
data={data}
|
||||
initialNumToRender={data && data.length}
|
||||
maxToRenderPerBatch={data && data.length}
|
||||
keyExtractor={item => item.id}
|
||||
keyExtractor={(item) => item.id}
|
||||
renderItem={({ item }) => (
|
||||
<NotificationLine
|
||||
notification={item}
|
||||
@ -123,16 +123,16 @@ class NotificationView extends PureComponent {
|
||||
},
|
||||
];
|
||||
|
||||
notifications.forEach(item => {
|
||||
notifications.forEach((item) => {
|
||||
const listIndex = this._getTimeListIndex(item.timestamp);
|
||||
|
||||
notificationArray[listIndex].notifications.push(item);
|
||||
});
|
||||
|
||||
return notificationArray.filter(item => item.notifications.length > 0);
|
||||
return notificationArray.filter((item) => item.notifications.length > 0);
|
||||
};
|
||||
|
||||
_getTimeListIndex = timestamp => {
|
||||
_getTimeListIndex = (timestamp) => {
|
||||
if (isToday(timestamp)) {
|
||||
return 0;
|
||||
}
|
||||
@ -167,7 +167,7 @@ class NotificationView extends PureComponent {
|
||||
<View style={styles.container}>
|
||||
<FilterBar
|
||||
dropdownIconName="arrow-drop-down"
|
||||
options={filters.map(item =>
|
||||
options={filters.map((item) =>
|
||||
intl.formatMessage({ id: `notification.${item.key}` }).toUpperCase(),
|
||||
)}
|
||||
defaultText="ALL"
|
||||
@ -184,7 +184,7 @@ class NotificationView extends PureComponent {
|
||||
data={_notifications}
|
||||
refreshing={isNotificationRefreshing}
|
||||
onRefresh={() => getActivities()}
|
||||
keyExtractor={item => item.title}
|
||||
keyExtractor={(item) => item.title}
|
||||
onEndReached={() => getActivities(null, selectedFilter, true)}
|
||||
ListFooterComponent={this._renderFooterLoading}
|
||||
ListEmptyComponent={<ListPlaceHolder />}
|
||||
|
@ -9,7 +9,7 @@ import styles from './numericKeyboardStyles';
|
||||
const NumericKeyboard = ({ onPress }) => (
|
||||
<View style={styles.container}>
|
||||
<View style={styles.buttonGroup}>
|
||||
{times(9, i => (
|
||||
{times(9, (i) => (
|
||||
<CircularButton
|
||||
key={i}
|
||||
style={styles.button}
|
||||
@ -24,7 +24,7 @@ const NumericKeyboard = ({ onPress }) => (
|
||||
style={styles.button}
|
||||
text={0}
|
||||
value={0}
|
||||
onPress={value => onPress && onPress(value)}
|
||||
onPress={(value) => onPress && onPress(value)}
|
||||
/>
|
||||
<IconButton
|
||||
onPress={() => onPress && onPress('clear')}
|
||||
|
@ -6,7 +6,7 @@ import { default as ROUTES } from '../../../constants/routeNames';
|
||||
|
||||
import styles from './parentPostStyles';
|
||||
|
||||
const ParentPost = props => {
|
||||
const ParentPost = (props) => {
|
||||
const { navigation, post } = props;
|
||||
|
||||
return (
|
||||
|
@ -28,14 +28,14 @@ class PinAnimatedInput extends Component {
|
||||
this.dots[index].setValue(0);
|
||||
});
|
||||
Animated.sequence([
|
||||
...this.dots.map(item =>
|
||||
...this.dots.map((item) =>
|
||||
Animated.timing(item, {
|
||||
toValue: 1,
|
||||
duration: 250,
|
||||
easing: Easing.linear,
|
||||
}),
|
||||
),
|
||||
]).start(o => {
|
||||
]).start((o) => {
|
||||
if (o.finished) {
|
||||
this._startLoadingAnimation();
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ class BoostPostScreen extends PureComponent {
|
||||
|
||||
// Component Functions
|
||||
|
||||
_handleOnPermlinkChange = async text => {
|
||||
_handleOnPermlinkChange = async (text) => {
|
||||
this.setState({ permlink: text, isValid: false });
|
||||
|
||||
if (this.timer) {
|
||||
@ -61,7 +61,7 @@ class BoostPostScreen extends PureComponent {
|
||||
if (text && text.length > 0) {
|
||||
this.timer = setTimeout(
|
||||
() =>
|
||||
searchPath(text).then(res => {
|
||||
searchPath(text).then((res) => {
|
||||
this.setState({ permlinkSuggestions: res && res.length > 10 ? res.slice(0, 7) : res });
|
||||
}),
|
||||
500,
|
||||
@ -71,7 +71,7 @@ class BoostPostScreen extends PureComponent {
|
||||
}
|
||||
};
|
||||
|
||||
_renderDescription = text => <Text style={styles.description}>{text}</Text>;
|
||||
_renderDescription = (text) => <Text style={styles.description}>{text}</Text>;
|
||||
|
||||
_renderDropdown = (accounts, currentAccountName) => (
|
||||
<DropdownButton
|
||||
@ -80,9 +80,9 @@ class BoostPostScreen extends PureComponent {
|
||||
style={styles.dropdown}
|
||||
dropdownStyle={styles.dropdownStyle}
|
||||
textStyle={styles.dropdownText}
|
||||
options={accounts.map(item => item.username)}
|
||||
options={accounts.map((item) => item.username)}
|
||||
defaultText={currentAccountName}
|
||||
selectedOptionIndex={accounts.findIndex(item => item.username === currentAccountName)}
|
||||
selectedOptionIndex={accounts.findIndex((item) => item.username === currentAccountName)}
|
||||
onSelect={(index, value) => {
|
||||
this.setState({ selectedUser: value }, () => {
|
||||
this._getUserBalance(value);
|
||||
@ -91,13 +91,13 @@ class BoostPostScreen extends PureComponent {
|
||||
/>
|
||||
);
|
||||
|
||||
_getUserBalance = async username => {
|
||||
_getUserBalance = async (username) => {
|
||||
await getUser(username)
|
||||
.then(userPoints => {
|
||||
.then((userPoints) => {
|
||||
const balance = Math.round(get(userPoints, 'points') * 1000) / 1000;
|
||||
this.setState({ balance });
|
||||
})
|
||||
.catch(err => {
|
||||
.catch((err) => {
|
||||
Alert.alert(err.message || err.toString());
|
||||
});
|
||||
};
|
||||
@ -161,7 +161,7 @@ class BoostPostScreen extends PureComponent {
|
||||
renderTextInput={() => (
|
||||
<TextInput
|
||||
style={styles.input}
|
||||
onChangeText={text => this._handleOnPermlinkChange(text)}
|
||||
onChangeText={(text) => this._handleOnPermlinkChange(text)}
|
||||
value={permlink || get(navigationParams, 'permlink', '')}
|
||||
placeholder={intl.formatMessage({ id: 'promote.permlinkPlaceholder' })}
|
||||
placeholderTextColor="#c1c5c7"
|
||||
@ -249,7 +249,7 @@ class BoostPostScreen extends PureComponent {
|
||||
title={intl.formatMessage({ id: 'promote.information' })}
|
||||
cancelButtonIndex={1}
|
||||
destructiveButtonIndex={0}
|
||||
onPress={index => {
|
||||
onPress={(index) => {
|
||||
if (index === 0) {
|
||||
if (index === 0) {
|
||||
this._handleOnSubmit();
|
||||
|
@ -38,7 +38,7 @@ class PostCardContainer extends PureComponent {
|
||||
}
|
||||
};
|
||||
|
||||
_handleOnContentPress = content => {
|
||||
_handleOnContentPress = (content) => {
|
||||
const { navigation } = this.props;
|
||||
|
||||
if (content) {
|
||||
@ -52,7 +52,7 @@ class PostCardContainer extends PureComponent {
|
||||
}
|
||||
};
|
||||
|
||||
_handleOnVotersPress = activeVotes => {
|
||||
_handleOnVotersPress = (activeVotes) => {
|
||||
const { navigation, content } = this.props;
|
||||
|
||||
navigation.navigate({
|
||||
@ -64,7 +64,7 @@ class PostCardContainer extends PureComponent {
|
||||
});
|
||||
};
|
||||
|
||||
_handleOnReblogsPress = reblogs => {
|
||||
_handleOnReblogsPress = (reblogs) => {
|
||||
const { navigation, content } = this.props;
|
||||
|
||||
navigation.navigate({
|
||||
@ -80,7 +80,7 @@ class PostCardContainer extends PureComponent {
|
||||
const { currentAccount, content } = this.props;
|
||||
|
||||
await getPost(get(content, 'author'), get(content, 'permlink'), get(currentAccount, 'username'))
|
||||
.then(result => {
|
||||
.then((result) => {
|
||||
if (result) {
|
||||
this.setState({ _content: result });
|
||||
}
|
||||
@ -115,7 +115,7 @@ class PostCardContainer extends PureComponent {
|
||||
}
|
||||
}
|
||||
|
||||
const mapStateToProps = state => ({
|
||||
const mapStateToProps = (state) => ({
|
||||
currentAccount: state.account.currentAccount,
|
||||
nsfw: state.application.nsfw,
|
||||
});
|
||||
|
@ -54,7 +54,7 @@ class PostDropdownContainer extends PureComponent {
|
||||
};
|
||||
|
||||
// Component Functions
|
||||
_handleOnDropdownSelect = async index => {
|
||||
_handleOnDropdownSelect = async (index) => {
|
||||
const { content, dispatch, intl } = this.props;
|
||||
|
||||
switch (OPTIONS[index]) {
|
||||
@ -153,7 +153,7 @@ class PostDropdownContainer extends PureComponent {
|
||||
),
|
||||
);
|
||||
})
|
||||
.catch(error => {
|
||||
.catch((error) => {
|
||||
console.log(error);
|
||||
if (String(get(error, 'jse_shortmsg', '')).indexOf('has already reblogged') > -1) {
|
||||
dispatch(
|
||||
@ -245,18 +245,18 @@ class PostDropdownContainer extends PureComponent {
|
||||
return (
|
||||
<Fragment>
|
||||
<PostDropdownView
|
||||
options={_OPTIONS.map(item =>
|
||||
options={_OPTIONS.map((item) =>
|
||||
intl.formatMessage({ id: `post_dropdown.${item}` }).toUpperCase(),
|
||||
)}
|
||||
handleOnDropdownSelect={this._handleOnDropdownSelect}
|
||||
{...this.props}
|
||||
/>
|
||||
<ActionSheet
|
||||
ref={o => (this.ActionSheet = o)}
|
||||
ref={(o) => (this.ActionSheet = o)}
|
||||
options={['Reblog', intl.formatMessage({ id: 'alert.cancel' })]}
|
||||
title={intl.formatMessage({ id: 'post.reblog_alert' })}
|
||||
cancelButtonIndex={1}
|
||||
onPress={index => {
|
||||
onPress={(index) => {
|
||||
index === 0 ? this._reblog() : null;
|
||||
}}
|
||||
/>
|
||||
@ -265,7 +265,7 @@ class PostDropdownContainer extends PureComponent {
|
||||
}
|
||||
}
|
||||
|
||||
const mapStateToProps = state => ({
|
||||
const mapStateToProps = (state) => ({
|
||||
isLoggedIn: state.application.isLoggedIn,
|
||||
currentAccount: state.account.currentAccount,
|
||||
pinCode: state.application.pin,
|
||||
|
@ -54,7 +54,7 @@ const CommentBody = ({
|
||||
setRevealComment(true);
|
||||
};
|
||||
//new renderer functions
|
||||
const __handleOnLinkPress = event => {
|
||||
const __handleOnLinkPress = (event) => {
|
||||
if ((!event && !get(event, 'nativeEvent.data'), false)) {
|
||||
return;
|
||||
}
|
||||
@ -123,7 +123,7 @@ const CommentBody = ({
|
||||
} catch (error) {}
|
||||
};
|
||||
|
||||
const handleImagePress = ind => {
|
||||
const handleImagePress = (ind) => {
|
||||
if (ind === 1) {
|
||||
//open gallery mode
|
||||
setIsImageModalOpen(true);
|
||||
@ -146,10 +146,10 @@ const CommentBody = ({
|
||||
}
|
||||
};
|
||||
|
||||
const handleLinkPress = ind => {
|
||||
const handleLinkPress = (ind) => {
|
||||
if (ind === 1) {
|
||||
//open link
|
||||
Linking.canOpenURL(selectedLink).then(supported => {
|
||||
Linking.canOpenURL(selectedLink).then((supported) => {
|
||||
if (supported) {
|
||||
Linking.openURL(selectedLink);
|
||||
} else {
|
||||
@ -177,7 +177,7 @@ const CommentBody = ({
|
||||
}
|
||||
};
|
||||
|
||||
const __handleTagPress = tag => {
|
||||
const __handleTagPress = (tag) => {
|
||||
if (tag) {
|
||||
navigate({
|
||||
routeName: ROUTES.SCREENS.SEARCH_RESULT,
|
||||
@ -201,7 +201,7 @@ const CommentBody = ({
|
||||
}
|
||||
};
|
||||
|
||||
const __handleOnUserPress = username => {
|
||||
const __handleOnUserPress = (username) => {
|
||||
if (username) {
|
||||
navigate({
|
||||
routeName: ROUTES.SCREENS.PROFILE,
|
||||
@ -231,13 +231,13 @@ const CommentBody = ({
|
||||
}
|
||||
};
|
||||
|
||||
const _downloadImage = async uri => {
|
||||
const _downloadImage = async (uri) => {
|
||||
return RNFetchBlob.config({
|
||||
fileCache: true,
|
||||
appendExt: 'jpg',
|
||||
})
|
||||
.fetch('GET', uri)
|
||||
.then(res => {
|
||||
.then((res) => {
|
||||
let status = res.info().status;
|
||||
|
||||
if (status == 200) {
|
||||
@ -246,19 +246,19 @@ const CommentBody = ({
|
||||
Promise.reject();
|
||||
}
|
||||
})
|
||||
.catch(errorMessage => {
|
||||
.catch((errorMessage) => {
|
||||
Promise.reject(errorMessage);
|
||||
});
|
||||
};
|
||||
|
||||
const _saveImage = async uri => {
|
||||
const _saveImage = async (uri) => {
|
||||
try {
|
||||
if (Platform.OS === 'android') {
|
||||
await checkAndroidPermission();
|
||||
uri = `file://${await _downloadImage(uri)}`;
|
||||
}
|
||||
CameraRoll.saveToCameraRoll(uri)
|
||||
.then(res => {
|
||||
.then((res) => {
|
||||
dispatch(
|
||||
toastNotification(
|
||||
intl.formatMessage({
|
||||
@ -267,7 +267,7 @@ const CommentBody = ({
|
||||
),
|
||||
);
|
||||
})
|
||||
.catch(error => {
|
||||
.catch((error) => {
|
||||
dispatch(
|
||||
toastNotification(
|
||||
intl.formatMessage({
|
||||
@ -437,7 +437,7 @@ const CommentBody = ({
|
||||
]}
|
||||
title={intl.formatMessage({ id: 'post.image' })}
|
||||
cancelButtonIndex={3}
|
||||
onPress={index => {
|
||||
onPress={(index) => {
|
||||
handleImagePress(index);
|
||||
}}
|
||||
/>
|
||||
@ -450,7 +450,7 @@ const CommentBody = ({
|
||||
]}
|
||||
title={intl.formatMessage({ id: 'post.link' })}
|
||||
cancelButtonIndex={2}
|
||||
onPress={index => {
|
||||
onPress={(index) => {
|
||||
handleLinkPress(index);
|
||||
}}
|
||||
/>
|
||||
@ -484,6 +484,6 @@ const CommentBody = ({
|
||||
|
||||
const areEqual = (prevProps, nextProps) => prevProps.body !== nextProps.body;
|
||||
|
||||
const mapStateToProps = state => ({});
|
||||
const mapStateToProps = (state) => ({});
|
||||
|
||||
export default connect(mapStateToProps)(React.memo(CommentBody, areEqual));
|
||||
|
@ -41,7 +41,7 @@ const PostBody = ({
|
||||
const actionImage = useRef(null);
|
||||
const actionLink = useRef(null);
|
||||
|
||||
const _handleOnLinkPress = event => {
|
||||
const _handleOnLinkPress = (event) => {
|
||||
if ((!event && !get(event, 'nativeEvent.data'), false)) {
|
||||
return;
|
||||
}
|
||||
@ -109,7 +109,7 @@ const PostBody = ({
|
||||
} catch (error) {}
|
||||
};
|
||||
|
||||
const handleImagePress = ind => {
|
||||
const handleImagePress = (ind) => {
|
||||
if (ind === 1) {
|
||||
//open gallery mode
|
||||
setIsImageModalOpen(true);
|
||||
@ -132,10 +132,10 @@ const PostBody = ({
|
||||
}
|
||||
};
|
||||
|
||||
const handleLinkPress = ind => {
|
||||
const handleLinkPress = (ind) => {
|
||||
if (ind === 1) {
|
||||
//open link
|
||||
Linking.canOpenURL(selectedLink).then(supported => {
|
||||
Linking.canOpenURL(selectedLink).then((supported) => {
|
||||
if (supported) {
|
||||
Linking.openURL(selectedLink);
|
||||
} else {
|
||||
@ -163,7 +163,7 @@ const PostBody = ({
|
||||
}
|
||||
};
|
||||
|
||||
const _handleTagPress = tag => {
|
||||
const _handleTagPress = (tag) => {
|
||||
if (tag) {
|
||||
navigation.navigate({
|
||||
routeName: ROUTES.SCREENS.SEARCH_RESULT,
|
||||
@ -187,7 +187,7 @@ const PostBody = ({
|
||||
}
|
||||
};
|
||||
|
||||
const _handleOnUserPress = username => {
|
||||
const _handleOnUserPress = (username) => {
|
||||
if (username) {
|
||||
navigation.navigate({
|
||||
routeName: ROUTES.SCREENS.PROFILE,
|
||||
@ -217,13 +217,13 @@ const PostBody = ({
|
||||
}
|
||||
};
|
||||
|
||||
const _downloadImage = async uri => {
|
||||
const _downloadImage = async (uri) => {
|
||||
return RNFetchBlob.config({
|
||||
fileCache: true,
|
||||
appendExt: 'jpg',
|
||||
})
|
||||
.fetch('GET', uri)
|
||||
.then(res => {
|
||||
.then((res) => {
|
||||
let status = res.info().status;
|
||||
|
||||
if (status == 200) {
|
||||
@ -232,19 +232,19 @@ const PostBody = ({
|
||||
Promise.reject();
|
||||
}
|
||||
})
|
||||
.catch(errorMessage => {
|
||||
.catch((errorMessage) => {
|
||||
Promise.reject(errorMessage);
|
||||
});
|
||||
};
|
||||
|
||||
const _saveImage = async uri => {
|
||||
const _saveImage = async (uri) => {
|
||||
try {
|
||||
if (Platform.OS === 'android') {
|
||||
await checkAndroidPermission();
|
||||
uri = `file://${await _downloadImage(uri)}`;
|
||||
}
|
||||
CameraRoll.saveToCameraRoll(uri)
|
||||
.then(res => {
|
||||
.then((res) => {
|
||||
dispatch(
|
||||
toastNotification(
|
||||
intl.formatMessage({
|
||||
@ -253,7 +253,7 @@ const PostBody = ({
|
||||
),
|
||||
);
|
||||
})
|
||||
.catch(error => {
|
||||
.catch((error) => {
|
||||
dispatch(
|
||||
toastNotification(
|
||||
intl.formatMessage({
|
||||
@ -422,7 +422,7 @@ const PostBody = ({
|
||||
]}
|
||||
title={intl.formatMessage({ id: 'post.image' })}
|
||||
cancelButtonIndex={3}
|
||||
onPress={index => {
|
||||
onPress={(index) => {
|
||||
handleImagePress(index);
|
||||
}}
|
||||
/>
|
||||
@ -435,7 +435,7 @@ const PostBody = ({
|
||||
]}
|
||||
title={intl.formatMessage({ id: 'post.link' })}
|
||||
cancelButtonIndex={2}
|
||||
onPress={index => {
|
||||
onPress={(index) => {
|
||||
handleLinkPress(index);
|
||||
}}
|
||||
/>
|
||||
@ -464,6 +464,6 @@ const areEqual = (prevProps, nextProps) => {
|
||||
return false;
|
||||
};
|
||||
|
||||
const mapStateToProps = state => ({});
|
||||
const mapStateToProps = (state) => ({});
|
||||
|
||||
export default React.memo(injectIntl(withNavigation(connect(mapStateToProps)(PostBody))), areEqual);
|
||||
|
@ -19,7 +19,7 @@ class PostHeaderDescription extends PureComponent {
|
||||
// Component Life Cycles
|
||||
|
||||
// Component Functions
|
||||
_handleOnUserPress = username => {
|
||||
_handleOnUserPress = (username) => {
|
||||
const { navigation, profileOnPress, reputation, currentAccountUsername } = this.props;
|
||||
|
||||
if (currentAccountUsername !== username) {
|
||||
|
@ -31,7 +31,7 @@ class TagsView extends PureComponent {
|
||||
<Tag key={index} value={item} isPin={index === 0} onPress={handleOnTagPress} />
|
||||
</View>
|
||||
)}
|
||||
keyExtractor={item => item}
|
||||
keyExtractor={(item) => item}
|
||||
/>
|
||||
</View>
|
||||
);
|
||||
|
@ -28,11 +28,12 @@ class PostFormView extends PureComponent {
|
||||
|
||||
return (
|
||||
<Fragment>
|
||||
{React.Children.map(children, child => {
|
||||
{React.Children.map(children, (child) => {
|
||||
if (child) {
|
||||
return React.cloneElement(child, {
|
||||
onSubmitEditing: item => this._handleOnSubmitEditing(child.props.returnKeyType, item),
|
||||
onChange: value => this._handleOnChange(child.props.componentID, value),
|
||||
onSubmitEditing: (item) =>
|
||||
this._handleOnSubmitEditing(child.props.returnKeyType, item),
|
||||
onChange: (value) => this._handleOnChange(child.props.componentID, value),
|
||||
returnKeyType: isFormValid ? 'done' : 'next',
|
||||
isPreviewActive,
|
||||
});
|
||||
|
@ -78,7 +78,7 @@ const PostListItemView = ({
|
||||
title={intl.formatMessage({ id: 'alert.remove_alert' })}
|
||||
cancelButtonIndex={1}
|
||||
destructiveButtonIndex={0}
|
||||
onPress={index => {
|
||||
onPress={(index) => {
|
||||
if (index === 0) {
|
||||
handleOnRemoveItem(id);
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ const PostDisplayContainer = ({
|
||||
author,
|
||||
}) => {
|
||||
// Component Functions
|
||||
const _handleOnVotersPress = activeVotes => {
|
||||
const _handleOnVotersPress = (activeVotes) => {
|
||||
navigation.navigate({
|
||||
routeName: ROUTES.SCREENS.VOTERS,
|
||||
params: {
|
||||
@ -44,7 +44,7 @@ const PostDisplayContainer = ({
|
||||
});
|
||||
};
|
||||
|
||||
const _handleOnReblogsPress = reblogs => {
|
||||
const _handleOnReblogsPress = (reblogs) => {
|
||||
if (reblogs.length > 0) {
|
||||
navigation.navigate({
|
||||
routeName: ROUTES.SCREENS.REBLOGS,
|
||||
@ -83,7 +83,7 @@ const PostDisplayContainer = ({
|
||||
}
|
||||
};
|
||||
|
||||
const _handleDeleteComment = permlink => {
|
||||
const _handleDeleteComment = (permlink) => {
|
||||
deleteComment(currentAccount, pinCode, permlink).then(() => {
|
||||
navigation.goBack();
|
||||
dispatch(
|
||||
@ -125,7 +125,7 @@ const PostDisplayContainer = ({
|
||||
);
|
||||
};
|
||||
|
||||
const mapStateToProps = state => ({
|
||||
const mapStateToProps = (state) => ({
|
||||
currentAccount: state.account.currentAccount,
|
||||
pinCode: state.application.pin,
|
||||
isLoggedIn: state.application.isLoggedIn,
|
||||
|
@ -58,13 +58,13 @@ const PostDisplayView = ({
|
||||
fetchPost().then(() => setRefreshing(false));
|
||||
}, [refreshing]);
|
||||
|
||||
const _handleOnScroll = event => {
|
||||
const _handleOnScroll = (event) => {
|
||||
const { y } = event.nativeEvent.contentOffset;
|
||||
|
||||
setScrollHeight(HEIGHT + y);
|
||||
};
|
||||
|
||||
const _handleOnPostLayout = event => {
|
||||
const _handleOnPostLayout = (event) => {
|
||||
const { height } = event.nativeEvent.layout;
|
||||
|
||||
setPostHeight(height);
|
||||
@ -168,7 +168,7 @@ const PostDisplayView = ({
|
||||
<View style={styles.container}>
|
||||
<ScrollView
|
||||
style={styles.scroll}
|
||||
onScroll={event => _handleOnScroll(event)}
|
||||
onScroll={(event) => _handleOnScroll(event)}
|
||||
scrollEventThrottle={16}
|
||||
refreshControl={<RefreshControl refreshing={refreshing} onRefresh={onRefresh} />}
|
||||
>
|
||||
@ -178,7 +178,7 @@ const PostDisplayView = ({
|
||||
{!post ? (
|
||||
<PostPlaceHolder />
|
||||
) : (
|
||||
<View onLayout={event => _handleOnPostLayout(event)}>
|
||||
<View onLayout={(event) => _handleOnPostLayout(event)}>
|
||||
{!!post.title && <Text style={styles.title}>{post.title}</Text>}
|
||||
<PostHeaderDescription
|
||||
date={formatedTime}
|
||||
@ -221,7 +221,7 @@ const PostDisplayView = ({
|
||||
]}
|
||||
title={intl.formatMessage({ id: 'alert.remove_alert' })}
|
||||
cancelButtonIndex={1}
|
||||
onPress={index => (index === 0 ? handleOnRemovePress(get(post, 'permlink')) : null)}
|
||||
onPress={(index) => (index === 0 ? handleOnRemovePress(get(post, 'permlink')) : null)}
|
||||
/>
|
||||
</View>
|
||||
);
|
||||
|
@ -29,7 +29,7 @@ const PostsContainer = ({
|
||||
}) => {
|
||||
const dispatch = useDispatch();
|
||||
|
||||
const _setFeedPosts = posts => {
|
||||
const _setFeedPosts = (posts) => {
|
||||
dispatch(setFeedPosts(posts));
|
||||
};
|
||||
|
||||
@ -67,7 +67,7 @@ const PostsContainer = ({
|
||||
);
|
||||
};
|
||||
|
||||
const mapStateToProps = state => ({
|
||||
const mapStateToProps = (state) => ({
|
||||
nsfw: state.application.nsfw,
|
||||
feedPosts: state.posts.feedPosts,
|
||||
isConnected: state.application.isConnected,
|
||||
|
@ -114,7 +114,7 @@ const PostsView = ({
|
||||
startPermlink,
|
||||
]);
|
||||
|
||||
const _handleOnDropdownSelect = async index => {
|
||||
const _handleOnDropdownSelect = async (index) => {
|
||||
if (index === selectedFilterIndex) {
|
||||
_scrollTop();
|
||||
} else {
|
||||
@ -132,16 +132,16 @@ const PostsView = ({
|
||||
|
||||
const _getPromotePosts = useCallback(async () => {
|
||||
await getPromotePosts()
|
||||
.then(async res => {
|
||||
.then(async (res) => {
|
||||
if (res && res.length) {
|
||||
const _promotedPosts = await Promise.all(
|
||||
res.map(item =>
|
||||
res.map((item) =>
|
||||
getPost(
|
||||
get(item, 'author'),
|
||||
get(item, 'permlink'),
|
||||
currentAccountUsername,
|
||||
true,
|
||||
).then(post => post),
|
||||
).then((post) => post),
|
||||
),
|
||||
);
|
||||
|
||||
@ -152,7 +152,7 @@ const PostsView = ({
|
||||
}, [currentAccountUsername]);
|
||||
|
||||
const _loadPosts = useCallback(
|
||||
type => {
|
||||
(type) => {
|
||||
if (
|
||||
isLoading ||
|
||||
!isConnected ||
|
||||
@ -193,7 +193,7 @@ const PostsView = ({
|
||||
}
|
||||
|
||||
getPostsSummary(filter, options, currentAccountUsername, nsfw)
|
||||
.then(result => {
|
||||
.then((result) => {
|
||||
if (result.length > 0) {
|
||||
let _posts = result;
|
||||
|
||||
@ -338,7 +338,7 @@ const PostsView = ({
|
||||
{filterOptions && (
|
||||
<FilterBar
|
||||
dropdownIconName="arrow-drop-down"
|
||||
options={filterOptions.map(item =>
|
||||
options={filterOptions.map((item) =>
|
||||
intl.formatMessage({ id: `home.${item.toLowerCase()}` }).toUpperCase(),
|
||||
)}
|
||||
selectedOptionIndex={selectedFilterIndex}
|
||||
@ -362,7 +362,7 @@ const PostsView = ({
|
||||
const p = promotedPosts[ix];
|
||||
if (
|
||||
get(p, 'author', null) &&
|
||||
posts.filter(x => x.permlink === p.permlink).length <= 0
|
||||
posts.filter((x) => x.permlink === p.permlink).length <= 0
|
||||
) {
|
||||
e.push(
|
||||
<PostCard
|
||||
|
@ -40,7 +40,7 @@ const ProductItemLineView = ({ disabled, handleOnButtonPress, product, title })
|
||||
);
|
||||
};
|
||||
|
||||
const _renderDeal = item => {
|
||||
const _renderDeal = (item) => {
|
||||
if (DEALS[item.productId]) {
|
||||
return (
|
||||
<View style={styles.descriptionWrapper}>
|
||||
|
@ -62,7 +62,7 @@ class ProfileView extends PureComponent {
|
||||
}
|
||||
};
|
||||
|
||||
_handleUIChange = height => {
|
||||
_handleUIChange = (height) => {
|
||||
this.setState({ collapsibleMoreHeight: height });
|
||||
};
|
||||
|
||||
@ -254,7 +254,7 @@ class ProfileView extends PureComponent {
|
||||
>
|
||||
{selectedUser ? (
|
||||
<Wallet
|
||||
setEstimatedWalletValue={value =>
|
||||
setEstimatedWalletValue={(value) =>
|
||||
this.setState({ estimatedWalletValue: value })
|
||||
}
|
||||
selectedUser={selectedUser}
|
||||
|
@ -62,7 +62,7 @@ const ProfileEditFormView = ({
|
||||
/>
|
||||
</TouchableOpacity>
|
||||
|
||||
{formData.map(item => (
|
||||
{formData.map((item) => (
|
||||
<View style={styles.formItem} key={item.valueKey}>
|
||||
<Text style={styles.label}>
|
||||
{intl.formatMessage({
|
||||
@ -73,7 +73,7 @@ const ProfileEditFormView = ({
|
||||
wrapperStyle={styles.formStyle}
|
||||
isValid
|
||||
height={40}
|
||||
onChange={value => handleOnItemChange(value, item.valueKey)}
|
||||
onChange={(value) => handleOnItemChange(value, item.valueKey)}
|
||||
placeholder={item.placeholder}
|
||||
isEditable
|
||||
type="none"
|
||||
|
@ -45,13 +45,13 @@ class ProfileSummaryView extends PureComponent {
|
||||
// Component Life Cycles
|
||||
|
||||
// Component Functions
|
||||
_handleOnPressLink = url => {
|
||||
_handleOnPressLink = (url) => {
|
||||
if (url) {
|
||||
Linking.openURL(url);
|
||||
}
|
||||
};
|
||||
|
||||
_handleOnDropdownSelect = index => {
|
||||
_handleOnDropdownSelect = (index) => {
|
||||
const { isMuted, handleMuteUnmuteUser } = this.props;
|
||||
|
||||
// This funciton should have switch case but now only has one option therefor
|
||||
@ -120,7 +120,7 @@ class ProfileSummaryView extends PureComponent {
|
||||
return (
|
||||
<Fragment>
|
||||
<View style={[isColumn ? styles.textWithIconWrapperColumn : styles.textWithIconWrapper]}>
|
||||
{ABOUT_DATA.map(item =>
|
||||
{ABOUT_DATA.map((item) =>
|
||||
get(item, 'text', null) ? (
|
||||
<TextWithIcon
|
||||
isClickable={get(item, 'onPress')}
|
||||
|
@ -48,7 +48,7 @@ class PromoteView extends PureComponent {
|
||||
|
||||
// Component Functions
|
||||
|
||||
_handleOnPermlinkChange = async text => {
|
||||
_handleOnPermlinkChange = async (text) => {
|
||||
this.setState({ permlink: text, isValid: false });
|
||||
|
||||
if (this.timer) {
|
||||
@ -63,7 +63,7 @@ class PromoteView extends PureComponent {
|
||||
if (text && text.length > 0) {
|
||||
this.timer = setTimeout(
|
||||
() =>
|
||||
searchPath(text).then(res => {
|
||||
searchPath(text).then((res) => {
|
||||
this.setState({ permlinkSuggestions: res && res.length > 10 ? res.slice(0, 7) : res });
|
||||
}),
|
||||
500,
|
||||
@ -73,7 +73,7 @@ class PromoteView extends PureComponent {
|
||||
}
|
||||
};
|
||||
|
||||
_renderDescription = text => <Text style={styles.description}>{text}</Text>;
|
||||
_renderDescription = (text) => <Text style={styles.description}>{text}</Text>;
|
||||
|
||||
_renderDropdown = (accounts, currentAccountName) => (
|
||||
<DropdownButton
|
||||
@ -82,9 +82,9 @@ class PromoteView extends PureComponent {
|
||||
style={styles.dropdown}
|
||||
dropdownStyle={styles.dropdownStyle}
|
||||
textStyle={styles.dropdownText}
|
||||
options={accounts.map(item => item.username)}
|
||||
options={accounts.map((item) => item.username)}
|
||||
defaultText={currentAccountName}
|
||||
selectedOptionIndex={accounts.findIndex(item => item.username === currentAccountName)}
|
||||
selectedOptionIndex={accounts.findIndex((item) => item.username === currentAccountName)}
|
||||
onSelect={(index, value) => {
|
||||
this.setState({ selectedUser: value }, () => {
|
||||
this._getUserBalance(value);
|
||||
@ -93,13 +93,13 @@ class PromoteView extends PureComponent {
|
||||
/>
|
||||
);
|
||||
|
||||
_getUserBalance = async username => {
|
||||
_getUserBalance = async (username) => {
|
||||
await getUser(username)
|
||||
.then(userPoints => {
|
||||
.then((userPoints) => {
|
||||
const balance = Math.round(get(userPoints, 'points') * 1000) / 1000;
|
||||
this.setState({ balance });
|
||||
})
|
||||
.catch(err => {
|
||||
.catch((err) => {
|
||||
Alert.alert(err.message || err.toString());
|
||||
});
|
||||
};
|
||||
@ -155,11 +155,11 @@ class PromoteView extends PureComponent {
|
||||
data={permlinkSuggestions}
|
||||
listContainerStyle={styles.autocomplateListContainer}
|
||||
listStyle={styles.autocomplateList}
|
||||
onChangeText={text => this._handleOnPermlinkChange(text)}
|
||||
onChangeText={(text) => this._handleOnPermlinkChange(text)}
|
||||
renderTextInput={() => (
|
||||
<TextInput
|
||||
style={styles.input}
|
||||
onChangeText={text => this._handleOnPermlinkChange(text)}
|
||||
onChangeText={(text) => this._handleOnPermlinkChange(text)}
|
||||
value={permlink || get(navigationParams, 'permlink', '')}
|
||||
placeholder={intl.formatMessage({ id: 'promote.permlink' })}
|
||||
placeholderTextColor="#c1c5c7"
|
||||
@ -199,7 +199,7 @@ class PromoteView extends PureComponent {
|
||||
values={[1, 2, 3, 7, 14]}
|
||||
LRpadding={50}
|
||||
activeValue={day}
|
||||
handleOnValueChange={_day => this.setState({ day: _day })}
|
||||
handleOnValueChange={(_day) => this.setState({ day: _day })}
|
||||
single
|
||||
/>
|
||||
</View>
|
||||
@ -227,7 +227,7 @@ class PromoteView extends PureComponent {
|
||||
title={intl.formatMessage({ id: 'promote.information' })}
|
||||
cancelButtonIndex={1}
|
||||
destructiveButtonIndex={0}
|
||||
onPress={index => {
|
||||
onPress={(index) => {
|
||||
if (index === 0) {
|
||||
this._handleOnSubmit();
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ export default class ScaleSliderView extends Component {
|
||||
|
||||
_renderMarker = () => <View style={styles.marker} />;
|
||||
|
||||
_valueChange = _values => {
|
||||
_valueChange = (_values) => {
|
||||
const { handleOnValueChange, values } = this.props;
|
||||
const index = _values[0] - 1;
|
||||
|
||||
|
@ -27,7 +27,7 @@ const SearchInputView = ({
|
||||
<Icon style={styles.icon} iconType="FontAwesome" name="search" size={15} />
|
||||
<TextInput
|
||||
style={styles.input}
|
||||
onChangeText={text => onChangeText && onChangeText(text)}
|
||||
onChangeText={(text) => onChangeText && onChangeText(text)}
|
||||
placeholder={placeholder}
|
||||
placeholderTextColor="#c1c5c7"
|
||||
autoCapitalize="none"
|
||||
|
@ -37,7 +37,7 @@ const SearchModalContainer = ({
|
||||
navigation.goBack();
|
||||
};
|
||||
|
||||
const _handleOnChangeSearchInput = text => {
|
||||
const _handleOnChangeSearchInput = (text) => {
|
||||
if (text && text.length < 2) {
|
||||
return;
|
||||
}
|
||||
@ -46,9 +46,9 @@ const SearchModalContainer = ({
|
||||
}
|
||||
if (text && text !== '@' && text !== '#') {
|
||||
if (text[0] === '@') {
|
||||
lookupAccounts(text.substr(1).trim()).then(res => {
|
||||
lookupAccounts(text.substr(1).trim()).then((res) => {
|
||||
const users = res
|
||||
? res.map(item => ({
|
||||
? res.map((item) => ({
|
||||
image: getResizedAvatar(item),
|
||||
text: item,
|
||||
...item,
|
||||
@ -57,9 +57,9 @@ const SearchModalContainer = ({
|
||||
setSearchResults({ type: 'user', data: users });
|
||||
});
|
||||
} else if (text[0] === '#') {
|
||||
getTrendingTags(text.substr(1).trim()).then(res => {
|
||||
getTrendingTags(text.substr(1).trim()).then((res) => {
|
||||
const tags = res
|
||||
? res.map(item => ({
|
||||
? res.map((item) => ({
|
||||
text: `#${get(item, 'name', '')}`,
|
||||
...item,
|
||||
}))
|
||||
@ -75,7 +75,7 @@ const SearchModalContainer = ({
|
||||
|
||||
if (author) {
|
||||
if (permlink) {
|
||||
getPurePost(author, permlink).then(post => {
|
||||
getPurePost(author, permlink).then((post) => {
|
||||
if (post.id !== 0) {
|
||||
const result = {};
|
||||
let metadata = {};
|
||||
@ -98,8 +98,8 @@ const SearchModalContainer = ({
|
||||
}
|
||||
});
|
||||
} else {
|
||||
lookupAccounts(author).then(res => {
|
||||
const users = res.map(item => ({
|
||||
lookupAccounts(author).then((res) => {
|
||||
const users = res.map((item) => ({
|
||||
image: getResizedAvatar(item),
|
||||
text: item,
|
||||
...item,
|
||||
@ -137,10 +137,10 @@ const SearchModalContainer = ({
|
||||
}
|
||||
}
|
||||
} else {
|
||||
search({ q: text }).then(res => {
|
||||
search({ q: text }).then((res) => {
|
||||
res.results = res.results
|
||||
.filter(item => item.title !== '')
|
||||
.map(item => ({
|
||||
.filter((item) => item.title !== '')
|
||||
.map((item) => ({
|
||||
image: item.img_url || getResizedAvatar(get(item, 'author')),
|
||||
text: item.title,
|
||||
...item,
|
||||
@ -222,7 +222,7 @@ const SearchModalContainer = ({
|
||||
);
|
||||
};
|
||||
|
||||
const mapStateToProps = state => ({
|
||||
const mapStateToProps = (state) => ({
|
||||
username: state.account.currentAccount.name,
|
||||
isConnected: state.application.isConnected,
|
||||
});
|
||||
|
@ -50,7 +50,7 @@ class SettingsItemView extends PureComponent {
|
||||
dropdownStyle={styles.dropdownStyle}
|
||||
textStyle={styles.dropdownText}
|
||||
options={options}
|
||||
onSelect={e => handleOnChange(e, type, actionType)}
|
||||
onSelect={(e) => handleOnChange(e, type, actionType)}
|
||||
/>
|
||||
);
|
||||
|
||||
@ -59,7 +59,7 @@ class SettingsItemView extends PureComponent {
|
||||
<ToggleSwitch
|
||||
size="large"
|
||||
isOn={isOn}
|
||||
onToggle={e => handleOnChange(e, type, actionType)}
|
||||
onToggle={(e) => handleOnChange(e, type, actionType)}
|
||||
/>
|
||||
);
|
||||
case 'button':
|
||||
|
@ -30,11 +30,11 @@ class SideMenuContainer extends Component {
|
||||
|
||||
// Component Life Cycle Functions
|
||||
|
||||
_createUserList = otherAccounts => {
|
||||
_createUserList = (otherAccounts) => {
|
||||
const { currentAccount } = this.props;
|
||||
|
||||
const accounts = [];
|
||||
otherAccounts.forEach(element => {
|
||||
otherAccounts.forEach((element) => {
|
||||
if (element.username !== currentAccount.name) {
|
||||
accounts.push({
|
||||
name: `@${element.username}`,
|
||||
@ -65,7 +65,7 @@ class SideMenuContainer extends Component {
|
||||
const { dispatch, currentAccount, navigation } = this.props;
|
||||
|
||||
if (anchor !== currentAccount.name) {
|
||||
switchAccount(anchor).then(async accountData => {
|
||||
switchAccount(anchor).then(async (accountData) => {
|
||||
const realmData = await getUserDataWithUsername(anchor);
|
||||
const _currentAccount = accountData;
|
||||
|
||||
@ -111,7 +111,7 @@ class SideMenuContainer extends Component {
|
||||
}
|
||||
}
|
||||
|
||||
const mapStateToProps = state => ({
|
||||
const mapStateToProps = (state) => ({
|
||||
isLoggedIn: state.application.isLoggedIn,
|
||||
currentAccount: state.account.currentAccount,
|
||||
otherAccounts: state.account.otherAccounts,
|
||||
|
@ -40,7 +40,7 @@ const SideMenuView = ({
|
||||
// Component Life Cycles
|
||||
useEffect(() => {
|
||||
let _isMounted = false;
|
||||
getStorageType().then(item => {
|
||||
getStorageType().then((item) => {
|
||||
if (!_isMounted) {
|
||||
setStorageT(item);
|
||||
}
|
||||
@ -62,7 +62,7 @@ const SideMenuView = ({
|
||||
setIsAddAccountIconActive(!isAddAccountIconActive);
|
||||
};
|
||||
|
||||
const _handleOnMenuItemPress = item => {
|
||||
const _handleOnMenuItemPress = (item) => {
|
||||
if (item.id === 'logout') {
|
||||
ActionSheetRef.current.show();
|
||||
return;
|
||||
@ -121,8 +121,8 @@ const SideMenuView = ({
|
||||
<View style={styles.contentView}>
|
||||
<FlatList
|
||||
data={menuItems}
|
||||
keyExtractor={item => item.id}
|
||||
renderItem={item => (
|
||||
keyExtractor={(item) => item.id}
|
||||
renderItem={(item) => (
|
||||
<TouchableOpacity
|
||||
style={styles.listItem}
|
||||
onPress={() => {
|
||||
@ -166,7 +166,7 @@ const SideMenuView = ({
|
||||
title={intl.formatMessage({ id: 'side_menu.logout_text' })}
|
||||
cancelButtonIndex={1}
|
||||
destructiveButtonIndex={0}
|
||||
onPress={index => {
|
||||
onPress={(index) => {
|
||||
index === 0 ? handleLogout() : null;
|
||||
}}
|
||||
/>
|
||||
|
@ -86,13 +86,13 @@ const SpinGameView = ({
|
||||
/>
|
||||
) : (
|
||||
<Fragment>
|
||||
{spinProduct.map(product => (
|
||||
{spinProduct.map((product) => (
|
||||
<ProductItemLine
|
||||
key={`key-${get(product, 'productId').toString()}`}
|
||||
product={product}
|
||||
title={intl.formatMessage({ id: 'free_estm.get_spin' })}
|
||||
disabled={isProcessing}
|
||||
handleOnButtonPress={id => buyItem(id)}
|
||||
handleOnButtonPress={(id) => buyItem(id)}
|
||||
/>
|
||||
))}
|
||||
<Text style={styles.nextDate}>
|
||||
|
@ -83,7 +83,7 @@ class TabBar extends PureComponent {
|
||||
outputRange: [0, containerWidth / numberOfTabs],
|
||||
});
|
||||
|
||||
const scaleValue = defaultScale => {
|
||||
const scaleValue = (defaultScale) => {
|
||||
const number = 4;
|
||||
const arr = new Array(number * 2);
|
||||
|
||||
@ -127,7 +127,7 @@ class TabBar extends PureComponent {
|
||||
}
|
||||
}
|
||||
|
||||
const ButtonAndroid = props => (
|
||||
const ButtonAndroid = (props) => (
|
||||
<TouchableNativeFeedback
|
||||
delayPressIn={0}
|
||||
background={TouchableNativeFeedback.SelectableBackground()}
|
||||
@ -137,9 +137,9 @@ const ButtonAndroid = props => (
|
||||
</TouchableNativeFeedback>
|
||||
);
|
||||
|
||||
const ButtonIos = props => <TouchableOpacity {...props}>{props.children}</TouchableOpacity>;
|
||||
const ButtonIos = (props) => <TouchableOpacity {...props}>{props.children}</TouchableOpacity>;
|
||||
|
||||
const mapStateToProps = state => ({
|
||||
const mapStateToProps = (state) => ({
|
||||
isDarkTheme: state.application.isDarkTheme,
|
||||
});
|
||||
|
||||
|
@ -30,7 +30,7 @@ const TransactionView = ({ transactions, type, refreshing, setRefreshing, isLoad
|
||||
|
||||
const refreshControl = () => (
|
||||
<ThemeContainer>
|
||||
{isDarkTheme => (
|
||||
{(isDarkTheme) => (
|
||||
<RefreshControl
|
||||
refreshing={refreshing}
|
||||
onRefresh={() => setRefreshing(true)}
|
||||
|
@ -31,7 +31,7 @@ class UpvoteContainer extends PureComponent {
|
||||
|
||||
// Component Functions
|
||||
|
||||
_setUpvotePercent = value => {
|
||||
_setUpvotePercent = (value) => {
|
||||
const { dispatch } = this.props;
|
||||
|
||||
if (value) {
|
||||
@ -74,7 +74,7 @@ class UpvoteContainer extends PureComponent {
|
||||
const beneficiaries = [];
|
||||
const beneficiary = get(content, 'beneficiaries');
|
||||
if (beneficiaries) {
|
||||
beneficiary.forEach(key => {
|
||||
beneficiary.forEach((key) => {
|
||||
beneficiaries.push(
|
||||
`\n ${get(key, 'account')}: ${(parseFloat(get(key, 'weight')) / 100).toFixed(2)}%`,
|
||||
);
|
||||
@ -133,7 +133,7 @@ class UpvoteContainer extends PureComponent {
|
||||
}
|
||||
}
|
||||
|
||||
const mapStateToProps = state => ({
|
||||
const mapStateToProps = (state) => ({
|
||||
isLoggedIn: state.application.isLoggedIn,
|
||||
upvotePercent: state.application.upvotePercent,
|
||||
pinCode: state.application.pin,
|
||||
|
@ -61,7 +61,7 @@ class UpvoteView extends Component {
|
||||
}
|
||||
};
|
||||
|
||||
_upvoteContent = closePopover => {
|
||||
_upvoteContent = (closePopover) => {
|
||||
const {
|
||||
author,
|
||||
currentAccount,
|
||||
@ -100,7 +100,7 @@ class UpvoteView extends Component {
|
||||
},
|
||||
);
|
||||
})
|
||||
.catch(err => {
|
||||
.catch((err) => {
|
||||
console.log(err);
|
||||
if (
|
||||
err &&
|
||||
@ -156,7 +156,7 @@ class UpvoteView extends Component {
|
||||
}
|
||||
};
|
||||
|
||||
_downvoteContent = closePopover => {
|
||||
_downvoteContent = (closePopover) => {
|
||||
const {
|
||||
author,
|
||||
currentAccount,
|
||||
@ -194,7 +194,7 @@ class UpvoteView extends Component {
|
||||
},
|
||||
);
|
||||
})
|
||||
.catch(err => {
|
||||
.catch((err) => {
|
||||
Alert.alert('Failed!', err.message);
|
||||
this.setState({
|
||||
isVoted: false,
|
||||
@ -410,7 +410,7 @@ class UpvoteView extends Component {
|
||||
thumbStyle={styles.thumb}
|
||||
thumbTintColor="#007ee5"
|
||||
value={sliderValue}
|
||||
onValueChange={value => {
|
||||
onValueChange={(value) => {
|
||||
this.setState({ sliderValue: value }, () => {
|
||||
this._calculateEstimatedAmount();
|
||||
});
|
||||
|
@ -28,7 +28,7 @@ class UserAvatarView extends Component {
|
||||
}
|
||||
|
||||
// Component Functions
|
||||
_handleOnAvatarPress = username => {
|
||||
_handleOnAvatarPress = (username) => {
|
||||
const {
|
||||
currentUsername: { name },
|
||||
} = this.props;
|
||||
@ -87,7 +87,7 @@ class UserAvatarView extends Component {
|
||||
}
|
||||
}
|
||||
|
||||
const mapStateToProps = state => ({
|
||||
const mapStateToProps = (state) => ({
|
||||
currentUsername: state.account.currentAccount,
|
||||
});
|
||||
|
||||
|
@ -18,7 +18,7 @@ import styles from './votersDisplayStyles';
|
||||
const VotersDisplayView = ({ votes, navigation }) => {
|
||||
const intl = useIntl();
|
||||
|
||||
const _handleOnUserPress = username => {
|
||||
const _handleOnUserPress = (username) => {
|
||||
navigation.navigate({
|
||||
routeName: ROUTES.SCREENS.PROFILE,
|
||||
params: {
|
||||
@ -52,7 +52,7 @@ const VotersDisplayView = ({ votes, navigation }) => {
|
||||
{votes && votes.length > 0 ? (
|
||||
<FlatList
|
||||
data={votes}
|
||||
keyExtractor={item => item.voter}
|
||||
keyExtractor={(item) => item.voter}
|
||||
removeClippedSubviews={false}
|
||||
renderItem={({ item, index }) => _renderItem(item, index)}
|
||||
/>
|
||||
|
@ -76,7 +76,7 @@ class WalletContainer extends PureComponent {
|
||||
}
|
||||
}
|
||||
|
||||
const mapStateToProps = state => ({
|
||||
const mapStateToProps = (state) => ({
|
||||
isPinCodeOpen: state.application.isPinCodeOpen,
|
||||
});
|
||||
|
||||
|
@ -26,8 +26,10 @@ const WalletDetailsView = ({ walletData, intl, navigate, isShowDropdowns }) => {
|
||||
rightText={`${Math.round(walletData.balance * 1000) / 1000} HIVE`}
|
||||
isBoldText
|
||||
isHasdropdown={isShowDropdowns}
|
||||
dropdownOptions={steemDropdown.map(item => intl.formatMessage({ id: `transfer.${item}` }))}
|
||||
onDropdownSelect={index => navigate(steemDropdown[index], 'HIVE')}
|
||||
dropdownOptions={steemDropdown.map((item) =>
|
||||
intl.formatMessage({ id: `transfer.${item}` }),
|
||||
)}
|
||||
onDropdownSelect={(index) => navigate(steemDropdown[index], 'HIVE')}
|
||||
/>
|
||||
<GrayWrapper isGray>
|
||||
<WalletLineItem
|
||||
@ -36,38 +38,44 @@ const WalletDetailsView = ({ walletData, intl, navigate, isShowDropdowns }) => {
|
||||
})}
|
||||
isBlackText
|
||||
iconName="ios-information-circle-outline"
|
||||
rightText={`${Math.round(
|
||||
vestsToSp(walletData.vestingShares, walletData.steemPerMVests) * 1000,
|
||||
) / 1000} SP`}
|
||||
rightText={`${
|
||||
Math.round(vestsToSp(walletData.vestingShares, walletData.steemPerMVests) * 1000) / 1000
|
||||
} SP`}
|
||||
isBoldText
|
||||
isHasdropdown={isShowDropdowns}
|
||||
dropdownOptions={steemPowerDropdown.map(item =>
|
||||
dropdownOptions={steemPowerDropdown.map((item) =>
|
||||
intl.formatMessage({ id: `transfer.${item}` }),
|
||||
)}
|
||||
onDropdownSelect={a => navigate(steemPowerDropdown[a], 'HIVE_POWER')}
|
||||
onDropdownSelect={(a) => navigate(steemPowerDropdown[a], 'HIVE_POWER')}
|
||||
/>
|
||||
|
||||
{walletData.vestingSharesDelegated > 0 && (
|
||||
<WalletLineItem
|
||||
rightText={`- ${Math.round(
|
||||
vestsToSp(walletData.vestingSharesDelegated, walletData.steemPerMVests) * 1000,
|
||||
) / 1000} SP`}
|
||||
rightText={`- ${
|
||||
Math.round(
|
||||
vestsToSp(walletData.vestingSharesDelegated, walletData.steemPerMVests) * 1000,
|
||||
) / 1000
|
||||
} SP`}
|
||||
style={styles.walletLineDetail}
|
||||
/>
|
||||
)}
|
||||
{walletData.vestingSharesReceived > 0 && (
|
||||
<WalletLineItem
|
||||
rightText={`+ ${Math.round(
|
||||
vestsToSp(walletData.vestingSharesReceived, walletData.steemPerMVests) * 1000,
|
||||
) / 1000} SP`}
|
||||
rightText={`+ ${
|
||||
Math.round(
|
||||
vestsToSp(walletData.vestingSharesReceived, walletData.steemPerMVests) * 1000,
|
||||
) / 1000
|
||||
} SP`}
|
||||
style={styles.walletLineDetail}
|
||||
/>
|
||||
)}
|
||||
{(walletData.vestingSharesDelegated > 0 || walletData.vestingSharesReceived > 0) && (
|
||||
<WalletLineItem
|
||||
rightText={`= ${Math.round(
|
||||
vestsToSp(walletData.vestingSharesTotal, walletData.steemPerMVests) * 1000,
|
||||
) / 1000} SP`}
|
||||
rightText={`= ${
|
||||
Math.round(
|
||||
vestsToSp(walletData.vestingSharesTotal, walletData.steemPerMVests) * 1000,
|
||||
) / 1000
|
||||
} SP`}
|
||||
rightTextColor="#357ce6"
|
||||
style={styles.walletLineDetail}
|
||||
/>
|
||||
@ -83,8 +91,8 @@ const WalletDetailsView = ({ walletData, intl, navigate, isShowDropdowns }) => {
|
||||
rightText={`$${Math.round(walletData.sbdBalance * 1000) / 1000}`}
|
||||
isBoldText
|
||||
isHasdropdown={isShowDropdowns}
|
||||
dropdownOptions={sbdDropdown.map(item => intl.formatMessage({ id: `transfer.${item}` }))}
|
||||
onDropdownSelect={a => navigate(sbdDropdown[a], 'HBD')}
|
||||
dropdownOptions={sbdDropdown.map((item) => intl.formatMessage({ id: `transfer.${item}` }))}
|
||||
onDropdownSelect={(a) => navigate(sbdDropdown[a], 'HBD')}
|
||||
/>
|
||||
<GrayWrapper isGray>
|
||||
<WalletLineItem
|
||||
@ -96,19 +104,19 @@ const WalletDetailsView = ({ walletData, intl, navigate, isShowDropdowns }) => {
|
||||
rightText={`${Math.round(walletData.savingBalance * 1000) / 1000} STEEM`}
|
||||
isBoldText
|
||||
isHasdropdown={isShowDropdowns}
|
||||
dropdownOptions={savingSteemDropdown.map(item =>
|
||||
dropdownOptions={savingSteemDropdown.map((item) =>
|
||||
intl.formatMessage({ id: `transfer.${item}` }),
|
||||
)}
|
||||
onDropdownSelect={a => navigate(savingSteemDropdown[a], 'SAVING_HIVE')}
|
||||
onDropdownSelect={(a) => navigate(savingSteemDropdown[a], 'SAVING_HIVE')}
|
||||
/>
|
||||
<WalletLineItem
|
||||
rightText={`$${Math.round(walletData.savingBalanceSbd * 1000) / 1000}`}
|
||||
style={styles.walletLineDetail}
|
||||
isHasdropdown={isShowDropdowns}
|
||||
dropdownOptions={savingSbdDropdown.map(item =>
|
||||
dropdownOptions={savingSbdDropdown.map((item) =>
|
||||
intl.formatMessage({ id: `transfer.${item}` }),
|
||||
)}
|
||||
onDropdownSelect={a => navigate(savingSbdDropdown[a], 'SAVING_HBD')}
|
||||
onDropdownSelect={(a) => navigate(savingSbdDropdown[a], 'SAVING_HBD')}
|
||||
/>
|
||||
</GrayWrapper>
|
||||
{walletData.showPowerDown && (
|
||||
|
@ -65,10 +65,10 @@ const WalletHeaderView = ({
|
||||
dropdownRef={dropdownRef}
|
||||
isHasChildIcon
|
||||
iconName="arrow-drop-down"
|
||||
options={options.map(itemKey => intl.formatMessage({ id: `wallet.${itemKey}` }))}
|
||||
options={options.map((itemKey) => intl.formatMessage({ id: `wallet.${itemKey}` }))}
|
||||
noHighlight
|
||||
dropdownButtonStyle={styles.dropdownButtonStyle}
|
||||
onSelect={selectedIndex => handleOnDropdownSelected(options[selectedIndex])}
|
||||
onSelect={(selectedIndex) => handleOnDropdownSelected(options[selectedIndex])}
|
||||
rowTextStyle={styles.dropdownRowText}
|
||||
dropdownStyle={styles.dropdownStyle}
|
||||
iconStyle={styles.dropdownIconStyle}
|
||||
@ -80,7 +80,7 @@ const WalletHeaderView = ({
|
||||
return (
|
||||
<Fragment>
|
||||
<View style={styles.scrollContainer} contentContainerStyle={styles.scrollContentContainer}>
|
||||
{userBalance.map(item =>
|
||||
{userBalance.map((item) =>
|
||||
_getBalanceItem(
|
||||
get(item, 'balance', 0),
|
||||
get(item, 'options', []),
|
||||
|
@ -22,7 +22,7 @@ const AccountContainer = ({
|
||||
);
|
||||
};
|
||||
|
||||
const mapStateToProps = state => ({
|
||||
const mapStateToProps = (state) => ({
|
||||
accounts: state.account.otherAccounts,
|
||||
currentAccount: state.account.currentAccount,
|
||||
isLoggedIn: state.application.isLoggedIn,
|
||||
|
@ -26,7 +26,7 @@ class AccountListContainer extends Component {
|
||||
_handleSearch = (searchText, key) => {
|
||||
const { data, filterIndex } = this.state;
|
||||
|
||||
const newData = data.filter(item => {
|
||||
const newData = data.filter((item) => {
|
||||
const itemName = item[key].toUpperCase();
|
||||
const _text = searchText.toUpperCase();
|
||||
|
||||
@ -77,7 +77,7 @@ class AccountListContainer extends Component {
|
||||
this.setState({ filterResult: _data, filterIndex: index });
|
||||
};
|
||||
|
||||
_handleOnUserPress = username => {
|
||||
_handleOnUserPress = (username) => {
|
||||
const { navigation } = this.props;
|
||||
|
||||
navigation.navigate({
|
||||
|
@ -51,7 +51,7 @@ class InAppPurchaseContainer extends Component {
|
||||
fetchData,
|
||||
} = this.props;
|
||||
|
||||
this.purchaseUpdateSubscription = purchaseUpdatedListener(purchase => {
|
||||
this.purchaseUpdateSubscription = purchaseUpdatedListener((purchase) => {
|
||||
const receipt = get(purchase, 'transactionReceipt');
|
||||
const token = get(purchase, 'purchaseToken');
|
||||
|
||||
@ -76,8 +76,8 @@ class InAppPurchaseContainer extends Component {
|
||||
fetchData();
|
||||
}
|
||||
})
|
||||
.catch(err =>
|
||||
bugsnag.notify(err, report => {
|
||||
.catch((err) =>
|
||||
bugsnag.notify(err, (report) => {
|
||||
report.metadata = {
|
||||
data,
|
||||
};
|
||||
@ -86,7 +86,7 @@ class InAppPurchaseContainer extends Component {
|
||||
}
|
||||
});
|
||||
|
||||
this.purchaseErrorSubscription = purchaseErrorListener(error => {
|
||||
this.purchaseErrorSubscription = purchaseErrorListener((error) => {
|
||||
if (get(error, 'responseCode') === '3' && Platform.OS === 'android') {
|
||||
Alert.alert(
|
||||
intl.formatMessage({
|
||||
@ -127,7 +127,7 @@ class InAppPurchaseContainer extends Component {
|
||||
await this.setState({ isLoading: false });
|
||||
};
|
||||
|
||||
_buyItem = async sku => {
|
||||
_buyItem = async (sku) => {
|
||||
const { navigation } = this.props;
|
||||
|
||||
if (sku !== 'freePoints') {
|
||||
@ -136,7 +136,7 @@ class InAppPurchaseContainer extends Component {
|
||||
try {
|
||||
RNIap.requestPurchase(sku, false);
|
||||
} catch (err) {
|
||||
bugsnag.notify(err, report => {
|
||||
bugsnag.notify(err, (report) => {
|
||||
report.metadata = {
|
||||
sku,
|
||||
};
|
||||
@ -157,18 +157,21 @@ class InAppPurchaseContainer extends Component {
|
||||
return (
|
||||
children &&
|
||||
children({
|
||||
productList: [...productList.filter(item => !item.productId.includes('spins')), FREE_ESTM],
|
||||
productList: [
|
||||
...productList.filter((item) => !item.productId.includes('spins')),
|
||||
FREE_ESTM,
|
||||
],
|
||||
buyItem: this._buyItem,
|
||||
isLoading,
|
||||
isProcessing,
|
||||
getItems: this._getItems,
|
||||
spinProduct: productList.filter(item => item.productId.includes('spins')),
|
||||
spinProduct: productList.filter((item) => item.productId.includes('spins')),
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
const mapStateToProps = state => ({
|
||||
const mapStateToProps = (state) => ({
|
||||
currentAccount: state.account.currentAccount,
|
||||
});
|
||||
|
||||
|
@ -32,7 +32,7 @@ const LoggedInContainer = ({ isLoggedIn, isLoginDone, children }) => {
|
||||
);
|
||||
};
|
||||
|
||||
const mapStateToProps = state => ({
|
||||
const mapStateToProps = (state) => ({
|
||||
isLoggedIn: state.application.isLoggedIn,
|
||||
isLoginDone: state.application.isLoginDone,
|
||||
});
|
||||
|
@ -72,7 +72,7 @@ const PointsContainer = ({
|
||||
|
||||
// Component Functions
|
||||
|
||||
const _handleOnDropdownSelected = index => {
|
||||
const _handleOnDropdownSelected = (index) => {
|
||||
let navigateTo;
|
||||
let navigateParams;
|
||||
|
||||
@ -114,8 +114,8 @@ const PointsContainer = ({
|
||||
}
|
||||
};
|
||||
|
||||
const _groomUserActivities = _userActivities =>
|
||||
_userActivities.map(item =>
|
||||
const _groomUserActivities = (_userActivities) =>
|
||||
_userActivities.map((item) =>
|
||||
groomingPointsTransactionData({
|
||||
...item,
|
||||
icon: get(POINTS[get(item, 'type')], 'icon'),
|
||||
@ -131,23 +131,23 @@ const PointsContainer = ({
|
||||
setRefreshing(true);
|
||||
|
||||
await getUser(_username)
|
||||
.then(async userPointsP => {
|
||||
.then(async (userPointsP) => {
|
||||
const _balance = Math.round(get(userPointsP, 'points') * 1000) / 1000;
|
||||
setUserPoints(userPointsP);
|
||||
setBalance(_balance);
|
||||
setEstimatedEstm(await getPointsEstimate(_balance, currency));
|
||||
})
|
||||
.catch(err => {
|
||||
.catch((err) => {
|
||||
Alert.alert(get(err, 'message', 'Error'));
|
||||
});
|
||||
|
||||
await getUserPoints(_username)
|
||||
.then(userActivitiesP => {
|
||||
.then((userActivitiesP) => {
|
||||
if (Object.entries(userActivitiesP).length !== 0) {
|
||||
setUserActivities(_groomUserActivities(userActivitiesP));
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
.catch((err) => {
|
||||
if (err) {
|
||||
Alert.alert(get(err, 'message') || err.toString());
|
||||
}
|
||||
@ -157,13 +157,13 @@ const PointsContainer = ({
|
||||
setIsLoading(false);
|
||||
}, []);
|
||||
|
||||
const _getUserBalance = async _username => {
|
||||
const _getUserBalance = async (_username) => {
|
||||
await getUser(_username)
|
||||
.then(_userPoints => {
|
||||
.then((_userPoints) => {
|
||||
const _balance = Math.round(get(_userPoints, 'points') * 1000) / 1000;
|
||||
return _balance;
|
||||
})
|
||||
.catch(err => {
|
||||
.catch((err) => {
|
||||
if (err) {
|
||||
Alert.alert(get(err, 'message') || err.toString());
|
||||
}
|
||||
@ -177,7 +177,7 @@ const PointsContainer = ({
|
||||
.then(() => {
|
||||
_fetchUserPointActivities(username);
|
||||
})
|
||||
.catch(error => {
|
||||
.catch((error) => {
|
||||
if (error) {
|
||||
Alert.alert(
|
||||
`PointsClaim - Connection issue, try again or write to support@esteem.app \n${error.message.substr(
|
||||
@ -200,7 +200,7 @@ const PointsContainer = ({
|
||||
navigation.goBack();
|
||||
dispatch(toastNotification(intl.formatMessage({ id: 'alert.successful' })));
|
||||
})
|
||||
.catch(error => {
|
||||
.catch((error) => {
|
||||
if (error) {
|
||||
setIsLoading(false);
|
||||
dispatch(toastNotification(intl.formatMessage({ id: 'alert.key_warning' })));
|
||||
@ -208,7 +208,7 @@ const PointsContainer = ({
|
||||
});
|
||||
};
|
||||
|
||||
const _getESTMPrice = points => {
|
||||
const _getESTMPrice = (points) => {
|
||||
const { base, quote } = globalProps;
|
||||
|
||||
return points * 0.01 * (base / quote);
|
||||
@ -243,7 +243,7 @@ const PointsContainer = ({
|
||||
);
|
||||
};
|
||||
|
||||
const mapStateToProps = state => ({
|
||||
const mapStateToProps = (state) => ({
|
||||
user: state.account.currentAccount,
|
||||
username: state.account.currentAccount.name,
|
||||
activeBottomTab: state.ui.activeBottomTab,
|
||||
|
@ -78,7 +78,7 @@ class ProfileContainer extends Component {
|
||||
this._loadProfile(targetUsername);
|
||||
}
|
||||
|
||||
_getReplies = async query => {
|
||||
_getReplies = async (query) => {
|
||||
const { isOwnProfile, comments } = this.state;
|
||||
let repliesAction;
|
||||
|
||||
@ -92,7 +92,7 @@ class ProfileContainer extends Component {
|
||||
start_author: query.author,
|
||||
start_permlink: query.permlink,
|
||||
limit: 10,
|
||||
}).then(result => {
|
||||
}).then((result) => {
|
||||
let _comments = unionBy(comments, result, 'permlink');
|
||||
this.setState({
|
||||
comments: _comments,
|
||||
@ -101,7 +101,7 @@ class ProfileContainer extends Component {
|
||||
}
|
||||
};
|
||||
|
||||
_handleFollowUnfollowUser = async isFollowAction => {
|
||||
_handleFollowUnfollowUser = async (isFollowAction) => {
|
||||
const { isFollowing, username } = this.state;
|
||||
const { currentAccount, pinCode, dispatch, intl } = this.props;
|
||||
const follower = get(currentAccount, 'name', '');
|
||||
@ -133,12 +133,12 @@ class ProfileContainer extends Component {
|
||||
);
|
||||
this._profileActionDone();
|
||||
})
|
||||
.catch(err => {
|
||||
.catch((err) => {
|
||||
this._profileActionDone(err);
|
||||
});
|
||||
};
|
||||
|
||||
_handleMuteUnmuteUser = async isMuteAction => {
|
||||
_handleMuteUnmuteUser = async (isMuteAction) => {
|
||||
if (isMuteAction) {
|
||||
this._muteUser();
|
||||
} else {
|
||||
@ -170,7 +170,7 @@ class ProfileContainer extends Component {
|
||||
);
|
||||
this._profileActionDone();
|
||||
})
|
||||
.catch(err => {
|
||||
.catch((err) => {
|
||||
this._profileActionDone(err);
|
||||
});
|
||||
};
|
||||
@ -241,7 +241,7 @@ class ProfileContainer extends Component {
|
||||
|
||||
_isMuted = _isFollowing ? false : await getIsMuted(username, currentAccount.name);
|
||||
|
||||
getIsFavorite(username, currentAccount.name).then(isFav => {
|
||||
getIsFavorite(username, currentAccount.name).then((isFav) => {
|
||||
isFavorite = isFav;
|
||||
});
|
||||
}
|
||||
@ -277,7 +277,7 @@ class ProfileContainer extends Component {
|
||||
this._profileActionDone(error);
|
||||
}
|
||||
|
||||
this.setState(prevState => ({
|
||||
this.setState((prevState) => ({
|
||||
quickProfile: {
|
||||
...prevState.quickProfile,
|
||||
display_name: get(user, 'display_name'),
|
||||
@ -290,7 +290,7 @@ class ProfileContainer extends Component {
|
||||
this._getReplies({ author: username, permlink: undefined });
|
||||
};
|
||||
|
||||
_handleFollowsPress = async isFollowingPress => {
|
||||
_handleFollowsPress = async (isFollowingPress) => {
|
||||
const { navigation } = this.props;
|
||||
const { username, follows } = this.state;
|
||||
const count = get(follows, !isFollowingPress ? 'follower_count' : 'following_count');
|
||||
@ -342,7 +342,7 @@ class ProfileContainer extends Component {
|
||||
}
|
||||
};
|
||||
|
||||
_changeForceLoadPostState = value => {
|
||||
_changeForceLoadPostState = (value) => {
|
||||
this.setState({ forceLoadPost: value });
|
||||
};
|
||||
|
||||
@ -456,7 +456,7 @@ class ProfileContainer extends Component {
|
||||
);
|
||||
}
|
||||
}
|
||||
const mapStateToProps = state => ({
|
||||
const mapStateToProps = (state) => ({
|
||||
currency: state.application.currency,
|
||||
isConnected: state.application.isConnected,
|
||||
isDarkTheme: state.application.isDarkTheme,
|
||||
|
@ -72,12 +72,12 @@ class ProfileEditContainer extends Component {
|
||||
|
||||
this.setState({ isLoading: true });
|
||||
uploadImage(media)
|
||||
.then(res => {
|
||||
.then((res) => {
|
||||
if (res.data && res.data.url) {
|
||||
this.setState({ [action]: res.data.url, isLoading: false });
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
.catch((error) => {
|
||||
if (error) {
|
||||
Alert.alert(
|
||||
intl.formatMessage({
|
||||
@ -98,26 +98,26 @@ class ProfileEditContainer extends Component {
|
||||
}
|
||||
};
|
||||
|
||||
_handleOpenImagePicker = action => {
|
||||
_handleOpenImagePicker = (action) => {
|
||||
ImagePicker.openPicker({
|
||||
includeBase64: true,
|
||||
})
|
||||
.then(image => {
|
||||
.then((image) => {
|
||||
this._handleMediaOnSelected(image, action);
|
||||
})
|
||||
.catch(e => {
|
||||
.catch((e) => {
|
||||
this._handleMediaOnSelectFailure(e);
|
||||
});
|
||||
};
|
||||
|
||||
_handleOpenCamera = action => {
|
||||
_handleOpenCamera = (action) => {
|
||||
ImagePicker.openCamera({
|
||||
includeBase64: true,
|
||||
})
|
||||
.then(image => {
|
||||
.then((image) => {
|
||||
this._handleMediaOnSelected(image, action);
|
||||
})
|
||||
.catch(e => {
|
||||
.catch((e) => {
|
||||
this._handleMediaOnSelectFailure(e);
|
||||
});
|
||||
};
|
||||
@ -128,7 +128,7 @@ class ProfileEditContainer extends Component {
|
||||
});
|
||||
};
|
||||
|
||||
_handleMediaOnSelectFailure = error => {
|
||||
_handleMediaOnSelectFailure = (error) => {
|
||||
const { intl } = this.props;
|
||||
|
||||
if (get(error, 'code') === 'E_PERMISSION_MISSING') {
|
||||
@ -168,7 +168,7 @@ class ProfileEditContainer extends Component {
|
||||
navigation.state.params.fetchUser();
|
||||
navigation.goBack();
|
||||
})
|
||||
.catch(error => {
|
||||
.catch((error) => {
|
||||
Alert.alert(
|
||||
intl.formatMessage({
|
||||
id: 'alert.fail',
|
||||
@ -205,7 +205,7 @@ class ProfileEditContainer extends Component {
|
||||
}
|
||||
}
|
||||
|
||||
const mapStateToProps = state => ({
|
||||
const mapStateToProps = (state) => ({
|
||||
currentAccount: state.account.currentAccount,
|
||||
isDarkTheme: state.application.isDarkTheme,
|
||||
pinCode: state.application.pin,
|
||||
|
@ -78,7 +78,7 @@ class RedeemContainer extends Component {
|
||||
navigation.goBack();
|
||||
dispatch(toastNotification(intl.formatMessage({ id: 'alert.successful' })));
|
||||
})
|
||||
.catch(error => {
|
||||
.catch((error) => {
|
||||
if (error) {
|
||||
dispatch(toastNotification(intl.formatMessage({ id: 'alert.key_warning' })));
|
||||
}
|
||||
@ -138,7 +138,7 @@ class RedeemContainer extends Component {
|
||||
}
|
||||
}
|
||||
|
||||
const mapStateToProps = state => ({
|
||||
const mapStateToProps = (state) => ({
|
||||
username: state.account.currentAccount.name,
|
||||
activeBottomTab: state.ui.activeBottomTab,
|
||||
isConnected: state.application.isConnected,
|
||||
|
@ -30,29 +30,29 @@ class RedeemContainer extends Component {
|
||||
const { username } = this.props;
|
||||
|
||||
await gameStatusCheck(username, 'spin')
|
||||
.then(res => {
|
||||
.then((res) => {
|
||||
this.setState({
|
||||
gameRight: get(res, 'remaining', 0),
|
||||
nextDate: get(res, 'next_date', null),
|
||||
isLoading: false,
|
||||
});
|
||||
})
|
||||
.catch(err => {
|
||||
.catch((err) => {
|
||||
if (err) {
|
||||
Alert.alert(get(err, 'message') || err.toString());
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
_startGame = async type => {
|
||||
_startGame = async (type) => {
|
||||
const { username } = this.props;
|
||||
let gameStatus;
|
||||
|
||||
await gameStatusCheck(username, type)
|
||||
.then(res => {
|
||||
.then((res) => {
|
||||
gameStatus = res;
|
||||
})
|
||||
.catch(err => {
|
||||
.catch((err) => {
|
||||
if (err) {
|
||||
Alert.alert(get(err, 'message') || err.toString());
|
||||
}
|
||||
@ -60,7 +60,7 @@ class RedeemContainer extends Component {
|
||||
|
||||
if (get(gameStatus, 'status') !== 18) {
|
||||
await gameClaim(username, type, get(gameStatus, 'key'))
|
||||
.then(res => {
|
||||
.then((res) => {
|
||||
this.setState(
|
||||
{
|
||||
gameRight: get(gameStatus, 'status') !== 3 ? 0 : 5,
|
||||
@ -69,7 +69,7 @@ class RedeemContainer extends Component {
|
||||
() => this._statusCheck(),
|
||||
);
|
||||
})
|
||||
.catch(err => {
|
||||
.catch((err) => {
|
||||
if (err) {
|
||||
Alert.alert(get(err, 'message') || err.toString());
|
||||
}
|
||||
@ -96,7 +96,7 @@ class RedeemContainer extends Component {
|
||||
}
|
||||
}
|
||||
|
||||
const mapStateToProps = state => ({
|
||||
const mapStateToProps = (state) => ({
|
||||
username: state.account.currentAccount.name,
|
||||
});
|
||||
|
||||
|
@ -74,7 +74,7 @@ const WalletContainer = ({
|
||||
|
||||
useEffect(() => {
|
||||
const _transferHistory = userActivities.filter(
|
||||
item =>
|
||||
(item) =>
|
||||
get(item, 'textKey') === 'transfer' ||
|
||||
get(item, 'textKey') === 'transfer_to_vesting' ||
|
||||
get(item, 'textKey') === 'transfer_to_savings' ||
|
||||
@ -136,13 +136,13 @@ const WalletContainer = ({
|
||||
// Components functions
|
||||
|
||||
const _getWalletData = useCallback(
|
||||
async _selectedUser => {
|
||||
async (_selectedUser) => {
|
||||
const _walletData = await groomingWalletData(_selectedUser, globalProps, currency);
|
||||
|
||||
setWalletData(_walletData);
|
||||
setIsLoading(false);
|
||||
setUserActivities(
|
||||
get(_walletData, 'transactions', []).map(item =>
|
||||
get(_walletData, 'transactions', []).map((item) =>
|
||||
groomingTransactionData(item, steemPerMVests),
|
||||
),
|
||||
);
|
||||
@ -158,7 +158,7 @@ const WalletContainer = ({
|
||||
[globalProps, setEstimatedWalletValue, steemPerMVests],
|
||||
);
|
||||
|
||||
const _isHasUnclaimedRewards = account => {
|
||||
const _isHasUnclaimedRewards = (account) => {
|
||||
return (
|
||||
parseToken(get(account, 'reward_steem_balance')) > 0 ||
|
||||
parseToken(get(account, 'reward_sbd_balance')) > 0 ||
|
||||
@ -176,7 +176,7 @@ const WalletContainer = ({
|
||||
await setIsClaiming(true);
|
||||
|
||||
getAccount(currentAccount.name)
|
||||
.then(account => {
|
||||
.then((account) => {
|
||||
isHasUnclaimedRewards = _isHasUnclaimedRewards(account[0]);
|
||||
if (isHasUnclaimedRewards) {
|
||||
const {
|
||||
@ -189,7 +189,7 @@ const WalletContainer = ({
|
||||
setIsClaiming(false);
|
||||
})
|
||||
.then(() => getAccount(currentAccount.name))
|
||||
.then(account => {
|
||||
.then((account) => {
|
||||
_getWalletData(selectedUser);
|
||||
if (isHasUnclaimedRewards) {
|
||||
dispatch(
|
||||
@ -201,7 +201,7 @@ const WalletContainer = ({
|
||||
);
|
||||
}
|
||||
})
|
||||
.then(account => {
|
||||
.then((account) => {
|
||||
_getWalletData(selectedUser);
|
||||
setIsClaiming(false);
|
||||
})
|
||||
@ -223,7 +223,7 @@ const WalletContainer = ({
|
||||
setRefreshing(true);
|
||||
|
||||
getAccount(selectedUser.name)
|
||||
.then(account => {
|
||||
.then((account) => {
|
||||
_getWalletData(selectedUser);
|
||||
setRefreshing(false);
|
||||
})
|
||||
@ -278,7 +278,7 @@ const WalletContainer = ({
|
||||
}
|
||||
};
|
||||
|
||||
const getTokenAddress = tokenType => {
|
||||
const getTokenAddress = (tokenType) => {
|
||||
if (tokenType === 'BTC') {
|
||||
console.log(getBtcAddress(pinCode, currentAccount));
|
||||
}
|
||||
@ -324,7 +324,7 @@ const WalletContainer = ({
|
||||
);
|
||||
};
|
||||
|
||||
const mapStateToProps = state => ({
|
||||
const mapStateToProps = (state) => ({
|
||||
currentAccount: state.account.currentAccount,
|
||||
pinCode: state.application.pin,
|
||||
globalProps: state.account.globalProps,
|
||||
|
@ -11,7 +11,7 @@ const ThemeContainer = ({ children, isDarkTheme }) => {
|
||||
);
|
||||
};
|
||||
|
||||
const mapStateToProps = state => ({
|
||||
const mapStateToProps = (state) => ({
|
||||
isDarkTheme: state.application.isDarkTheme,
|
||||
});
|
||||
|
||||
|
@ -53,23 +53,23 @@ class TransferContainer extends Component {
|
||||
|
||||
// Component Functions
|
||||
|
||||
_getUserPointsBalance = async username => {
|
||||
_getUserPointsBalance = async (username) => {
|
||||
await getUser(username)
|
||||
.then(userPoints => {
|
||||
.then((userPoints) => {
|
||||
const balance = Math.round(get(userPoints, 'points') * 1000) / 1000;
|
||||
this.setState({ balance });
|
||||
})
|
||||
.catch(err => {
|
||||
.catch((err) => {
|
||||
if (err) {
|
||||
alert(get(err, 'message') || err.toString());
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
fetchBalance = username => {
|
||||
fetchBalance = (username) => {
|
||||
const { fundType, transferType, tokenAddress } = this.state;
|
||||
|
||||
getAccount(username).then(async account => {
|
||||
getAccount(username).then(async (account) => {
|
||||
let balance;
|
||||
|
||||
if (
|
||||
@ -115,7 +115,7 @@ class TransferContainer extends Component {
|
||||
});
|
||||
};
|
||||
|
||||
_getAccountsWithUsername = async username => {
|
||||
_getAccountsWithUsername = async (username) => {
|
||||
const validUsers = await lookupAccounts(username);
|
||||
return validUsers;
|
||||
};
|
||||
@ -193,7 +193,7 @@ class TransferContainer extends Component {
|
||||
dispatch(toastNotification(intl.formatMessage({ id: 'alert.successful' })));
|
||||
navigation.goBack();
|
||||
})
|
||||
.catch(err => {
|
||||
.catch((err) => {
|
||||
navigation.goBack();
|
||||
dispatch(toastNotification(err.message));
|
||||
});
|
||||
@ -209,7 +209,7 @@ class TransferContainer extends Component {
|
||||
autoVest,
|
||||
};
|
||||
|
||||
setWithdrawVestingRoute(currentAccount, pinCode, data).catch(err => {
|
||||
setWithdrawVestingRoute(currentAccount, pinCode, data).catch((err) => {
|
||||
alert(err.message || err.toString());
|
||||
});
|
||||
};
|
||||
@ -247,7 +247,7 @@ class TransferContainer extends Component {
|
||||
}
|
||||
}
|
||||
|
||||
const mapStateToProps = state => ({
|
||||
const mapStateToProps = (state) => ({
|
||||
accounts: state.account.otherAccounts,
|
||||
currentAccount: state.account.currentAccount,
|
||||
pinCode: state.application.pin,
|
||||
|
@ -17,7 +17,7 @@ const _renderApp = ({ locale }) => (
|
||||
</PersistGate>
|
||||
);
|
||||
|
||||
const mapStateToProps = state => ({
|
||||
const mapStateToProps = (state) => ({
|
||||
locale: state.application.language,
|
||||
});
|
||||
|
||||
|
@ -89,7 +89,7 @@ const bottomTabNavigator = createBottomTabNavigator(
|
||||
},
|
||||
},
|
||||
{
|
||||
tabBarComponent: props => <BottomTabBar {...props} />,
|
||||
tabBarComponent: (props) => <BottomTabBar {...props} />,
|
||||
tabBarOptions: {
|
||||
showLabel: false,
|
||||
activeTintColor: '#f6f6f6',
|
||||
|
@ -4,15 +4,15 @@ let _navigator;
|
||||
|
||||
let navigationStack = [];
|
||||
|
||||
const setTopLevelNavigator = navigatorRef => {
|
||||
const setTopLevelNavigator = (navigatorRef) => {
|
||||
_navigator = navigatorRef;
|
||||
if (navigationStack.length > 0) {
|
||||
navigationStack.forEach(item => navigate(item));
|
||||
navigationStack.forEach((item) => navigate(item));
|
||||
navigationStack = [];
|
||||
}
|
||||
};
|
||||
|
||||
const navigate = navigationProps => {
|
||||
const navigate = (navigationProps) => {
|
||||
if (!_navigator) {
|
||||
navigationStack.push(navigationProps);
|
||||
} else {
|
||||
|
@ -41,17 +41,17 @@ export const login = async (username, password, isPinCodeOpen) => {
|
||||
|
||||
// Public keys of user
|
||||
const publicKeys = {
|
||||
activeKey: get(account, 'active.key_auths', []).map(x => x[0])[0],
|
||||
activeKey: get(account, 'active.key_auths', []).map((x) => x[0])[0],
|
||||
memoKey: get(account, 'memo_key', ''),
|
||||
ownerKey: get(account, 'owner.key_auths', []).map(x => x[0])[0],
|
||||
postingKey: get(account, 'posting.key_auths', []).map(x => x[0])[0],
|
||||
ownerKey: get(account, 'owner.key_auths', []).map((x) => x[0])[0],
|
||||
postingKey: get(account, 'posting.key_auths', []).map((x) => x[0])[0],
|
||||
};
|
||||
|
||||
// // Set private keys of user
|
||||
const privateKeys = getPrivateKeys(username, password);
|
||||
|
||||
// Check all keys
|
||||
Object.keys(publicKeys).map(pubKey => {
|
||||
Object.keys(publicKeys).map((pubKey) => {
|
||||
if (publicKeys[pubKey] === privateKeys[pubKey].createPublic().toString()) {
|
||||
loginFlag = true;
|
||||
if (privateKeys.isMasterKey) {
|
||||
@ -173,7 +173,7 @@ export const loginWithSC2 = async (code, isPinCodeOpen) => {
|
||||
});
|
||||
};
|
||||
|
||||
export const setUserDataWithPinCode = async data => {
|
||||
export const setUserDataWithPinCode = async (data) => {
|
||||
try {
|
||||
const result = await getUserDataWithUsername(data.username);
|
||||
const userData = result[0];
|
||||
@ -201,14 +201,14 @@ export const setUserDataWithPinCode = async data => {
|
||||
}
|
||||
};
|
||||
|
||||
export const updatePinCode = data =>
|
||||
export const updatePinCode = (data) =>
|
||||
new Promise((resolve, reject) => {
|
||||
let currentUser = null;
|
||||
try {
|
||||
setPinCode(get(data, 'pinCode'));
|
||||
getUserData().then(async users => {
|
||||
getUserData().then(async (users) => {
|
||||
if (users && users.length > 0) {
|
||||
await users.forEach(userData => {
|
||||
await users.forEach((userData) => {
|
||||
if (
|
||||
get(userData, 'authType', '') === AUTH_TYPE.MASTER_KEY ||
|
||||
get(userData, 'authType', '') === AUTH_TYPE.ACTIVE_KEY ||
|
||||
@ -242,7 +242,7 @@ export const updatePinCode = data =>
|
||||
}
|
||||
});
|
||||
|
||||
export const verifyPinCode = async data => {
|
||||
export const verifyPinCode = async (data) => {
|
||||
const pinHash = await getPinCode();
|
||||
|
||||
const result = await getUserDataWithUsername(data.username);
|
||||
@ -286,10 +286,10 @@ export const refreshSCToken = async (userData, pinCode) => {
|
||||
}
|
||||
};
|
||||
|
||||
export const switchAccount = username =>
|
||||
export const switchAccount = (username) =>
|
||||
new Promise((resolve, reject) => {
|
||||
getUser(username)
|
||||
.then(account => {
|
||||
.then((account) => {
|
||||
updateCurrentUsername(username)
|
||||
.then(() => {
|
||||
resolve(account);
|
||||
@ -355,7 +355,7 @@ export const getUpdatedUserData = (userData, data) => {
|
||||
};
|
||||
};
|
||||
|
||||
const isLoggedInUser = async username => {
|
||||
const isLoggedInUser = async (username) => {
|
||||
const result = await getUserDataWithUsername(username);
|
||||
if (result.length > 0) {
|
||||
return true;
|
||||
|
@ -123,7 +123,9 @@ export const getState = async (path) => {
|
||||
export const getUser = async (user) => {
|
||||
try {
|
||||
const account = await client.database.getAccounts([user]);
|
||||
const _account = { ...account[0] };
|
||||
const _account = {
|
||||
...account[0],
|
||||
};
|
||||
let unreadActivityCount;
|
||||
|
||||
if (account && account.length < 1) {
|
||||
@ -131,9 +133,13 @@ export const getUser = async (user) => {
|
||||
}
|
||||
|
||||
const globalProperties = await client.database.getDynamicGlobalProperties();
|
||||
const rcPower = await client.call('rc_api', 'find_rc_accounts', { accounts: [user] });
|
||||
const rcPower = await client.call('rc_api', 'find_rc_accounts', {
|
||||
accounts: [user],
|
||||
});
|
||||
try {
|
||||
unreadActivityCount = await getUnreadActivityCount({ user });
|
||||
unreadActivityCount = await getUnreadActivityCount({
|
||||
user,
|
||||
});
|
||||
} catch (error) {
|
||||
unreadActivityCount = 0;
|
||||
}
|
||||
@ -507,7 +513,7 @@ const _vote = async (currentAccount, pin, author, permlink, weight) => {
|
||||
resolve(result);
|
||||
})
|
||||
.catch((err) => {
|
||||
alert(jsonStringify(err));
|
||||
alert(jsonStringify(err), jsonStringify(args), privateKey);
|
||||
if (get(err, 'jse_info.code') === 4030100) {
|
||||
err.message = getDsteemDateErrorMessage(err);
|
||||
}
|
||||
@ -539,7 +545,12 @@ export const upvoteAmount = async (input) => {
|
||||
|
||||
export const transferToken = (currentAccount, pin, data) => {
|
||||
const digitPinCode = getDigitPinCode(pin);
|
||||
const key = getAnyPrivateKey({ activeKey: get(currentAccount, 'local.activeKey') }, digitPinCode);
|
||||
const key = getAnyPrivateKey(
|
||||
{
|
||||
activeKey: get(currentAccount, 'local.activeKey'),
|
||||
},
|
||||
digitPinCode,
|
||||
);
|
||||
|
||||
if (key) {
|
||||
const privateKey = PrivateKey.fromString(key);
|
||||
@ -569,7 +580,12 @@ export const transferToken = (currentAccount, pin, data) => {
|
||||
|
||||
export const convert = (currentAccount, pin, data) => {
|
||||
const digitPinCode = getDigitPinCode(pin);
|
||||
const key = getAnyPrivateKey({ activeKey: get(currentAccount, 'local.activeKey') }, digitPinCode);
|
||||
const key = getAnyPrivateKey(
|
||||
{
|
||||
activeKey: get(currentAccount, 'local.activeKey'),
|
||||
},
|
||||
digitPinCode,
|
||||
);
|
||||
|
||||
if (key) {
|
||||
const privateKey = PrivateKey.fromString(key);
|
||||
@ -604,7 +620,12 @@ export const convert = (currentAccount, pin, data) => {
|
||||
|
||||
export const transferToSavings = (currentAccount, pin, data) => {
|
||||
const digitPinCode = getDigitPinCode(pin);
|
||||
const key = getAnyPrivateKey({ activeKey: get(currentAccount, 'local.activeKey') }, digitPinCode);
|
||||
const key = getAnyPrivateKey(
|
||||
{
|
||||
activeKey: get(currentAccount, 'local.activeKey'),
|
||||
},
|
||||
digitPinCode,
|
||||
);
|
||||
|
||||
if (key) {
|
||||
const privateKey = PrivateKey.fromString(key);
|
||||
@ -638,7 +659,12 @@ export const transferToSavings = (currentAccount, pin, data) => {
|
||||
|
||||
export const transferFromSavings = (currentAccount, pin, data) => {
|
||||
const digitPinCode = getDigitPinCode(pin);
|
||||
const key = getAnyPrivateKey({ activeKey: get(currentAccount, 'local.activeKey') }, digitPinCode);
|
||||
const key = getAnyPrivateKey(
|
||||
{
|
||||
activeKey: get(currentAccount, 'local.activeKey'),
|
||||
},
|
||||
digitPinCode,
|
||||
);
|
||||
|
||||
if (key) {
|
||||
const privateKey = PrivateKey.fromString(key);
|
||||
@ -672,7 +698,12 @@ export const transferFromSavings = (currentAccount, pin, data) => {
|
||||
|
||||
export const transferToVesting = (currentAccount, pin, data) => {
|
||||
const digitPinCode = getDigitPinCode(pin);
|
||||
const key = getAnyPrivateKey({ activeKey: get(currentAccount, 'local.activeKey') }, digitPinCode);
|
||||
const key = getAnyPrivateKey(
|
||||
{
|
||||
activeKey: get(currentAccount, 'local.activeKey'),
|
||||
},
|
||||
digitPinCode,
|
||||
);
|
||||
|
||||
if (key) {
|
||||
const privateKey = PrivateKey.fromString(key);
|
||||
@ -704,7 +735,12 @@ export const transferToVesting = (currentAccount, pin, data) => {
|
||||
|
||||
export const withdrawVesting = (currentAccount, pin, data) => {
|
||||
const digitPinCode = getDigitPinCode(pin);
|
||||
const key = getAnyPrivateKey({ activeKey: get(currentAccount, 'local.activeKey') }, digitPinCode);
|
||||
const key = getAnyPrivateKey(
|
||||
{
|
||||
activeKey: get(currentAccount, 'local.activeKey'),
|
||||
},
|
||||
digitPinCode,
|
||||
);
|
||||
|
||||
if (key) {
|
||||
const privateKey = PrivateKey.fromString(key);
|
||||
@ -735,7 +771,12 @@ export const withdrawVesting = (currentAccount, pin, data) => {
|
||||
|
||||
export const delegateVestingShares = (currentAccount, pin, data) => {
|
||||
const digitPinCode = getDigitPinCode(pin);
|
||||
const key = getAnyPrivateKey({ activeKey: get(currentAccount, 'local.activeKey') }, digitPinCode);
|
||||
const key = getAnyPrivateKey(
|
||||
{
|
||||
activeKey: get(currentAccount, 'local.activeKey'),
|
||||
},
|
||||
digitPinCode,
|
||||
);
|
||||
|
||||
if (key) {
|
||||
const privateKey = PrivateKey.fromString(key);
|
||||
@ -767,7 +808,12 @@ export const delegateVestingShares = (currentAccount, pin, data) => {
|
||||
|
||||
export const setWithdrawVestingRoute = (currentAccount, pin, data) => {
|
||||
const digitPinCode = getDigitPinCode(pin);
|
||||
const key = getAnyPrivateKey({ activeKey: get(currentAccount, 'local.activeKey') }, digitPinCode);
|
||||
const key = getAnyPrivateKey(
|
||||
{
|
||||
activeKey: get(currentAccount, 'local.activeKey'),
|
||||
},
|
||||
digitPinCode,
|
||||
);
|
||||
|
||||
if (key) {
|
||||
const privateKey = PrivateKey.fromString(key);
|
||||
@ -1221,7 +1267,9 @@ export const grantPostingPermission = async (json, pin, currentAccount) => {
|
||||
|
||||
const newPosting = Object.assign(
|
||||
{},
|
||||
{ ...get(currentAccount, 'posting') },
|
||||
{
|
||||
...get(currentAccount, 'posting'),
|
||||
},
|
||||
{
|
||||
account_auths: [
|
||||
...get(currentAccount, 'posting.account_auths'),
|
||||
@ -1313,7 +1361,9 @@ export const profileUpdate = async (params, pin, currentAccount) => {
|
||||
{
|
||||
account: get(currentAccount, 'name'),
|
||||
memo_key: get(currentAccount, 'memo_key'),
|
||||
json_metadata: jsonStringify({ profile: params }),
|
||||
json_metadata: jsonStringify({
|
||||
profile: params,
|
||||
}),
|
||||
},
|
||||
],
|
||||
];
|
||||
@ -1350,7 +1400,9 @@ export const getBtcAddress = (pin, currentAccount) => {
|
||||
return { address: address };
|
||||
}
|
||||
*/
|
||||
return { address: '' };
|
||||
return {
|
||||
address: '',
|
||||
};
|
||||
};
|
||||
|
||||
// HELPERS
|
||||
|
@ -4,14 +4,14 @@ import steemConnect from './steemConnectAPI';
|
||||
* @method to upvote/unvote a content
|
||||
* @param {*} vote
|
||||
*/
|
||||
export const vote = voteObj =>
|
||||
export const vote = (voteObj) =>
|
||||
new Promise((resolve, reject) => {
|
||||
steemConnect
|
||||
.vote(voteObj.voter, voteObj.author, voteObj.permlink, voteObj.weight)
|
||||
.then(result => {
|
||||
.then((result) => {
|
||||
resolve(result);
|
||||
})
|
||||
.catch(error => {
|
||||
.catch((error) => {
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
@ -20,7 +20,7 @@ export const vote = voteObj =>
|
||||
* @method to submit a comment/reply
|
||||
* @param {*} comment
|
||||
*/
|
||||
export const comment = commentObj =>
|
||||
export const comment = (commentObj) =>
|
||||
new Promise((resolve, reject) => {
|
||||
steemConnect
|
||||
.comment(
|
||||
@ -32,15 +32,15 @@ export const comment = commentObj =>
|
||||
commentObj.body,
|
||||
commentObj.jsonMetadata,
|
||||
)
|
||||
.then(result => {
|
||||
.then((result) => {
|
||||
resolve(result);
|
||||
})
|
||||
.catch(error => {
|
||||
.catch((error) => {
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
|
||||
export const post = postObj => {
|
||||
export const post = (postObj) => {
|
||||
// Create empty array for the operations
|
||||
const operations = [];
|
||||
|
||||
@ -66,16 +66,16 @@ export const post = postObj => {
|
||||
return new Promise((resolve, reject) => {
|
||||
steemConnect
|
||||
.broadcast(operations)
|
||||
.then(result => {
|
||||
.then((result) => {
|
||||
resolve(result);
|
||||
})
|
||||
.catch(error => {
|
||||
.catch((error) => {
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
export const prepareBeneficiaries = postObj => {
|
||||
export const prepareBeneficiaries = (postObj) => {
|
||||
const beneficiariesObject = {
|
||||
author: postObj.author,
|
||||
permlink: postObj.permlink,
|
||||
@ -101,26 +101,26 @@ export const prepareBeneficiaries = postObj => {
|
||||
return ['comment_options', beneficiariesObject];
|
||||
};
|
||||
|
||||
export const follow = data =>
|
||||
export const follow = (data) =>
|
||||
new Promise((resolve, reject) => {
|
||||
steemConnect
|
||||
.follow(data.follower, data.following)
|
||||
.then(result => {
|
||||
.then((result) => {
|
||||
resolve(result);
|
||||
})
|
||||
.catch(error => {
|
||||
.catch((error) => {
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
|
||||
export const unFollow = data =>
|
||||
export const unFollow = (data) =>
|
||||
new Promise((resolve, reject) => {
|
||||
steemConnect
|
||||
.unfollow(data.unfollower, data.unfollowing)
|
||||
.then(result => {
|
||||
.then((result) => {
|
||||
resolve(result);
|
||||
})
|
||||
.catch(error => {
|
||||
.catch((error) => {
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
@ -129,14 +129,14 @@ export const unFollow = data =>
|
||||
* @method to claim rewards
|
||||
* @param {*} data
|
||||
*/
|
||||
export const claimRewards = data =>
|
||||
export const claimRewards = (data) =>
|
||||
new Promise((resolve, reject) => {
|
||||
steemConnect
|
||||
.claimRewardBalance(data.account, data.rewardSteem, data.rewardSBD, data.VESTS)
|
||||
.then(result => {
|
||||
.then((result) => {
|
||||
resolve(result);
|
||||
})
|
||||
.catch(error => {
|
||||
.catch((error) => {
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
@ -145,31 +145,31 @@ export const claimRewards = data =>
|
||||
* @method to mute/block an user
|
||||
* @param {*} data
|
||||
*/
|
||||
export const muteUser = data =>
|
||||
export const muteUser = (data) =>
|
||||
new Promise((resolve, reject) => {
|
||||
steemConnect
|
||||
.ignore(data.follower, data.following)
|
||||
.then(result => {
|
||||
.then((result) => {
|
||||
resolve(result);
|
||||
})
|
||||
.catch(error => {
|
||||
.catch((error) => {
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
|
||||
export const reblogPost = data =>
|
||||
export const reblogPost = (data) =>
|
||||
new Promise((resolve, reject) => {
|
||||
steemConnect
|
||||
.reblog(data.account, data.author, data.permlink)
|
||||
.then(result => {
|
||||
.then((result) => {
|
||||
resolve(result);
|
||||
})
|
||||
.catch(error => {
|
||||
.catch((error) => {
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
|
||||
export const removeAccessToken = data =>
|
||||
export const removeAccessToken = (data) =>
|
||||
new Promise((resolve, reject) => {
|
||||
try {
|
||||
steemConnect.removeAccessToken();
|
||||
@ -196,14 +196,14 @@ export const revokeToken = () =>
|
||||
* @method to update user profile data
|
||||
* @param {*} data
|
||||
*/
|
||||
export const updateUserMetadata = data =>
|
||||
export const updateUserMetadata = (data) =>
|
||||
new Promise((resolve, reject) => {
|
||||
steemConnect
|
||||
.updateUserMetadata(data)
|
||||
.then(result => {
|
||||
.then((result) => {
|
||||
resolve(result);
|
||||
})
|
||||
.catch(error => {
|
||||
.catch((error) => {
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
|
@ -10,7 +10,7 @@ const SETTINGS_SCHEMA = 'settings';
|
||||
const APPLICATION_SCHEMA = 'application';
|
||||
const STORAGE_SCHEMA = 'storage';
|
||||
|
||||
export const getItemFromStorage = async key => {
|
||||
export const getItemFromStorage = async (key) => {
|
||||
const data = await AsyncStorage.getItem(key);
|
||||
if (data) {
|
||||
return JSON.parse(data);
|
||||
@ -37,11 +37,11 @@ export const getUserData = async () => {
|
||||
}
|
||||
};
|
||||
|
||||
export const getUserDataWithUsername = async username => {
|
||||
export const getUserDataWithUsername = async (username) => {
|
||||
try {
|
||||
const user = await getItemFromStorage(USER_SCHEMA);
|
||||
if (user) {
|
||||
const userObj = user.filter(u => u.username === username);
|
||||
const userObj = user.filter((u) => u.username === username);
|
||||
return userObj;
|
||||
}
|
||||
return [];
|
||||
@ -50,7 +50,7 @@ export const getUserDataWithUsername = async username => {
|
||||
}
|
||||
};
|
||||
|
||||
export const setUserData = async userData => {
|
||||
export const setUserData = async (userData) => {
|
||||
try {
|
||||
const account = await getUserDataWithUsername(userData.username);
|
||||
const user = (await getItemFromStorage(USER_SCHEMA)) || [];
|
||||
@ -65,12 +65,12 @@ export const setUserData = async userData => {
|
||||
}
|
||||
};
|
||||
|
||||
export const updateUserData = async userData => {
|
||||
export const updateUserData = async (userData) => {
|
||||
try {
|
||||
let account = await getItemFromStorage(USER_SCHEMA);
|
||||
|
||||
if (account.some(e => e.username === userData.username)) {
|
||||
account = account.map(item =>
|
||||
if (account.some((e) => e.username === userData.username)) {
|
||||
account = account.map((item) =>
|
||||
item.username === userData.username ? { ...item, ...userData } : item,
|
||||
);
|
||||
await setItemToStorage(USER_SCHEMA, account);
|
||||
@ -82,12 +82,12 @@ export const updateUserData = async userData => {
|
||||
}
|
||||
};
|
||||
|
||||
export const removeUserData = async username => {
|
||||
export const removeUserData = async (username) => {
|
||||
try {
|
||||
let account = await getItemFromStorage(USER_SCHEMA);
|
||||
|
||||
if (account.some(e => e.username === username)) {
|
||||
account = account.filter(item => item.username !== username);
|
||||
if (account.some((e) => e.username === username)) {
|
||||
account = account.filter((item) => item.username !== username);
|
||||
await setItemToStorage(USER_SCHEMA, account);
|
||||
return true;
|
||||
}
|
||||
@ -118,8 +118,8 @@ export const setDraftPost = async (fields, username) => {
|
||||
body: fields.body,
|
||||
};
|
||||
|
||||
if (draft && draft.some(e => e.username === username)) {
|
||||
draft = draft.map(item => (item.username === username ? { ...item, ...data } : item));
|
||||
if (draft && draft.some((e) => e.username === username)) {
|
||||
draft = draft.map((item) => (item.username === username ? { ...item, ...data } : item));
|
||||
} else {
|
||||
draft = [];
|
||||
draft.push(data);
|
||||
@ -131,10 +131,10 @@ export const setDraftPost = async (fields, username) => {
|
||||
}
|
||||
};
|
||||
|
||||
export const getDraftPost = async username => {
|
||||
export const getDraftPost = async (username) => {
|
||||
try {
|
||||
const draft = await getItemFromStorage(DRAFT_SCHEMA);
|
||||
const draftObj = draft.filter(item => item.username === username);
|
||||
const draftObj = draft.filter((item) => item.username === username);
|
||||
return draftObj[0];
|
||||
} catch (error) {
|
||||
return error;
|
||||
@ -153,7 +153,7 @@ export const getAuthStatus = async () => {
|
||||
}
|
||||
};
|
||||
|
||||
export const setAuthStatus = async authStatus => {
|
||||
export const setAuthStatus = async (authStatus) => {
|
||||
try {
|
||||
const auth = await getItemFromStorage(AUTH_SCHEMA);
|
||||
if (auth) {
|
||||
@ -168,7 +168,7 @@ export const setAuthStatus = async authStatus => {
|
||||
}
|
||||
};
|
||||
|
||||
export const updateCurrentUsername = async username => {
|
||||
export const updateCurrentUsername = async (username) => {
|
||||
try {
|
||||
const auth = await getItemFromStorage(AUTH_SCHEMA);
|
||||
|
||||
@ -190,7 +190,7 @@ export const updateCurrentUsername = async username => {
|
||||
}
|
||||
};
|
||||
|
||||
export const setPinCode = async pinCode => {
|
||||
export const setPinCode = async (pinCode) => {
|
||||
try {
|
||||
const auth = await getItemFromStorage(AUTH_SCHEMA);
|
||||
const pinHash = sha256(pinCode);
|
||||
@ -244,7 +244,7 @@ export const getPinCodeOpen = async () => {
|
||||
}
|
||||
};
|
||||
|
||||
export const setPinCodeOpen = async status => {
|
||||
export const setPinCodeOpen = async (status) => {
|
||||
try {
|
||||
const setting = await getItemFromStorage(SETTINGS_SCHEMA);
|
||||
|
||||
@ -257,7 +257,7 @@ export const setPinCodeOpen = async status => {
|
||||
}
|
||||
};
|
||||
|
||||
export const setTheme = async isDarkTheme => {
|
||||
export const setTheme = async (isDarkTheme) => {
|
||||
try {
|
||||
const setting = await getItemFromStorage(SETTINGS_SCHEMA);
|
||||
|
||||
@ -282,7 +282,7 @@ export const getTheme = async () => {
|
||||
}
|
||||
};
|
||||
|
||||
export const setDefaultFooter = async isDefaultFooter => {
|
||||
export const setDefaultFooter = async (isDefaultFooter) => {
|
||||
try {
|
||||
const setting = await getItemFromStorage(SETTINGS_SCHEMA);
|
||||
|
||||
@ -295,7 +295,7 @@ export const setDefaultFooter = async isDefaultFooter => {
|
||||
}
|
||||
};
|
||||
|
||||
export const setUpvotePercent = async percent => {
|
||||
export const setUpvotePercent = async (percent) => {
|
||||
try {
|
||||
const setting = await getItemFromStorage(SETTINGS_SCHEMA);
|
||||
|
||||
@ -332,7 +332,7 @@ export const getNsfw = async () => {
|
||||
}
|
||||
};
|
||||
|
||||
export const setNsfw = async nsfw => {
|
||||
export const setNsfw = async (nsfw) => {
|
||||
try {
|
||||
const setting = await getItemFromStorage(SETTINGS_SCHEMA);
|
||||
|
||||
@ -345,7 +345,7 @@ export const setNsfw = async nsfw => {
|
||||
}
|
||||
};
|
||||
|
||||
export const setLanguage = async selectedLanguage => {
|
||||
export const setLanguage = async (selectedLanguage) => {
|
||||
try {
|
||||
const setting = await getItemFromStorage(SETTINGS_SCHEMA);
|
||||
|
||||
@ -358,7 +358,7 @@ export const setLanguage = async selectedLanguage => {
|
||||
}
|
||||
};
|
||||
|
||||
export const setServer = async selectedServer => {
|
||||
export const setServer = async (selectedServer) => {
|
||||
try {
|
||||
const setting = await getItemFromStorage(SETTINGS_SCHEMA);
|
||||
|
||||
@ -408,7 +408,7 @@ export const setNotificationSettings = async ({ type, action }) => {
|
||||
}
|
||||
};
|
||||
|
||||
export const setCurrency = async currencyProps => {
|
||||
export const setCurrency = async (currencyProps) => {
|
||||
try {
|
||||
const setting = await getItemFromStorage(SETTINGS_SCHEMA);
|
||||
setting.currency = currencyProps;
|
||||
@ -501,7 +501,7 @@ export const getPushTokenSaved = async () => {
|
||||
}
|
||||
};
|
||||
|
||||
export const setPushTokenSaved = async pushTokenSaved => {
|
||||
export const setPushTokenSaved = async (pushTokenSaved) => {
|
||||
try {
|
||||
const application = await getItemFromStorage(APPLICATION_SCHEMA);
|
||||
if (application) {
|
||||
@ -535,7 +535,7 @@ export const getExistUser = async () => {
|
||||
}
|
||||
};
|
||||
|
||||
export const setExistUser = async existUser => {
|
||||
export const setExistUser = async (existUser) => {
|
||||
try {
|
||||
const application = await getItemFromStorage(APPLICATION_SCHEMA);
|
||||
if (application) {
|
||||
@ -553,13 +553,13 @@ export const setExistUser = async existUser => {
|
||||
}
|
||||
};
|
||||
|
||||
export const setSCAccount = async data => {
|
||||
export const setSCAccount = async (data) => {
|
||||
try {
|
||||
let scAccount = await getItemFromStorage(SC_ACCOUNTS);
|
||||
const date = new Date();
|
||||
date.setSeconds(date.getSeconds() + data.expires_in);
|
||||
if (scAccount.some(e => e.username === data.username)) {
|
||||
scAccount = scAccount.map(item =>
|
||||
if (scAccount.some((e) => e.username === data.username)) {
|
||||
scAccount = scAccount.map((item) =>
|
||||
item.username === data.username
|
||||
? { ...item, refreshToken: data.refresh_token, expireDate: date.toString() }
|
||||
: item,
|
||||
@ -580,10 +580,10 @@ export const setSCAccount = async data => {
|
||||
}
|
||||
};
|
||||
|
||||
export const getSCAccount = async username => {
|
||||
export const getSCAccount = async (username) => {
|
||||
try {
|
||||
const scAccountStr = await getItemFromStorage(SC_ACCOUNTS);
|
||||
const scAccount = scAccountStr.filter(u => u.username === username);
|
||||
const scAccount = scAccountStr.filter((u) => u.username === username);
|
||||
if (scAccount.length > 0) {
|
||||
return scAccount[0];
|
||||
}
|
||||
@ -593,12 +593,12 @@ export const getSCAccount = async username => {
|
||||
}
|
||||
};
|
||||
|
||||
export const removeSCAccount = async username => {
|
||||
export const removeSCAccount = async (username) => {
|
||||
try {
|
||||
let scAccount = await getItemFromStorage(SC_ACCOUNTS);
|
||||
|
||||
if (scAccount.some(e => e.username === username)) {
|
||||
scAccount = scAccount.filter(item => item.username !== username);
|
||||
if (scAccount.some((e) => e.username === username)) {
|
||||
scAccount = scAccount.filter((item) => item.username !== username);
|
||||
|
||||
await setItemToStorage(SC_ACCOUNTS, scAccount);
|
||||
|
||||
|
@ -8,40 +8,40 @@ import {
|
||||
UPDATE_UNREAD_ACTIVITY_COUNT,
|
||||
} from '../constants/constants';
|
||||
|
||||
export const fetchGlobalProperties = () => dispatch =>
|
||||
fetchGlobalProps().then(res =>
|
||||
export const fetchGlobalProperties = () => (dispatch) =>
|
||||
fetchGlobalProps().then((res) =>
|
||||
dispatch({
|
||||
type: SET_GLOBAL_PROPS,
|
||||
payload: { ...res },
|
||||
}),
|
||||
);
|
||||
|
||||
export const updateCurrentAccount = data => ({
|
||||
export const updateCurrentAccount = (data) => ({
|
||||
type: UPDATE_CURRENT_ACCOUNT,
|
||||
payload: data,
|
||||
});
|
||||
|
||||
export const addOtherAccount = data => ({
|
||||
export const addOtherAccount = (data) => ({
|
||||
type: ADD_OTHER_ACCOUNT,
|
||||
payload: data,
|
||||
});
|
||||
|
||||
export const failedAccount = data => ({
|
||||
export const failedAccount = (data) => ({
|
||||
type: FETCH_ACCOUNT_FAIL,
|
||||
payload: data,
|
||||
});
|
||||
|
||||
export const updateUnreadActivityCount = data => ({
|
||||
export const updateUnreadActivityCount = (data) => ({
|
||||
type: UPDATE_UNREAD_ACTIVITY_COUNT,
|
||||
payload: data,
|
||||
});
|
||||
|
||||
export const removeOtherAccount = data => ({
|
||||
export const removeOtherAccount = (data) => ({
|
||||
type: REMOVE_OTHER_ACCOUNT,
|
||||
payload: data,
|
||||
});
|
||||
|
||||
export const setGlobalProps = data => ({
|
||||
export const setGlobalProps = (data) => ({
|
||||
type: SET_GLOBAL_PROPS,
|
||||
payload: data,
|
||||
});
|
||||
|
@ -29,7 +29,7 @@ import {
|
||||
IS_RENDER_REQUIRED,
|
||||
} from '../constants/constants';
|
||||
|
||||
export const login = payload => ({
|
||||
export const login = (payload) => ({
|
||||
payload,
|
||||
type: LOGIN,
|
||||
});
|
||||
@ -46,7 +46,7 @@ export const isLoginDone = () => ({
|
||||
type: IS_LOGIN_DONE,
|
||||
});
|
||||
|
||||
export const openPinCodeModal = payload => ({
|
||||
export const openPinCodeModal = (payload) => ({
|
||||
payload,
|
||||
type: OPEN_PIN_CODE_MODAL,
|
||||
});
|
||||
@ -60,27 +60,27 @@ export const activeApplication = () => ({
|
||||
});
|
||||
|
||||
// Settings actions
|
||||
export const setLanguage = payload => ({
|
||||
export const setLanguage = (payload) => ({
|
||||
payload,
|
||||
type: SET_LANGUAGE,
|
||||
});
|
||||
|
||||
export const setApi = payload => ({
|
||||
export const setApi = (payload) => ({
|
||||
payload,
|
||||
type: SET_API,
|
||||
});
|
||||
|
||||
export const setUpvotePercent = payload => ({
|
||||
export const setUpvotePercent = (payload) => ({
|
||||
payload,
|
||||
type: SET_UPVOTE_PERCENT,
|
||||
});
|
||||
|
||||
export const changeAllNotificationSettings = payload => ({
|
||||
export const changeAllNotificationSettings = (payload) => ({
|
||||
payload,
|
||||
type: CHANGE_ALL_NOTIFICATION_SETTINGS,
|
||||
});
|
||||
|
||||
export const changeNotificationSettings = payload => {
|
||||
export const changeNotificationSettings = (payload) => {
|
||||
switch (payload.type) {
|
||||
case 'notification.follow':
|
||||
return {
|
||||
@ -129,27 +129,27 @@ export const changeNotificationSettings = payload => {
|
||||
}
|
||||
};
|
||||
|
||||
export const isDarkTheme = payload => ({
|
||||
export const isDarkTheme = (payload) => ({
|
||||
payload,
|
||||
type: IS_DARK_THEME,
|
||||
});
|
||||
|
||||
export const isPinCodeOpen = payload => ({
|
||||
export const isPinCodeOpen = (payload) => ({
|
||||
payload,
|
||||
type: IS_PIN_CODE_OPEN,
|
||||
});
|
||||
|
||||
export const setConnectivityStatus = payload => ({
|
||||
export const setConnectivityStatus = (payload) => ({
|
||||
payload,
|
||||
type: IS_CONNECTED,
|
||||
});
|
||||
|
||||
export const setNsfw = payload => ({
|
||||
export const setNsfw = (payload) => ({
|
||||
payload,
|
||||
type: SET_NSFW,
|
||||
});
|
||||
|
||||
export const isDefaultFooter = payload => ({
|
||||
export const isDefaultFooter = (payload) => ({
|
||||
payload,
|
||||
type: IS_DEFAULT_FOOTER,
|
||||
});
|
||||
@ -157,10 +157,10 @@ export const isDefaultFooter = payload => ({
|
||||
/**
|
||||
* MW
|
||||
*/
|
||||
export const setCurrency = currency => dispatch => {
|
||||
export const setCurrency = (currency) => (dispatch) => {
|
||||
const currencySymbol = getSymbolFromCurrency(currency);
|
||||
|
||||
getCurrencyRate(currency).then(currencyRate =>
|
||||
getCurrencyRate(currency).then((currencyRate) =>
|
||||
dispatch({
|
||||
type: SET_CURRENCY,
|
||||
payload: { currency, currencyRate, currencySymbol },
|
||||
@ -168,12 +168,12 @@ export const setCurrency = currency => dispatch => {
|
||||
);
|
||||
};
|
||||
|
||||
export const setPinCode = data => ({
|
||||
export const setPinCode = (data) => ({
|
||||
type: SET_PIN_CODE,
|
||||
payload: data,
|
||||
});
|
||||
|
||||
export const isRenderRequired = payload => ({
|
||||
export const isRenderRequired = (payload) => ({
|
||||
payload,
|
||||
type: IS_RENDER_REQUIRED,
|
||||
});
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { SET_FEED_POSTS } from '../constants/constants';
|
||||
|
||||
export const setFeedPosts = payload => ({
|
||||
export const setFeedPosts = (payload) => ({
|
||||
payload,
|
||||
type: SET_FEED_POSTS,
|
||||
});
|
||||
|
@ -4,17 +4,17 @@ import {
|
||||
HIDE_POSTS_THUMBNAILS,
|
||||
} from '../constants/constants';
|
||||
|
||||
export const updateActiveBottomTab = payload => ({
|
||||
export const updateActiveBottomTab = (payload) => ({
|
||||
payload,
|
||||
type: UPDATE_ACTIVE_BOTTOM_TAB,
|
||||
});
|
||||
|
||||
export const toastNotification = payload => ({
|
||||
export const toastNotification = (payload) => ({
|
||||
payload,
|
||||
type: TOAST_NOTIFICATION,
|
||||
});
|
||||
|
||||
export const hidePostsThumbnails = payload => ({
|
||||
export const hidePostsThumbnails = (payload) => ({
|
||||
payload,
|
||||
type: HIDE_POSTS_THUMBNAILS,
|
||||
});
|
||||
|
@ -20,7 +20,7 @@ const initialState = {
|
||||
isLogingOut: false,
|
||||
};
|
||||
|
||||
export default function(state = initialState, action) {
|
||||
export default function (state = initialState, action) {
|
||||
switch (action.type) {
|
||||
case FETCHING_ACCOUNT:
|
||||
return {
|
||||
@ -60,7 +60,7 @@ export default function(state = initialState, action) {
|
||||
case REMOVE_OTHER_ACCOUNT:
|
||||
return {
|
||||
...state,
|
||||
otherAccounts: state.otherAccounts.filter(item => item.username !== action.payload),
|
||||
otherAccounts: state.otherAccounts.filter((item) => item.username !== action.payload),
|
||||
};
|
||||
|
||||
case UPDATE_CURRENT_ACCOUNT:
|
||||
|
@ -61,7 +61,7 @@ const initialState = {
|
||||
isRenderRequired: false,
|
||||
};
|
||||
|
||||
export default function(state = initialState, action) {
|
||||
export default function (state = initialState, action) {
|
||||
switch (action.type) {
|
||||
case LOGIN:
|
||||
return {
|
||||
|
@ -4,7 +4,7 @@ const initialState = {
|
||||
feedPosts: [],
|
||||
};
|
||||
|
||||
export default function(state = initialState, action) {
|
||||
export default function (state = initialState, action) {
|
||||
switch (action.type) {
|
||||
case SET_FEED_POSTS:
|
||||
return {
|
||||
|
@ -10,7 +10,7 @@ const initialState = {
|
||||
hidePostsThumbnails: false,
|
||||
};
|
||||
|
||||
export default function(state = initialState, action) {
|
||||
export default function (state = initialState, action) {
|
||||
switch (action.type) {
|
||||
case UPDATE_ACTIVE_BOTTOM_TAB:
|
||||
return {
|
||||
|
@ -103,7 +103,7 @@ class ApplicationContainer extends Component {
|
||||
|
||||
Linking.addEventListener('url', this._handleOpenURL);
|
||||
|
||||
Linking.getInitialURL().then(url => {
|
||||
Linking.getInitialURL().then((url) => {
|
||||
this._handleDeepLink(url);
|
||||
});
|
||||
|
||||
@ -111,7 +111,7 @@ class ApplicationContainer extends Component {
|
||||
setPreviousAppState();
|
||||
|
||||
if (nativeThemeEventEmitter) {
|
||||
nativeThemeEventEmitter.on('currentModeChanged', newMode => {
|
||||
nativeThemeEventEmitter.on('currentModeChanged', (newMode) => {
|
||||
const { dispatch } = this.props;
|
||||
|
||||
dispatch(isDarkTheme(newMode === 'dark'));
|
||||
@ -151,7 +151,7 @@ class ApplicationContainer extends Component {
|
||||
}
|
||||
|
||||
_setNetworkListener = () => {
|
||||
this.netListener = NetInfo.addEventListener(state => {
|
||||
this.netListener = NetInfo.addEventListener((state) => {
|
||||
const { isConnected, dispatch } = this.props;
|
||||
if (state.isConnected !== isConnected) {
|
||||
dispatch(setConnectivityStatus(state.isConnected));
|
||||
@ -161,11 +161,11 @@ class ApplicationContainer extends Component {
|
||||
});
|
||||
};
|
||||
|
||||
_handleOpenURL = event => {
|
||||
_handleOpenURL = (event) => {
|
||||
this._handleDeepLink(event.url);
|
||||
};
|
||||
|
||||
_handleDeepLink = async url => {
|
||||
_handleDeepLink = async (url) => {
|
||||
if (!url) return;
|
||||
|
||||
let routeName;
|
||||
@ -211,10 +211,10 @@ class ApplicationContainer extends Component {
|
||||
);
|
||||
};
|
||||
|
||||
_handleAppStateChange = nextAppState => {
|
||||
_handleAppStateChange = (nextAppState) => {
|
||||
const { appState } = this.state;
|
||||
const { isPinCodeOpen: _isPinCodeOpen } = this.props;
|
||||
getExistUser().then(isExistUser => {
|
||||
getExistUser().then((isExistUser) => {
|
||||
if (isExistUser) {
|
||||
if (appState.match(/active|forground/) && nextAppState === 'inactive') {
|
||||
this._startPinCodeTimer();
|
||||
@ -336,7 +336,7 @@ class ApplicationContainer extends Component {
|
||||
break;
|
||||
}
|
||||
|
||||
markActivityAsRead(username, activity_id).then(result => {
|
||||
markActivityAsRead(username, activity_id).then((result) => {
|
||||
dispatch(updateUnreadActivityCount(result.unread));
|
||||
});
|
||||
if (!some(params, isEmpty)) {
|
||||
@ -351,7 +351,7 @@ class ApplicationContainer extends Component {
|
||||
});
|
||||
};
|
||||
|
||||
_handleConntectionChange = status => {
|
||||
_handleConntectionChange = (status) => {
|
||||
const { dispatch, isConnected } = this.props;
|
||||
|
||||
if (isConnected !== status) {
|
||||
@ -418,7 +418,7 @@ class ApplicationContainer extends Component {
|
||||
}
|
||||
|
||||
if (realmData.length > 0) {
|
||||
const realmObject = realmData.filter(data => data.username === currentUsername);
|
||||
const realmObject = realmData.filter((data) => data.username === currentUsername);
|
||||
|
||||
if (realmObject.length === 0) {
|
||||
realmObject[0] = realmData[realmData.length - 1];
|
||||
@ -450,18 +450,18 @@ class ApplicationContainer extends Component {
|
||||
return null;
|
||||
};
|
||||
|
||||
_fetchUserDataFromDsteem = async realmObject => {
|
||||
_fetchUserDataFromDsteem = async (realmObject) => {
|
||||
const { dispatch, intl } = this.props;
|
||||
|
||||
await getUser(realmObject.username)
|
||||
.then(accountData => {
|
||||
.then((accountData) => {
|
||||
accountData.local = realmObject;
|
||||
|
||||
dispatch(updateCurrentAccount(accountData));
|
||||
|
||||
this._connectNotificationServer(accountData.name);
|
||||
})
|
||||
.catch(err => {
|
||||
.catch((err) => {
|
||||
Alert.alert(
|
||||
`${intl.formatMessage({ id: 'alert.fetch_error' })} \n${err.message.substr(0, 20)}`,
|
||||
);
|
||||
@ -503,7 +503,7 @@ class ApplicationContainer extends Component {
|
||||
}
|
||||
};
|
||||
|
||||
_connectNotificationServer = username => {
|
||||
_connectNotificationServer = (username) => {
|
||||
/* eslint no-undef: "warn" */
|
||||
const ws = new WebSocket(`${Config.ACTIVITY_WEBSOCKET_URL}?user=${username}`);
|
||||
|
||||
@ -530,7 +530,7 @@ class ApplicationContainer extends Component {
|
||||
|
||||
removeUserData(name)
|
||||
.then(async () => {
|
||||
const _otherAccounts = otherAccounts.filter(user => user.username !== name);
|
||||
const _otherAccounts = otherAccounts.filter((user) => user.username !== name);
|
||||
|
||||
this._enableNotification(name, false);
|
||||
|
||||
@ -552,7 +552,7 @@ class ApplicationContainer extends Component {
|
||||
dispatch(removeOtherAccount(name));
|
||||
dispatch(logoutDone());
|
||||
})
|
||||
.catch(err => {
|
||||
.catch((err) => {
|
||||
Alert.alert(
|
||||
`${intl.formatMessage({ id: 'alert.fetch_error' })} \n${err.message.substr(0, 20)}`,
|
||||
);
|
||||
@ -571,7 +571,7 @@ class ApplicationContainer extends Component {
|
||||
});
|
||||
};
|
||||
|
||||
_switchAccount = async targetAccountUsername => {
|
||||
_switchAccount = async (targetAccountUsername) => {
|
||||
const { dispatch, isConnected } = this.props;
|
||||
|
||||
if (!isConnected) return;
|
||||
@ -650,7 +650,7 @@ class ApplicationContainer extends Component {
|
||||
}
|
||||
|
||||
export default connect(
|
||||
state => ({
|
||||
(state) => ({
|
||||
// Application
|
||||
isDarkTheme: state.application.isDarkTheme,
|
||||
selectedLanguage: state.application.language,
|
||||
@ -675,7 +675,7 @@ export default connect(
|
||||
toastNotification: state.ui.toastNotification,
|
||||
activeBottomTab: state.ui.activeBottomTab,
|
||||
}),
|
||||
dispatch => ({
|
||||
(dispatch) => ({
|
||||
dispatch,
|
||||
actions: {
|
||||
...bindActionCreators({ fetchGlobalProperties }, dispatch),
|
||||
|
@ -61,7 +61,7 @@ class ApplicationScreen extends Component {
|
||||
<Fragment>
|
||||
{!isConnected && <NoInternetConnection />}
|
||||
<Navigation
|
||||
ref={navigatorRef => {
|
||||
ref={(navigatorRef) => {
|
||||
setTopLevelNavigator(navigatorRef);
|
||||
}}
|
||||
/>
|
||||
|
@ -39,7 +39,7 @@ const BookmarksContainer = ({ currentAccount, intl, navigation }) => {
|
||||
setIsLoading(true);
|
||||
|
||||
getFavorites(currentAccount.name)
|
||||
.then(data => {
|
||||
.then((data) => {
|
||||
setFavorites(_sortData(data));
|
||||
setIsLoading(false);
|
||||
})
|
||||
@ -53,7 +53,7 @@ const BookmarksContainer = ({ currentAccount, intl, navigation }) => {
|
||||
setIsLoading(true);
|
||||
|
||||
getBookmarks(currentAccount.name)
|
||||
.then(data => {
|
||||
.then((data) => {
|
||||
setBookmarks(_sortData(data));
|
||||
setIsLoading(false);
|
||||
})
|
||||
@ -63,10 +63,10 @@ const BookmarksContainer = ({ currentAccount, intl, navigation }) => {
|
||||
});
|
||||
};
|
||||
|
||||
const _removeFavorite = selectedUsername => {
|
||||
const _removeFavorite = (selectedUsername) => {
|
||||
removeFavorite(currentAccount.name, selectedUsername)
|
||||
.then(() => {
|
||||
const newFavorites = [...favorites].filter(fav => fav.account !== selectedUsername);
|
||||
const newFavorites = [...favorites].filter((fav) => fav.account !== selectedUsername);
|
||||
|
||||
setFavorites(_sortData(newFavorites));
|
||||
})
|
||||
@ -75,10 +75,10 @@ const BookmarksContainer = ({ currentAccount, intl, navigation }) => {
|
||||
});
|
||||
};
|
||||
|
||||
const _removeBoomark = id => {
|
||||
const _removeBoomark = (id) => {
|
||||
removeBookmark(currentAccount.name, id)
|
||||
.then(() => {
|
||||
const newBookmarks = [...bookmarks].filter(bookmark => bookmark._id !== id);
|
||||
const newBookmarks = [...bookmarks].filter((bookmark) => bookmark._id !== id);
|
||||
|
||||
setBookmarks(_sortData(newBookmarks));
|
||||
})
|
||||
@ -87,7 +87,7 @@ const BookmarksContainer = ({ currentAccount, intl, navigation }) => {
|
||||
});
|
||||
};
|
||||
|
||||
const _handleOnFavoritePress = username => {
|
||||
const _handleOnFavoritePress = (username) => {
|
||||
navigation.navigate({
|
||||
routeName: ROUTES.SCREENS.PROFILE,
|
||||
params: {
|
||||
@ -109,7 +109,7 @@ const BookmarksContainer = ({ currentAccount, intl, navigation }) => {
|
||||
}
|
||||
};
|
||||
|
||||
const _sortData = data => {
|
||||
const _sortData = (data) => {
|
||||
return data.sort((a, b) => {
|
||||
const dateA = a.timestamp;
|
||||
const dateB = b.timestamp;
|
||||
@ -132,7 +132,7 @@ const BookmarksContainer = ({ currentAccount, intl, navigation }) => {
|
||||
);
|
||||
};
|
||||
|
||||
const mapStateToProps = state => ({
|
||||
const mapStateToProps = (state) => ({
|
||||
currentAccount: state.account.currentAccount,
|
||||
});
|
||||
|
||||
|
@ -78,12 +78,12 @@ const BookmarksScreen = ({
|
||||
return (
|
||||
<View style={styles.container}>
|
||||
<FlatList
|
||||
data={data.map(item =>
|
||||
data={data.map((item) =>
|
||||
item._id !== data[item._id] && isFavorites
|
||||
? item.account !== data[item.account] && item
|
||||
: item,
|
||||
)}
|
||||
keyExtractor={item => item._id}
|
||||
keyExtractor={(item) => item._id}
|
||||
removeClippedSubviews={false}
|
||||
renderItem={({ item, index }) => _renderItem(item, index, type)}
|
||||
ListEmptyComponent={_renderEmptyContent()}
|
||||
@ -91,7 +91,7 @@ const BookmarksScreen = ({
|
||||
</View>
|
||||
);
|
||||
};
|
||||
const _handleLongPress = _selectedItemId => {
|
||||
const _handleLongPress = (_selectedItemId) => {
|
||||
setSelectedItemId(_selectedItemId);
|
||||
};
|
||||
|
||||
@ -104,7 +104,7 @@ const BookmarksScreen = ({
|
||||
/>
|
||||
|
||||
<ScrollableTabView
|
||||
onChangeTab={event => setActiveTab(event.i)}
|
||||
onChangeTab={(event) => setActiveTab(event.i)}
|
||||
style={[globalStyles.tabView, { paddingBottom: 40 }]}
|
||||
renderTabBar={() => (
|
||||
<TabBar
|
||||
@ -141,7 +141,7 @@ const BookmarksScreen = ({
|
||||
title={intl.formatMessage({ id: 'alert.remove_alert' })}
|
||||
cancelButtonIndex={1}
|
||||
destructiveButtonIndex={0}
|
||||
onPress={index => {
|
||||
onPress={(index) => {
|
||||
if (index === 0) {
|
||||
activeTab === 0 ? removeBookmark(selectedItemId) : removeFavorite(selectedItemId);
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user