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

Prevent duplicate attribution #2956

Merged
merged 2 commits into from
Jun 19, 2024
Merged

Conversation

samsymons
Copy link
Contributor

Task/Issue URL: https://app.asana.com/0/414235014887631/1207577042982475/f
Tech Design URL:
CC:

Description:

This PR updates the attribution sender to be extra sure we can't send the pixel multiple times.

Steps to test this PR:

To test this PR means forcing the attribution call to take a few seconds.

  1. Add try await Task.sleep(interval: .seconds(10)) into the reportAttributionIfNeeded function, adding it on line 66 right above the pixel call would be fine
  2. Make sure you haven't already sent attribution on this device before, if so then uninstall/reinstall the app
  3. Launch the app, and when you do, background and foreground the app rapidly for 10 seconds
  4. Check that you get one attribution pixel mentioned in the console logs during this time

Device Testing:

  • iPhone SE (1st Gen)
  • iPhone 8
  • iPhone X
  • iPhone 14 Pro
  • iPad

OS Testing:

  • iOS 14
  • iOS 15
  • iOS 16

Internal references:

Software Engineering Expectations
Technical Design Template

This is so that multiple Tasks being spawns to attempt attribution will not cause a rarer version of the problem this PR fixes.
@samsymons samsymons requested a review from dus7 June 14, 2024 20:11
final class AdAttributionPixelReporter {
final actor AdAttributionPixelReporter {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changing this to an actor so that multiple detached Tasks trying to report attribution at once will behave as we'd like.

@samsymons samsymons merged commit 56ded44 into main Jun 19, 2024
18 checks passed
@samsymons samsymons deleted the sam/prevent-duplicate-attribution branch June 19, 2024 18:54
samsymons added a commit that referenced this pull request Jun 20, 2024
# By Mariusz Śpiewak (4) and others
# Via GitHub (1) and others
* main:
  Additional Autofill KPI pixels (#2943)
  Prevent duplicate attribution (#2956)
  Release 7.125.0-2 (#2969)
  Disable ad attribution reporting (#2968)
  Fix haptic feedback for refresh control (#2942)
  Release 7.125.0-1 (#2966)
  Add two more pixels to the dashboard experiment (#2963)
  VPN state workarounds (#2938)
  RMF: New "Interacted With Message" matching attribute (#2947)
  Release 7.125.0-0 (#2962)
  don't refresh swipe tabs data source if autoclearing (#2960)
  Fall back to accentColor for iOS 15 and below (#2952)

# Conflicts:
#	DuckDuckGo.xcodeproj/project.pbxproj
#	DuckDuckGo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved
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