This commit is contained in:
feruz 2021-08-07 06:57:05 +03:00
parent dd63fe8cca
commit 32ff70365d
2 changed files with 12 additions and 5 deletions

View File

@ -20,7 +20,7 @@ const BoostPlaceHolder = () => {
{({ isDarkTheme }) => {
const color = isDarkTheme ? '#2e3d51' : '#f5f5f5';
return (
<View style={styles.container} key={'key-' + i.toString()}>
<View style={styles.container} key={`key-${i.toString()}`}>
<View style={styles.line}>
<Placeholder.Box color={color} width={90} height={40} animate="fade" />
<View style={styles.paragraphWrapper}>

View File

@ -25,7 +25,14 @@ class InAppPurchaseContainer extends Component {
}
// Component Life Cycle Functions
componentDidMount() {
async componentDidMount() {
try {
await RNIap.initConnection();
await RNIap.flushFailedPurchasesCachedAsPendingAndroid();
} catch (err) {
bugsnagInstance.notify(err);
console.warn(err.code, err.message);
}
this._getItems();
this._purchaseUpdatedListener();
}
@ -40,6 +47,7 @@ class InAppPurchaseContainer extends Component {
this.purchaseErrorSubscription.remove();
this.purchaseErrorSubscription = null;
}
RNIap.endConnection();
}
// Component Functions
@ -111,16 +119,15 @@ class InAppPurchaseContainer extends Component {
_getItems = async () => {
const { skus } = this.props;
try {
const products = await RNIap.getProducts(skus);
console.log(products);
products.sort((a, b) => parseFloat(a.price) - parseFloat(b.price)).reverse();
await this.setState({ productList: products });
} catch (err) {
bugsnagInstance.notify(err);
Alert.alert(
`InApp - Connection issue, try again or write to support@ecency.com
`InApp - Connection issue
${err.message.substr(0, 20)}`,
);
}