purchases-ios icon indicating copy to clipboard operation
purchases-ios copied to clipboard

CAT-1509: Update SDK to reflect new SK2 Observer Mode Changes

Open fire-at-will opened this issue 1 year ago • 1 comments

Motivation

In light of https://github.com/RevenueCat/purchases-ios/pull/3853, we no longer require developers to call handleObserverModePurchase() when using Observer Mode with StoreKit2. To reflect these changes, a few changes needed to be made to the SDK's interface.

Changes:

  • Obsoleted configure(apiKey:appUserID:observerMode:storeKitVersion): this function was obsoleted since the basic configure functions should be as simple as possible. If a developer needs to use Observer Mode with StoreKit 1, they can use the Configuration.Builder's .with(observerMode:storeKitVersion) function. This function was only used in the 5.0 betas, so this won't be a breaking change for developers upgrading from 4.x versions.
  • Un-obsoleted the configure(apiKey:appUserID:observerMode) function and changed it to use the .default StoreKitVersion (which currently uses StoreKit 2)
  • Removed the warning log that appears when a developer uses StoreKit 2 with observer mode, instructing them to call handleObserverModePurchase() after making a purchase.
  • Updated documentation to reflect these changes, including the Version 5 migration guide.
  • Updated the tests to reflect these changes

Other Notes

This PR should only be merged if https://github.com/RevenueCat/purchases-ios/pull/3853 is also merged.

fire-at-will avatar May 03 '24 18:05 fire-at-will

1 Message
:book: Size increase: 8.66 KB

Generated by :no_entry_sign: Danger

RevenueCat-Danger-Bot avatar May 03 '24 18:05 RevenueCat-Danger-Bot

Sorry to keep going back and forth on this, but I'm confused:

Un-obsoleted the configure(apiKey:appUserID:observerMode) function and changed it to use the .default StoreKitVersion (which currently uses StoreKit 2)

Would this lead to the worst-case scenario? We need to know the version in order to set up the observing code, and if we default to SK2 then we're assuming that the customer's implementation is also SK2, which the vast majority of the time will be wrong.

Also we would make that API not breaking, which in turn means they wouldn't even know about it, right?

Shouldn't we be forcing anyone who's using observer mode to tell us which version to use?

aboedo avatar May 07 '24 20:05 aboedo

@aboedo You're totally right! I've updated the PR to leave the observer mode configure functions/builders alone and just update the documentation and log messages 😄

fire-at-will avatar May 09 '24 19:05 fire-at-will