Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NT-780] Add device identifier to prepared request headers #1045

Merged
merged 1 commit into from
Jan 23, 2020

Conversation

justinswart
Copy link
Contributor

@justinswart justinswart commented Jan 23, 2020

πŸ“² 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 the device_distinct_id instead of the user's ID.

πŸ›  How

Added a header, Kickstarter-iOS-App-UUID which will be set using the device's identifierForVendor value.

Note: As mentioned in #1044, according to the Apple docs, the identifierForVendor can be nil 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 our Service struct when this value is nil 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:

  • The Kickstarter-iOS-App-UUID header is present in all requests to the v1 API and its value is the device's identifier.
  • The Kickstarter-iOS-App-UUID header is present in all requests to GraphQL and its value is the device's identifier.
  • Deleting and reinstalling the app generates a new value.

@@ -19,21 +19,24 @@ public struct Service: ServiceType {
public let language: String
public let currency: String
public let buildVersion: String
public let deviceIdentifier: String
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In order to not make tons of changes I haven't alphabetized these properties for now. I have plans to do this when we do some refactoring of this type soon.

Copy link
Contributor

@ifbarrera ifbarrera left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm! πŸ‘

@justinswart justinswart merged commit d94ffac into master Jan 23, 2020
@justinswart justinswart deleted the NT-780-device-id-with-requests branch January 23, 2020 18:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants