mirror of
https://github.com/ecency/ecency-mobile.git
synced 2024-12-24 13:53:23 +03:00
parse points url with product id and navigate to purchase
This commit is contained in:
parent
9670e829dd
commit
c5c1ad2ee6
@ -59,7 +59,7 @@ class InAppPurchaseContainer extends Component {
|
||||
await this._consumeAvailablePurchases()
|
||||
this._getItems();
|
||||
this._purchaseUpdatedListener();
|
||||
|
||||
await this._handleQrPurchase();
|
||||
} catch (err) {
|
||||
bugsnagInstance.notify(err);
|
||||
console.warn(err.code, err.message);
|
||||
@ -202,6 +202,15 @@ class InAppPurchaseContainer extends Component {
|
||||
}
|
||||
};
|
||||
|
||||
_handleQrPurchase = async () => {
|
||||
const { navigation, skus } = this.props as any;
|
||||
const products = await RNIap.getProducts(skus);
|
||||
const productId = navigation.getParam('productId', '');
|
||||
if(productId && products && products.find((product) => product.productId === productId)){
|
||||
await this._buyItem(productId);
|
||||
}
|
||||
}
|
||||
|
||||
render() {
|
||||
const { children, isNoSpin } = this.props;
|
||||
const { productList, isLoading, isProcessing } = this.state;
|
||||
|
@ -83,8 +83,8 @@ export const deepLinkParser = async (url, currentAccount) => {
|
||||
}
|
||||
|
||||
//if url is for purchase
|
||||
const { type, username} = parsePurchaseUrl(url) || {};
|
||||
console.log('type, username : ', type, username);
|
||||
const { type, username, productId} = parsePurchaseUrl(url) || {};
|
||||
// console.log('type, username, productId : ', type, username, productId);
|
||||
if(type && type === 'boost'){
|
||||
routeName = ROUTES.SCREENS.ACCOUNT_BOOST;
|
||||
params = {
|
||||
@ -96,6 +96,7 @@ export const deepLinkParser = async (url, currentAccount) => {
|
||||
routeName = ROUTES.SCREENS.BOOST;
|
||||
params = {
|
||||
username,
|
||||
productId
|
||||
};
|
||||
keey = `${type}/${username || ''}`;
|
||||
}
|
||||
|
@ -10,9 +10,11 @@ export default (urlString:string) => {
|
||||
if(url.pathname === '/purchase'){
|
||||
const type = url.searchParams.get('type');
|
||||
const username = url.searchParams.get('username');
|
||||
const productId = url.searchParams.get('product_id');
|
||||
return {
|
||||
type,
|
||||
username
|
||||
username,
|
||||
productId
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user