Configuration: log warning if attempting to use observer mode with StoreKit 2#3066
Conversation
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #3066 +/- ##
==========================================
- Coverage 85.93% 85.89% -0.05%
==========================================
Files 233 233
Lines 16654 16662 +8
==========================================
Hits 14312 14312
- Misses 2342 2350 +8
☔ View full report in Codecov by Sentry. |
tonidero
left a comment
There was a problem hiding this comment.
I'm wondering about whether we need to undeprecate the storekit 2 setting... But I understand linking observer mode to the storeKit2 setting, so I think this is probably better
There was a problem hiding this comment.
I'm wondering whether we really need to keep useStoreKit2IfAvailable deprecated... Considering we still need to use it here. Also, devs can potentially do .with(observerMode: false, storeKit2: true), to bypass the deprecation and achieve the same result, so it's pretty much as if it wasn't deprecated...
There was a problem hiding this comment.
I'm wondering whether we really need to keep useStoreKit2IfAvailable deprecated...
@aboedo and I talked about this yesterday. We think it makes sense to keep it deprecated until we finish supporting SK2 in the backend, at which point we'll at least be following Apple's guidance.
There was a problem hiding this comment.
Also, devs can potentially do .with(observerMode: false, storeKit2: true)
Yeah maybe the method should have never been .with(observerMode: Bool) but instead .enableObserverMode().
There was a problem hiding this comment.
Feels a little odd to have to select "storekit 2 false" now, like, I'm not sure that tells you all that much about what's happening.
How about
enum StoreKitVersion {
case StoreKit1, StoreKit2
}
.with(observerMode: Bool, storeKitVersion: StoreKitVersion) -> Builder {(well, with changes for objc compatibility for the enum and stuff)
There was a problem hiding this comment.
Isn't that the same for usesStoreKit2IfAvailable? We made that a Bool too.
While we're at it, we could add an overload of that one to use this new enum. What do you think?
There was a problem hiding this comment.
I wouldn't add a new API that's already deprecated when we add it.
I was only suggesting that
.with(observerMode: false, storeKitVersion: storeKit1)might be slightly more expressive than
.with(observerMode: false, storeKit2: false)But I don't feel strongly about it
There was a problem hiding this comment.
That way the docstring can read something like
* Set `observerMode` with a corresponding `StoreKit` implementation
* - Parameter storeKitVersion: Set this to the StoreKit implementation
* your app uses for purchases.
* I.e.: if your app uses StoreKit 1, set it to `.storeKit1`,
* and if your app uses StoreKit 2, set it to `.storeKit2`.
* Apps using StoreKit 1 use `SKPaymentQueue` for transactions,
* whereas StoreKit 2 uses `StoreKit.Product.Purchase`. Added some more text in case folks don't know which is which. Apple removed many of the SK1 docs, so I think it's likely that folks will start getting confused about this over time as SK1 slowly fades away
There was a problem hiding this comment.
I'd avoid adding a new enum + docs + Obj-C equivalent etc just for one API.
But I do think it makes sense to change the deprecated method (which arguably won't be once we fully support SK2) to use it as well.
There was a problem hiding this comment.
I'd avoid adding a new enum + docs + Obj-C equivalent etc just for one API.
But I do think it makes sense to change the deprecated method (which arguably won't be once we fully support SK2) to use it as well.
I missed this comment but that makes a lot of sense
There was a problem hiding this comment.
I wonder if we should deprecate this method and ask people to use the other one to make it more explicit...
There was a problem hiding this comment.
I think that would be a good way to notify developers that are currently using this function
There was a problem hiding this comment.
Yeah I'll do that.
There was a problem hiding this comment.
If a developer is currently using this function, it's almost certain that they're using SK1, though, right? Like, it seems fairly unlikely that you:
- have an existing SK1 implementation that you don't want to touch, but you want RC, so you add observer mode
- decide that you do want to move into SK2, but still want to keep RC in observer mode
Right?
So I'd vote to just keep it without deprecation
There was a problem hiding this comment.
I think that would be a good way to notify developers that are currently using this function
90cabe0 to
8f5f709
Compare
Configuration: added observerMode overload that allows configuring SK2 settingConfiguration: changed observerMode method to select SK2 setting
There was a problem hiding this comment.
This was missing from the API tester.
There was a problem hiding this comment.
That way the docstring can read something like
* Set `observerMode` with a corresponding `StoreKit` implementation
* - Parameter storeKitVersion: Set this to the StoreKit implementation
* your app uses for purchases.
* I.e.: if your app uses StoreKit 1, set it to `.storeKit1`,
* and if your app uses StoreKit 2, set it to `.storeKit2`.
* Apps using StoreKit 1 use `SKPaymentQueue` for transactions,
* whereas StoreKit 2 uses `StoreKit.Product.Purchase`. Added some more text in case folks don't know which is which. Apple removed many of the SK1 docs, so I think it's likely that folks will start getting confused about this over time as SK1 slowly fades away
2b43259 to
af0ea6c
Compare
af0ea6c to
d5d78b3
Compare
|
Planning to ship this with the paywalls release since they both require a minor. |
|
Updated this per our conversation:
|
Configuration: changed observerMode method to select SK2 settingConfiguration: new .with(observerMode:storeKitVersion:)
| public extension Configuration.Builder { | ||
|
|
||
| /// Set `usesStoreKit2IfAvailable`. If `true`, the SDK will use StoreKit 2 APIs internally. If disabled, it will use StoreKit 1 APIs instead. | ||
| /// Set `storeKit2Setting`. If `true`, the SDK will use StoreKit 2 APIs internally. If disabled, it will use StoreKit 1 APIs instead. |
There was a problem hiding this comment.
This is the name of the property in Configuration.Builder.
There was a problem hiding this comment.
should we use double backticks to create a code reference then, so mismatches get caught at the docs generation step?
|
Changing this since we can't support observer mode + SK2. |
47e015f to
75063bd
Compare
Configuration: new .with(observerMode:storeKitVersion:)Configuration: log warning if attempting to use observer mode with StoreKit 2
4fd073c to
17fce11
Compare
17fce11 to
6a82362
Compare
…StoreKit 2 See also https://github.com/RevenueCat/revenuecat-docs/pull/299. Since #3032 developers using observer mode need to configure the SDK with the correct StoreKit 2 setting. This new API makes that explicit, while leaving `with(usesStoreKit2IfAvailable:)` still deprecated.
6a82362 to
5e7f906
Compare
Hey, is there any insights on availability of SK 2 support for the observer mode? Also is there any way to just manually call something like ‘trackPurchase(transaction)’? Thanks |
@slavasemeniuk |
aboedo
left a comment
There was a problem hiding this comment.
do we plan on doing the syncObserverModePurchase thing? Is this an intermediate step?
| public extension Configuration.Builder { | ||
|
|
||
| /// Set `usesStoreKit2IfAvailable`. If `true`, the SDK will use StoreKit 2 APIs internally. If disabled, it will use StoreKit 1 APIs instead. | ||
| /// Set `storeKit2Setting`. If `true`, the SDK will use StoreKit 2 APIs internally. If disabled, it will use StoreKit 1 APIs instead. |
There was a problem hiding this comment.
should we use double backticks to create a code reference then, so mismatches get caught at the docs generation step?
Yup that's the plan (@MarkVillacampa do you think you can take on that? I think you're pretty familiar with the setup now, and I'm happy to support you in the process :)) This is an intermediate step. Once the API is available we can remove the warning and update the documentation |
See also https://github.com/RevenueCat/revenuecat-docs/pull/299.
Since #3032 developers using observer mode need to configure the SDK with the correct StoreKit 2 setting.