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

[WEB-862] AppTrackingTransparency Authorization #1772

Merged
merged 6 commits into from
Jan 19, 2023

Conversation

scottkicks
Copy link
Contributor

@scottkicks scottkicks commented Jan 18, 2023

📲 What

Presents Apple's AppTransparencyFramework dialog on app didFinishLaunching.

🤔 Why

With iOS 14.5+ you need to receive the user’s permission through the AppTrackingTransparency framework in order to track them or access their device’s advertising identifier.

We need to meet this requirement in order to ethically track facebook ads related data.

context around our consent management initiative
context around our facebook conversions api initiative that will be gates by this authorization status

🛠 How

  • Add NSUserTrackingUsageDescription in the info.plist
  • when application didFinishLaunchingWithOptions use the AppTrackingTransparency Framework to request authorization
  • The framework takes care of saving the authorization status for us. I have the completion handler here returning an internal ATTrackingAuthorizationStatus enum to be used by whomever consumes the Signal.

Apple only allows us to request this dialog once per fresh install until someone decides to allow or deny permission.

👀 See

Trello, screenshots, external resources?

After 🦋
Simulator Screen Recording - iPhone 13 Pro - 2023-01-18 at 10 27 06

⏰ TODO

  • verify that the dialog still shows up when the app is opened from a deep-link

@scottkicks scottkicks added this to the release-5.7.0 milestone Jan 18, 2023
@scottkicks scottkicks self-assigned this Jan 18, 2023
@codecov
Copy link

codecov bot commented Jan 18, 2023

Codecov Report

Merging #1772 (e166e80) into circleci/pipeline-queue (77e4fc7) will decrease coverage by 0.02%.
The diff coverage is 43.33%.

❗ Current head e166e80 differs from pull request most recent head a5df41e. Consider uploading reports for the commit a5df41e to get more accurate results

@@                     Coverage Diff                     @@
##           circleci/pipeline-queue    #1772      +/-   ##
===========================================================
- Coverage                    85.25%   85.24%   -0.02%     
===========================================================
  Files                         1276     1276              
  Lines                       116652   116682      +30     
  Branches                     30760    30779      +19     
===========================================================
+ Hits                         99451    99464      +13     
- Misses                       16128    16144      +16     
- Partials                      1073     1074       +1     
Impacted Files Coverage Δ
Kickstarter-iOS/AppDelegateViewModel.swift 91.60% <22.72%> (-1.90%) ⬇️
Kickstarter-iOS/AppDelegateViewModelTests.swift 98.96% <100.00%> (+<0.01%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@scottkicks scottkicks marked this pull request as ready for review January 18, 2023 20:16
@scottkicks scottkicks requested a review from msadoon January 18, 2023 20:16
Copy link
Contributor

@msadoon msadoon left a comment

Choose a reason for hiding this comment

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

Hey Scott, mostly good, made some comments.
We can discuss any questions in our meeting too!

Kickstarter-iOS/AppDelegateViewModel.swift Outdated Show resolved Hide resolved
Kickstarter-iOS/AppDelegateViewModel.swift Outdated Show resolved Hide resolved
Kickstarter-iOS/AppDelegateViewModel.swift Outdated Show resolved Hide resolved
Kickstarter-iOS/AppDelegateViewModel.swift Show resolved Hide resolved
Kickstarter-iOS/Info.plist Show resolved Hide resolved
* ATTrackingAuthorizationStatus to its own file
* Use `.ksr_debounce` on Signal instead of `asyncAfter`
* Handle `restricted` and `@unknown` requestTrackingAuthorization status cases
* Improve unit test
Copy link
Contributor

@msadoon msadoon left a comment

Choose a reason for hiding this comment

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

Looks good! Just one thing I just realized ksr_debounce might work but not be completely accurate as it calculates the time between signals, which might work in this case. ksr_delay is another option that seems like a better fit here.

@sclampet
Copy link

@msadoon good call out. thanks for the insight. I'll go with the more consistent approach of ksr_delay

@scottkicks scottkicks merged commit 6e900b8 into circleci/pipeline-queue Jan 19, 2023
@scottkicks scottkicks deleted the web-862 branch January 19, 2023 18:03
scottkicks added a commit that referenced this pull request Jan 24, 2023
* [WEB-861] Consent Management feature flag (#1764)

* Add new Consent Management Dialog feature flag

* Add new Consent Management Dialog feature flag

* remove failing view controller test assertion

* formatting

* Adding a small commit so tests pass on CI.

Didn't realize that if we removed the feature from the mock client, the recording would would still have it in the snapshot and our old snapshot wouldn't have been updated yet.

* formatting

Co-authored-by: Mubarak Sadoon <msadoon@gmail.com>

* [WEB-696] FacebookResetPassword Improvements (#1765)

* remove ResetYourFacebookPasswordViewController snapshots

* rename viewmodel and viewcontroller

* viewmodel form logic suggestions

* update viewmodel tests

* ensure the scrollview is not hidden by the keyboard

* set returnKeyType to go and make api call on tap

* update accessibility on set your password view controller

* updated accessibility for facebookresetpasswordviewcontroller.

* formatting

Co-authored-by: Mubarak Sadoon <msadoon@gmail.com>

* [WEB-669] Facebook Conversions API Feature Flag (#1766)

* add facebook conversions api feature flag

* add facebook conversions api feature flag

* fix test

* [WEB-862] AppTrackingTransparency Authorization (#1772)

* set NSUserTrackingUsageDescription in plist

* request ATTrackingAuthorization on app applicationdidFinishLaunching

* formatting

* gate behind consent management dialog feature flag

* pr feedback
* ATTrackingAuthorizationStatus to its own file
* Use `.ksr_debounce` on Signal instead of `asyncAfter`
* Handle `restricted` and `@unknown` requestTrackingAuthorization status cases
* Improve unit test

* use ksr_delay insted of ksr_debounce

Co-authored-by: Mubarak Sadoon <msadoon@gmail.com>
@msadoon msadoon modified the milestones: release-5.7.0, release-5.6.1 Feb 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants