OneSignal is a free push notification service for mobile apps. This plugin makes it easy to integrate your native iOS app with OneSignal. https://onesignal.com
Other
493
stars
262
forks
source link
[Feat] Combine user property updates for network call improvements, fix purchase bug #1444
Combine user property updates for network call improvements by combining these updates into one request, and fix a purchase tracking bug.
Details
This PR is best read commit by commit
Session time, count, purchases - these changes are not model driven and now enqueue as a Delta whereas they used to be turned into Request objects immediately
Updated attributed and unattributed time processors to send the session time using the changes above. They will not manage their own background tasks when the app is backgrounding. They will not manage the storage of the user's session time once that time is sent to the User module to handle (except for outcomes which is separate of the user).
Introduce an enum OSPropertiesSupportedProperty, that restricts the properties we allow for updating a user.
Actual changes to combine User Update Deltas into one request
Fix a bug in purchase tracking where a number is sent when the server expects a string (amount).
Update existing tests after the above changes and add tests.
Motivation
Reduce server load.
Scope
Individual OSDeltas' updates are combined into one payload and request.
Other than that, Deltas and Requests are still handled and cached the same.
Previously, a single change was a single request.
Now there may be more surface area for request failure with increased payload.
Added an enum representing the user property updates that can be made (such as language, session_time, etc) and block against any unsupported ones (mostly for future-proofing).
OSDeltas can now be created and enqueued manually, whereas in the past, they were solely driven by model changes.
Fixed purchase tracking's price property.
Testing
Unit testing
Updated existing unit tests to reflect combining Deltas
Added helpers to compare requests and their payload now that the payload can hold more data
Added a test in which various user updates are made and confirm they are sent in one payload correctly
Added a test in Objective C to test sending purchases
Manual testing
Physical iPhone 13 on iOS 17.4
Tested session ending influences, both attributed and unattributed
Confirmed: When app is backgrounded, session time is sent to the Operation Repo before it flushes.
Tested adding tags, purchases, and backgrounding app to get session time
Description
One Line Summary
Combine user property updates for network call improvements by combining these updates into one request, and fix a purchase tracking bug.
Details
This PR is best read commit by commit
OSPropertiesSupportedProperty
, that restricts the properties we allow for updating a user.amount
).Motivation
Reduce server load.
Scope
Testing
Unit testing
Manual testing
Physical iPhone 13 on iOS 17.4
Tested session ending influences, both attributed and unattributed
Tested adding tags, purchases, and backgrounding app to get session time
Tested logging into users and making tags updates
Affected code checklist
Checklist
Overview
Testing
Final pass
This change is