Conversation
| fileprivate var checkoutQueryValue: String { | ||
| switch self { | ||
| case .authorized: | ||
| return "authorized" | ||
| case .denied: | ||
| return "denied" | ||
| case .notDetermined: | ||
| return "not_determined" | ||
| case .restricted: | ||
| return "restricted" | ||
| @unknown default: | ||
| return "unknown" | ||
| } |
There was a problem hiding this comment.
This is very verbose, and will inflate the checkout URL. Just _att=a/d/n/r/u should be enough.
| @@ -1,3 +1,6 @@ | |||
| #if canImport(AppTrackingTransparency) | |||
There was a problem hiding this comment.
Whilst we wait on approval it'd be good to confirm if we can drop iOS 13 (and maybe 14) depending on usage data, and it'll remove the can import stuff)
I scanned the last 7 days of traffic and saw nothing below 18 showup
| enum CheckoutAppTrackingTransparency { | ||
| static let queryParameterName = "_att" | ||
| static let notApplicableStatus = "not_applicable" | ||
| static var currentStatus: () -> String = defaultCurrentStatus |
There was a problem hiding this comment.
Do we need to keep track of a mutable value of the current status, and do we need to maintain a defaultCurrentStatus?
Seems like we should just be able to create a method that always accesses ATTTrackingManager.trackingAuthorizationStatus and maps it to the checkoutQueryValue
There was a problem hiding this comment.
I found it ugly, all for tests really. Is there a better mocking approach in swift?
What changes are you making?
Appends the App Tracking Transparency (ATT) authorization status as a
_attquery parameter to the checkout URL when presenting the checkout experience. This allows the checkout to be aware of the user's tracking consent status on iOS 14+.The ATT status is mapped to one of the following string values:
authorized,denied,not_determined,restricted,unknown, ornot_applicable(when ATT is unavailable on the platform). If a_attquery parameter already exists on the URL, it is replaced to ensure only a single value is present. The implementation conditionally importsAppTrackingTransparencyso it remains compatible with environments where the framework is unavailable.How to test
CheckoutURLTestscases pass, including:_attto a clean URL_att_attparameter is replaced rather than duplicated_attparameter reflects the device's current ATT authorization status.AppTrackingTransparencyis not available (e.g., macOS or older iOS targets) and thatnot_applicableis used in those cases.Before you merge
Important
platforms/swift/README.mdand/orplatforms/android/README.md)Releasing a new Swift version?
ShopifyCheckoutKit.podspecplatforms/swift/Sources/ShopifyCheckoutKit/ShopifyCheckoutKit.swiftplatforms/swift/CHANGELOG.mdplatforms/swift/README.md(major version only)Releasing a new Android version?
versionNameinplatforms/android/lib/build.gradleplatforms/android/CHANGELOG.mdplatforms/android/README.mdTip
See the Contributing documentation for the full release process per platform.