fixed boost scren couple bug & fixed profile post ug

This commit is contained in:
ue 2019-08-08 20:51:55 +03:00
parent f5f00360e4
commit 3ce5d2c6e5
9 changed files with 31 additions and 33 deletions

View File

@ -67,6 +67,7 @@ class BasicHeaderView extends Component {
render() {
const {
disabled,
dropdownComponent,
handleOnPressBackButton,
handleOnPressClose,
@ -83,10 +84,10 @@ class BasicHeaderView extends Component {
isLoading,
isLoggedIn,
isModalHeader,
rightButtonText,
isPreviewActive,
isReply,
quickTitle,
rightButtonText,
rightIconName,
title,
} = this.props;
@ -101,6 +102,7 @@ class BasicHeaderView extends Component {
iconType="MaterialIcons"
name={isModalHeader ? 'arrow-back' : 'arrow-back'}
onPress={() => (isModalHeader ? handleOnPressClose() : handleOnPressBackButton())}
disabled={disabled}
/>
{isHasIcons && !isReply && (
<View>

View File

@ -82,7 +82,7 @@ class PostCardContainer extends PureComponent {
};
render() {
const { content, isHideImage, nsfw, isHideReblogOption } = this.props;
const { content, isHideImage, nsfw } = this.props;
const { _content } = this.state;
const isNsfwPost = nsfw === '1';
@ -96,7 +96,6 @@ class PostCardContainer extends PureComponent {
content={_content || content}
isHideImage={isHideImage}
isNsfwPost={isNsfwPost}
isHideReblogOption={isHideReblogOption}
/>
);
}

View File

@ -81,7 +81,7 @@ class PostCardView extends Component {
};
render() {
const { content, isHideImage, fetchPost, isNsfwPost, isHideReblogOption, intl } = this.props;
const { content, isHideImage, fetchPost, isNsfwPost, intl } = this.props;
const { rebloggedBy } = this.state;
const _image = this._getPostImage(content, isNsfwPost);
@ -101,11 +101,7 @@ class PostCardView extends Component {
isPromoted={get(content, 'is_promoted')}
/>
<View style={styles.dropdownWrapper}>
<PostDropdown
isHideReblogOption={isHideReblogOption}
content={content}
fetchPost={fetchPost}
/>
<PostDropdown content={content} fetchPost={fetchPost} />
</View>
</View>
<View style={styles.postBodyWrapper}>

View File

@ -207,10 +207,14 @@ class PostDropdownContainer extends PureComponent {
};
render() {
const { intl, currentAccount, content, isHideReblogOption } = this.props;
const {
intl,
currentAccount: { name },
content,
} = this.props;
let _OPTIONS = OPTIONS;
if ((content && content.author === currentAccount.name) || isHideReblogOption) {
if ((content && content.author === name) || get(content, 'reblogged_by[0]', null) === name) {
_OPTIONS = OPTIONS.filter(item => item !== 'reblog');
}

View File

@ -1,3 +1,4 @@
/* eslint-disable react/jsx-wrap-multilines */
import React, { Component, Fragment } from 'react';
import { FlatList, View, ActivityIndicator, RefreshControl } from 'react-native';
import { injectIntl } from 'react-intl';
@ -296,7 +297,6 @@ class PostsView extends Component {
isLoginDone,
tag,
isDarkTheme,
isHideReblogOption,
} = this.props;
return (
@ -331,12 +331,7 @@ class PostsView extends Component {
data={posts}
showsVerticalScrollIndicator={false}
renderItem={({ item }) => (
<PostCard
isHideReblogOption={isHideReblogOption}
isRefresh={refreshing}
content={item}
isHideImage={isHideImage}
/>
<PostCard isRefresh={refreshing} content={item} isHideImage={isHideImage} />
)}
keyExtractor={(post, index) => index.toString()}
onEndReached={() => this._loadPosts()}

View File

@ -4,7 +4,7 @@ import { Platform, Alert } from 'react-native';
import { withNavigation } from 'react-navigation';
import RNIap, { purchaseErrorListener, purchaseUpdatedListener } from 'react-native-iap';
import { injectIntl } from 'react-intl';
import get from 'lodash/get';
// Services
import { purchaseOrder } from '../../../providers/esteem/esteem';
import bugsnag from '../../../config/bugsnag';
@ -55,21 +55,23 @@ class BoostContainer extends Component {
} = this.props;
this.purchaseUpdateSubscription = purchaseUpdatedListener(purchase => {
const receipt = purchase.transactionReceipt;
const receipt = get(purchase, 'transactionReceipt');
const token = get(purchase, 'purchaseToken');
if (receipt) {
const data = {
platform: Platform.OS === 'android' ? 'play_store' : 'app_store',
product: purchase.productId,
receipt: Platform.OS === 'android' ? purchase.purchaseToken : purchase.transactionReceipt,
product: get(purchase, 'productId'),
receipt: Platform.OS === 'android' ? token : receipt,
user: name,
};
purchaseOrder(data)
.then(() => {
if (Platform.OS === 'ios') {
RNIap.finishTransactionIOS(purchase.transactionId);
RNIap.finishTransactionIOS(get(purchase, 'transactionId'));
} else if (Platform.OS === 'android') {
RNIap.consumePurchaseAndroid(purchase.purchaseToken);
RNIap.consumePurchaseAndroid(token);
}
})
.catch(err =>
@ -83,23 +85,24 @@ class BoostContainer extends Component {
});
this.purchaseErrorSubscription = purchaseErrorListener(error => {
Alert.alert('Warning', error);
bugsnag.notify(error);
if (get(error, 'responseCode') !== 2) {
Alert.alert('Warning', error);
bugsnag.notify(error);
}
});
};
_getItems = async () => {
try {
const products = await RNIap.getProducts(ITEM_SKUS);
products.sort((a, b) => parseFloat(a.price) - parseFloat(b.price)).reverse();
await this.setState({ productList: products });
} catch (err) {
bugsnag.notify(err);
Alert.alert(
`Fetching data from server failed, please try again or notify us at info@esteem.app \n${err.message.substr(
0,
20,
)}`,
`Fetching data from server failed, please try again or notify us at info@esteem.app
${err.message.substr(0, 20)}`,
);
}

View File

@ -57,6 +57,7 @@ class BoostScreen extends PureComponent {
return (
<View style={globalStyles.container}>
<BasicHeader
disabled={isProccesing}
title={intl.formatMessage({
id: 'boost.title',
})}

View File

@ -14,7 +14,6 @@ export default EStyleSheet.create({
button: {
marginVertical: 12,
paddingHorizontal: 18,
// alignSelf: 'flex-start',
},
buttonContent: {
flexDirection: 'row',
@ -60,7 +59,7 @@ export default EStyleSheet.create({
},
description: {
fontSize: 10,
color: '$white',
color: '$pureWhite',
fontWeight: 'bold',
},
triangle: {

View File

@ -210,7 +210,6 @@ class ProfileScreen extends PureComponent {
handleOnScroll={this._handleOnScroll}
forceLoadPost={forceLoadPost}
changeForceLoadPostState={changeForceLoadPostState}
isHideReblogOption
/>
</View>
<View