AdaptySDK-iOS icon indicating copy to clipboard operation
AdaptySDK-iOS copied to clipboard

PurchaserInfo not updated when internet connection is not available

Open larryonoff opened this issue 3 years ago • 1 comments

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. #54
  2. Add Adapty.getPurchaserInfo(forceUpdate:) option to skip network request.

Thanks!

larryonoff avatar Oct 04 '22 11:10 larryonoff

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 avatar Oct 14 '22 12:10 x401om

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 avatar Nov 08 '22 18:11 x401om