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

PurchaserInfo not updated when internet connection is not available #55

Closed
larryonoff opened this issue Oct 4, 2022 · 2 comments
Closed
Labels
enhancement New feature or request

Comments

@larryonoff
Copy link
Contributor

Our application replies on Adapty purchaser info by using AdaptyDelegate.didReceiveUpdatedPurchaserInfo. Adapty requests PurchaserInfo from backed in Adapty.activate method. But didReceiveUpdatedPurchaserInfo not reported when internet connection is not available.

There's an option to get PurchaserInfo, i.e. Adapty.getPurchaserInfo(forceUpdate:). So the there's a flow:

  1. call Adapty.activate
  2. call Adapty.getPurchaserInfo(forceUpdate: false)

this entails possible two requests to simultaneous requests to backed when internet is available. What is not optimal.

So I propose two options.

  1. Call AdaptyDelegate.didReceiveUpdatedPurchaserInfo in private func configure(_ completion: ErrorCompletion? = nil) when purchaserInfo is not empty, before identify or getPurchaserInfo calls. Fix didReceiveUpdatedPurchaserInfo when internet is not available #54
  2. Add Adapty.getPurchaserInfo(forceUpdate:) option to skip network request.

Thanks!

@x401om
Copy link
Contributor

x401om commented Oct 14, 2022

Hi!

The delegate function didReceiveUpdatedPurchaserInfo, as its name and documentation suggest, should only tell the user about the updated state of PurchaserInfoModel, so I'm not sure if the behaviour you describe is a bug.
You can indeed get PurchaserInfoModel from the cache (if it is already there), by calling Adapty.getPurchaserInfo(forceUpdate: false).

I understand your concern about duplicate queries, and it probably makes sense to add some explicit way to get user information from the cache. In version 2.0 (coming very soon) and beyond, we'll think about how to do this properly.

I will leave this issue open as a reminder to us, but I will close your PR. As soon as something changes in this issue, I'll let you know!

@x401om
Copy link
Contributor

x401om commented Nov 8, 2022

Hey, @larryonoff ! We have released the new version of our SDK, check it out!

Here is the part of our docs about this thing.

@x401om x401om closed this as completed Nov 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants