Paywalls: Add paywall events flush logic and tests (3)#1445
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #1445 +/- ##
==========================================
+ Coverage 83.95% 84.03% +0.08%
==========================================
Files 203 206 +3
Lines 6712 6842 +130
Branches 974 993 +19
==========================================
+ Hits 5635 5750 +115
- Misses 697 706 +9
- Partials 380 386 +6
☔ View full report in Codecov by Sentry. |
NachoSoto
left a comment
There was a problem hiding this comment.
Looks great!
I want to make sure this handles (and tests) a specific use case that's tested in iOS:
See PaywallEventStoreTests.testFetchEventsWithUnrecognizedLines:
That's basically testing that this code:
return try await self.handler.readLines()
.prefix(count)
.compactMap { try? PaywallEventSerializer.decode($0) }Is written like that, instead of
return try await self.handler.readLines()
.compactMap { try? PaywallEventSerializer.decode($0) }
.prefix(count)Notice prefix happens first
So that if invalid lines are found, they still get removed from the store.
|
Nope, I didn't have that logic. Thanks for mentioning it! I will fix that and add some tests tomorrow |
|
Made changes to handle this in #1451 |
6dbfdc1 to
795838c
Compare
**This is an automatic release.** ### RevenueCatUI * `Paywalls`: improve error log when images fail to load (#1454) via NachoSoto (@NachoSoto) ### Other Changes * Paywall events: Send paywall data with post receipt requests (#1452) via Toni Rico (@tonidero) * Paywalls: Track paywall events (#1447) via Toni Rico (@tonidero) * Paywall events: Handle errors parsing specific paywall event lines (#1451) via Toni Rico (@tonidero) * Paywalls: Move logic for events file helper to common generic class (4) (#1446) via Toni Rico (@tonidero) * Paywalls: Add paywall events flush logic and tests (3) (#1445) via Toni Rico (@tonidero) * Paywalls: Support sending paywall events to servers (2) (#1442) via Toni Rico (@tonidero) * `CircleCI`: fix `record-revenuecatui-snapshots` (#1455) via NachoSoto (@NachoSoto) * Lower request jitter log level from warning to debug (#1453) via Toni Rico (@tonidero) Co-authored-by: revenuecat-ops <ops@revenuecat.com>
Description
This adds the code to the
PaywallEventsManagerclass to actually send the events to the backend and clear them locally once finished.