Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does not support multiple calls to load() #58

Closed
daveclay opened this issue Oct 3, 2014 · 4 comments
Closed

Does not support multiple calls to load() #58

daveclay opened this issue Oct 3, 2014 · 4 comments

Comments

@daveclay
Copy link

daveclay commented Oct 3, 2014

There's a bug in the Javascript where the plugin won't maintain which product IDs have been previously loaded in a load() call, and therefore won't allow you to purchase a product that has previously been loaded.

If I call storekit.load("A"), then call storekit.load("B"), the InAppPurchase.js overwrites the array of productIDs with "B" only.

This happens on line 196 of InAppPurchase.js:

    InAppPurchase._productIds = productIds;

Our use case for this is a paginated list of products from our server. Rather than loading up hundreds of products from our server on app start, we paginate them, loading them from the app store as we get the products from our server.

@daveclay
Copy link
Author

daveclay commented Oct 3, 2014

FYI - I'm working around this by re-setting that property with my own list of loaded product IDs in the load callback:

        self.storekit.constructor._productIds = self.loadedProducts;

@j3k0
Copy link
Owner

j3k0 commented Oct 27, 2014

Labelled this as "enhancement":

make sure the new store.register() method can be called at any moment of the application life-cycle to load additional products.

Did you run any experiments on how expensive it is to load all hundreds of products at start? I would be interested by some numbers, or even approximations.

@j3k0
Copy link
Owner

j3k0 commented Oct 27, 2014

I just did some experiment. The highest data size I could reach for 1 single product using all 75 characters of the title and 255 characters for the title is 417 bytes.

Assuming Apple doesn't enable compression on their requests (which I doubt, but who knows), it will be a maximum payload of 41kB for each 100 products.

Now if it's compressed (which I suspect), there would be no reasons to optimize the loading of products even if there are thousands of them. Some real world experiment would be required though.

@j3k0 j3k0 added the Backlog label May 26, 2016
@stale
Copy link

stale bot commented May 11, 2018

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label May 11, 2018
@stale stale bot closed this as completed Jun 10, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants