mirror of
https://github.com/ecency/ecency-mobile.git
synced 2024-12-22 21:01:31 +03:00
created new boost container
This commit is contained in:
parent
f9de77470d
commit
7c1b7b16d6
@ -33,6 +33,7 @@
|
||||
"react/prop-types": 0,
|
||||
"import/no-named-default": "off",
|
||||
"no-param-reassign": "off",
|
||||
"no-case-declarations": "off"
|
||||
"no-case-declarations": "off",
|
||||
"no-cycle": "off"
|
||||
}
|
||||
}
|
||||
|
@ -1,3 +1,4 @@
|
||||
/* eslint-disable no-unused-vars */
|
||||
import React, { Component } from 'react';
|
||||
import { connect } from 'react-redux';
|
||||
import { Platform, Alert } from 'react-native';
|
||||
@ -5,15 +6,13 @@ 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';
|
||||
import bugsnag from '../config/bugsnag';
|
||||
import { purchaseOrder } from '../providers/esteem/esteem';
|
||||
|
||||
// Utilities
|
||||
import { default as ROUTES } from '../../../constants/routeNames';
|
||||
|
||||
// Component
|
||||
import BoostScreen from '../screen/boostScreen';
|
||||
import { default as ROUTES } from '../constants/routeNames';
|
||||
|
||||
const ITEM_SKUS = Platform.select({
|
||||
ios: ['099points', '199points', '499points', '999points', '4999points', '9999points'],
|
||||
@ -26,7 +25,7 @@ class BoostContainer extends Component {
|
||||
this.state = {
|
||||
productList: [],
|
||||
isLoading: true,
|
||||
isProccesing: false,
|
||||
isProcessing: false,
|
||||
};
|
||||
}
|
||||
|
||||
@ -41,6 +40,7 @@ class BoostContainer extends Component {
|
||||
this.purchaseUpdateSubscription.remove();
|
||||
this.purchaseUpdateSubscription = null;
|
||||
}
|
||||
|
||||
if (this.purchaseErrorSubscription) {
|
||||
this.purchaseErrorSubscription.remove();
|
||||
this.purchaseErrorSubscription = null;
|
||||
@ -74,7 +74,7 @@ class BoostContainer extends Component {
|
||||
} else if (Platform.OS === 'android') {
|
||||
RNIap.consumePurchaseAndroid(token);
|
||||
}
|
||||
this.setState({ isProccesing: false });
|
||||
this.setState({ isProcessing: false });
|
||||
})
|
||||
.catch(err =>
|
||||
bugsnag.notify(err, report => {
|
||||
@ -95,7 +95,7 @@ class BoostContainer extends Component {
|
||||
error.debugMessage,
|
||||
);
|
||||
}
|
||||
this.setState({ isProccesing: false });
|
||||
this.setState({ isProcessing: false });
|
||||
});
|
||||
};
|
||||
|
||||
@ -119,7 +119,7 @@ class BoostContainer extends Component {
|
||||
_buyItem = async sku => {
|
||||
const { navigation } = this.props;
|
||||
|
||||
await this.setState({ isProccesing: true });
|
||||
await this.setState({ isProcessing: true });
|
||||
|
||||
if (sku !== 'freePoints') {
|
||||
try {
|
||||
@ -139,17 +139,19 @@ class BoostContainer extends Component {
|
||||
};
|
||||
|
||||
render() {
|
||||
const { productList, isLoading, isProccesing } = this.state;
|
||||
const { children } = this.props;
|
||||
const { productList, isLoading, isProcessing } = this.state;
|
||||
// const FREE_ESTM = { productId: 'freePoints', title: 'free estm' };
|
||||
|
||||
return (
|
||||
<BoostScreen
|
||||
// productList={[...productList, FREE_ESTM]}
|
||||
productList={productList}
|
||||
buyItem={this._buyItem}
|
||||
isLoading={isLoading}
|
||||
isProccesing={isProccesing}
|
||||
/>
|
||||
children &&
|
||||
children({
|
||||
// productList: [...productList, FREE_ESTM],
|
||||
productList,
|
||||
buyItem: this._buyItem,
|
||||
isLoading,
|
||||
isProcessing,
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
@ -1,13 +1,15 @@
|
||||
import InAppPurchaseContainer from './inAppPurchaseContainer';
|
||||
import PointsContainer from './pointsContainer';
|
||||
import ProfileContainer from './profileContainer';
|
||||
import ProfileEditContainer from './profileEditContainer';
|
||||
import RedeemContainer from './redeemContainer';
|
||||
import TransferContainer from './transferContainer';
|
||||
import ProfileContainer from './profileContainer';
|
||||
|
||||
export {
|
||||
InAppPurchaseContainer,
|
||||
PointsContainer,
|
||||
ProfileContainer,
|
||||
ProfileEditContainer,
|
||||
RedeemContainer,
|
||||
TransferContainer,
|
||||
ProfileContainer,
|
||||
};
|
||||
|
@ -1,4 +0,0 @@
|
||||
import Boost from './container/boostContainer';
|
||||
|
||||
export { Boost };
|
||||
export default Boost;
|
@ -6,6 +6,9 @@ import get from 'lodash/get';
|
||||
// Components
|
||||
import { BasicHeader, Icon, MainButton, BoostPlaceHolder } from '../../../components';
|
||||
|
||||
// Container
|
||||
import { InAppPurchaseContainer } from '../../../containers';
|
||||
|
||||
// Styles
|
||||
import globalStyles from '../../../globalStyles';
|
||||
import styles from './boostScreenStyles';
|
||||
@ -20,9 +23,7 @@ class BoostScreen extends PureComponent {
|
||||
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state = {
|
||||
selectedBoost: 0,
|
||||
};
|
||||
this.state = {};
|
||||
}
|
||||
|
||||
// Component Life Cycles
|
||||
@ -39,6 +40,8 @@ class BoostScreen extends PureComponent {
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
return null;
|
||||
};
|
||||
|
||||
_getTitle = title => {
|
||||
@ -52,13 +55,14 @@ class BoostScreen extends PureComponent {
|
||||
};
|
||||
|
||||
render() {
|
||||
const { intl, buyItem, productList, isLoading, isProccesing } = this.props;
|
||||
const { selectedBoost } = this.state;
|
||||
const { intl } = this.props;
|
||||
|
||||
return (
|
||||
<InAppPurchaseContainer>
|
||||
{({ buyItem, productList, isLoading, isProcessing }) => (
|
||||
<View style={globalStyles.container}>
|
||||
<BasicHeader
|
||||
disabled={isProccesing}
|
||||
disabled={isProcessing}
|
||||
title={intl.formatMessage({
|
||||
id: 'boost.title',
|
||||
})}
|
||||
@ -78,7 +82,7 @@ class BoostScreen extends PureComponent {
|
||||
text={intl.formatMessage({
|
||||
id: 'boost.buy',
|
||||
})}
|
||||
isDisable={isProccesing}
|
||||
isDisable={isProcessing}
|
||||
isLoading={false}
|
||||
>
|
||||
<View style={styles.buttonContent}>
|
||||
@ -99,6 +103,8 @@ class BoostScreen extends PureComponent {
|
||||
))
|
||||
)}
|
||||
</View>
|
||||
)}
|
||||
</InAppPurchaseContainer>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,4 @@
|
||||
import { Bookmarks } from './bookmarks';
|
||||
import { Boost } from './boost';
|
||||
import { Drafts } from './drafts';
|
||||
import { Editor } from './editor';
|
||||
import { Follows } from './follows';
|
||||
@ -12,6 +11,7 @@ import { Points } from './points';
|
||||
import { Post } from './post';
|
||||
import { SearchResult } from './searchResult';
|
||||
import { Settings } from './settings';
|
||||
import Boost from './boost/screen/boostScreen';
|
||||
import Profile from './profile/screen/profileScreen';
|
||||
import ProfileEdit from './profileEdit/screen/profileEditScreen';
|
||||
import Reblogs from './reblogs';
|
||||
|
Loading…
Reference in New Issue
Block a user