mozilla-mobile / guardian-vpn-ios

Mozilla VPN for iOS
https://vpn.mozilla.org
Mozilla Public License 2.0
52 stars 16 forks source link

Create more useful user agent string for API calls #178

Closed connected-crwilson closed 4 years ago

connected-crwilson commented 4 years ago

SUMMARY

This PR changes the User-Agent string sent by the client in API calls from the default to a more readable and useful format for metrics and analytics. The new format is

<App Name>/<App Version> <Device Identifier>/<iOS Version>

with the following notes:

  1. <App Name> has whitespaces removed, to make for easier parsing on the backend.
  2. <Device Identifier> is of the form iPhone8,4, for example. Further converting this to the consumer-facing name, e.g. iPhone SE for the previous example, requires a nontrivial amount of additional code, and was deemed not worth the effort. See https://medium.com/ios-os-x-development/get-model-info-of-ios-devices-18bc8f32c254 for further info.