mirror of
https://github.com/ecency/ecency-mobile.git
synced 2024-12-25 06:13:12 +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()
|
await this._consumeAvailablePurchases()
|
||||||
this._getItems();
|
this._getItems();
|
||||||
this._purchaseUpdatedListener();
|
this._purchaseUpdatedListener();
|
||||||
|
await this._handleQrPurchase();
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
bugsnagInstance.notify(err);
|
bugsnagInstance.notify(err);
|
||||||
console.warn(err.code, err.message);
|
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() {
|
render() {
|
||||||
const { children, isNoSpin } = this.props;
|
const { children, isNoSpin } = this.props;
|
||||||
const { productList, isLoading, isProcessing } = this.state;
|
const { productList, isLoading, isProcessing } = this.state;
|
||||||
|
@ -83,8 +83,8 @@ export const deepLinkParser = async (url, currentAccount) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//if url is for purchase
|
//if url is for purchase
|
||||||
const { type, username} = parsePurchaseUrl(url) || {};
|
const { type, username, productId} = parsePurchaseUrl(url) || {};
|
||||||
console.log('type, username : ', type, username);
|
// console.log('type, username, productId : ', type, username, productId);
|
||||||
if(type && type === 'boost'){
|
if(type && type === 'boost'){
|
||||||
routeName = ROUTES.SCREENS.ACCOUNT_BOOST;
|
routeName = ROUTES.SCREENS.ACCOUNT_BOOST;
|
||||||
params = {
|
params = {
|
||||||
@ -96,6 +96,7 @@ export const deepLinkParser = async (url, currentAccount) => {
|
|||||||
routeName = ROUTES.SCREENS.BOOST;
|
routeName = ROUTES.SCREENS.BOOST;
|
||||||
params = {
|
params = {
|
||||||
username,
|
username,
|
||||||
|
productId
|
||||||
};
|
};
|
||||||
keey = `${type}/${username || ''}`;
|
keey = `${type}/${username || ''}`;
|
||||||
}
|
}
|
||||||
|
@ -10,9 +10,11 @@ export default (urlString:string) => {
|
|||||||
if(url.pathname === '/purchase'){
|
if(url.pathname === '/purchase'){
|
||||||
const type = url.searchParams.get('type');
|
const type = url.searchParams.get('type');
|
||||||
const username = url.searchParams.get('username');
|
const username = url.searchParams.get('username');
|
||||||
|
const productId = url.searchParams.get('product_id');
|
||||||
return {
|
return {
|
||||||
type,
|
type,
|
||||||
username
|
username,
|
||||||
|
productId
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user