[NT-780] Add device identifier to prepared request headers #1045
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
📲 What
Adds the device identifier to our prepared request headers for requests to v1 endpoints and GraphQL queries/mutations.
🤔 Why
In order to properly attribute our Completed Checkout server-side events to Optimizely experimental variants, we need to send the
device_distinct_id
to the server so that Optimizely tracking calls can be made using thedevice_distinct_id
instead of the user's ID.🛠 How
Added a header,
Kickstarter-iOS-App-UUID
which will be set using the device'sidentifierForVendor
value.Note: As mentioned in #1044, according to the Apple docs, the
identifierForVendor
can benil
but this is only when the device has been restarted and not yet unlocked. There should not be any scenario in which we're instantiating ourService
struct when this value isnil
but if that were to happen then this value would just coalesce to a random UUID string.✅ Acceptance criteria
Run the app in the simulator and using Charles Proxy observe the following:
Kickstarter-iOS-App-UUID
header is present in all requests to the v1 API and its value is the device's identifier.Kickstarter-iOS-App-UUID
header is present in all requests to GraphQL and its value is the device's identifier.