Paywalls: add identifier to events#3332
Conversation
fd7f872 to
71acd2b
Compare
|
How are you thinking of this not being backwards compatible? Just drop previous unsent events? |
@NachoSoto The backend has this event id being optional so that its backwards compatible 🤷♂️ I could have made new "version 2" validation models on the backend but it wouldn't provide that much value and more code to maintain |
|
What i mean is that |
78eb666 to
e4ba124
Compare
The current API only provided a `CustomerInfo`. Note that this does not include `userCanceled`. We can expose separately with another `.onPurchaseCancelled` modifier in the future.
These were failing in some of the earlier Xcode 15 betas, but they all seem to be passing now. `PresentIfNeededTests` are still not working though. But I just manually verified that these modifiers do work correctly on iOS 17 on an app.
…e failing test right now)
The current API only provided a `CustomerInfo`. Note that this does not include `userCanceled`. We can expose separately with another `.onPurchaseCancelled` modifier in the future.
…3335) Requested by @joshdholtz for [paywalls-events-add-id](https://github.com/RevenueCat/purchases-ios/tree/paywalls-events-add-id) Co-authored-by: Distiller <distiller@static.38.39.183.26.cyberlynk.net>
…3336) Requested by @joshdholtz for [paywalls-events-add-id](https://github.com/RevenueCat/purchases-ios/tree/paywalls-events-add-id) Co-authored-by: Distiller <distiller@static.38.39.184.242.cyberlynk.net>
…3337) Requested by @joshdholtz for [paywalls-events-add-id](https://github.com/RevenueCat/purchases-ios/tree/paywalls-events-add-id) Co-authored-by: distiller <distiller@static.38.23.41.34.cyberlynk.net>
c1e0b1a to
e8cf052
Compare
e8cf052 to
07fa54a
Compare
| } | ||
|
|
||
| self.track(.close(data.withCurrentDate())) | ||
| self.track(.close(data.withNewID().withCurrentDate())) |
There was a problem hiding this comment.
Need this otherwise the id was the same for each event in the session 😅
There was a problem hiding this comment.
This is a smell in how we're using the type.
I think to prevent this we should put the Event.ID inside of PaywallEvent not PaywallEvent.Data. What do you think?
| public struct Data { | ||
|
|
||
| // swiftlint:disable missing_docs | ||
| public var id: ID? |
There was a problem hiding this comment.
Optional to make backwards compatible with previously stored events
There was a problem hiding this comment.
Let's leave a comment explaining that.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3332 +/- ##
==========================================
+ Coverage 85.98% 86.00% +0.02%
==========================================
Files 237 237
Lines 17086 17097 +11
==========================================
+ Hits 14691 14704 +13
+ Misses 2395 2393 -2 ☔ View full report in Codecov by Sentry. |
NachoSoto
left a comment
There was a problem hiding this comment.
Almost ready, a few comments:
- Re-using event data and having to change IDs
- Test for posting events with no ID
- Also can you add a test in
PaywallEventStoreTeststhat verifies that we can fetch events with no ID?
| } | ||
|
|
||
| self.track(.close(data.withCurrentDate())) | ||
| self.track(.close(data.withNewID().withCurrentDate())) |
There was a problem hiding this comment.
This is a smell in how we're using the type.
I think to prevent this we should put the Event.ID inside of PaywallEvent not PaywallEvent.Data. What do you think?
| public struct Data { | ||
|
|
||
| // swiftlint:disable missing_docs | ||
| public var id: ID? |
There was a problem hiding this comment.
Let's leave a comment explaining that.
| let data = storedEvent.event.data | ||
|
|
||
| self.init( | ||
| id: data.id?.uuidString, |
There was a problem hiding this comment.
Let's add a test verifying that we can send events with no ID.
|
Nit: I'd mark this as a "refactor" since it's not a user facing change that users need to know about in the release notes IMO. |
| } | ||
|
|
||
| self.track(.cancel(data.withCurrentDate())) | ||
| self.track(.cancel(.init(), data)) |
**This is an automatic release.** ### New Features * `PaywallColor`: change visibility of `Color.init(light:dark:)` to `private` (#3345) via NachoSoto (@NachoSoto) ### RevenueCatUI * `Paywalls`: new `.onPurchaseCompleted` overload with `StoreTransaction` (#3323) via NachoSoto (@NachoSoto) * `Paywalls`: finished template 5 (#3340) via NachoSoto (@NachoSoto) * `Paywalls`: new `onDismiss` parameter for `presentPaywallIfNeeded` (#3342) via NachoSoto (@NachoSoto) * `Paywalls`: disable shimmering on footer loading view (#3324) via NachoSoto (@NachoSoto) ### Bugfixes * `ErrorUtils.purchasesError(withSKError:)`: handle `URLError`s (#3346) via NachoSoto (@NachoSoto) ### Other Changes * `Paywalls`: add identifier to events (#3332) via Josh Holtz (@joshdholtz) * `Paywalls`: create new event session when paywall appears (#3330) via Josh Holtz (@joshdholtz) * `HTTPClient`: verbose logs for request IDs (#3320) via NachoSoto (@NachoSoto) * `Paywalls Tester`: fix `macOS` build (#3341) via NachoSoto (@NachoSoto) * `ProductFetcherSK1`: enable `TimingUtil` log (#3327) via NachoSoto (@NachoSoto) * `Paywall Tester`: fixed paywall presentation (#3339) via NachoSoto (@NachoSoto) * `CI`: replace Carthage build jobs with `xcodebuild` (#3338) via NachoSoto (@NachoSoto) * `Integration Tests`: use repetition count from test plan (#3329) via NachoSoto (@NachoSoto) * `Integration Tests`: new logs for troubleshooting flaky tests (#3328) via NachoSoto (@NachoSoto) * `CircleCI`: change iOS 17 job to use M1 Large resource (#3322) via NachoSoto (@NachoSoto) * `Paywalls Tester`: fix release build (#3321) via NachoSoto (@NachoSoto) * `Paywalls`: enable all iOS 17 tests (#3331) via NachoSoto (@NachoSoto) * `CI`: added workaround for Snapshots in `Xcode Cloud` (#2857) via NachoSoto (@NachoSoto) * `StoreKit 1`: disabled `finishTransactions` log on observer mode (#3314) via NachoSoto (@NachoSoto) --------- Co-authored-by: NachoSoto <ignaciosoto90@gmail.com>
Motivation
Send a unique
idon each paywall eventDescription
id: ID?toPaywallEvent.DatawithNewID()function that will mutate theidwhen tracked for cancel and closeEvents recored before
idchanges but posted withidchangesEvents recorded and posted with
idchanges