-
Notifications
You must be signed in to change notification settings - Fork 16
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
PixelKit adoption #2557
PixelKit adoption #2557
Conversation
# Conflicts: # DuckDuckGo.xcodeproj/project.pbxproj # DuckDuckGo/DataImport/Model/DataImportViewModel.swift # DuckDuckGo/Preferences/View/PreferencesRootView.swift # UnitTests/Statistics/ATB/StatisticsLoaderTests.swift
Task/Issue URL: https://app.asana.com/0/0/1207002879349167/f **Description**: Migrates the Installation Attribution Pixel to use PixelKit. <img width="1289" alt="Screenshot 2024-04-08 at 4 07 47 PM" src="https://github.com/duckduckgo/macos-browser/assets/1089358/fcaf4fc2-f4b8-4d9e-a9b7-ef80f96cff97"> **Steps to test this PR:** Download the Review App [here](https://github.com/duckduckgo/macos-browser/actions/runs/8595167779/artifacts/1393075355) Make sure to clean up the app's data directory by running sh clean-app.sh review. Run the App. Search for pixel:m.mac.install in Kibana. **Extra:** Create the Origin.txt file manually and add it to the Bundle of the App (.app/Contents/Resources) to test that the pixel fires and has the origin field set. This requires to re-sign the App again in order to run it. Steps to re-sign the App [here](https://github.com/duckduckgo/macos-browser/blob/988a3ef69aaf3c69fa2b56b274de5fa113d73809/.github/workflows/create_variants.yml#L142) In terminal: codesign -d --entitlements :- DuckDuckGo.app > entitlements.plist Copy result of security find-certificate -a -c "Developer ID Application" -Z | grep ^SHA-1 | cut -d " " -f3 | uniq Code sign the App using the below: --force \ --sign <paste value generated from #2 here> \ --options runtime \ --entitlements entitlements.plist \ --generate-entitlement-der “DuckDuckGo.app” Once the App is re-signed you need to open it by right-click on the icon and select Open from the context menu otherwise you won’t be able to open it.
…Storage" debug menu
# Conflicts: # DuckDuckGo/Application/AppDelegate.swift # DuckDuckGo/MainWindow/MainViewController.swift # DuckDuckGo/NavigationBar/View/MoreOptionsMenu.swift # DuckDuckGo/NavigationBar/View/NavigationBarViewController.swift # DuckDuckGo/NetworkProtection/AppTargets/BothAppTargets/NetworkProtectionNavBarButtonModel.swift # DuckDuckGo/Waitlist/Waitlist.swift # DuckDuckGo/Waitlist/WaitlistTermsAndConditionsActionHandler.swift
@@ -97,6 +97,15 @@ final class AppDelegate: NSObject, NSApplicationDelegate { | |||
var updateController: UpdateController! | |||
#endif | |||
|
|||
static private var aMonthAgo = Calendar.current.date(byAdding: .month, value: -1, to: Date())! // Temporary for init |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code moved from Pixel.swift to AppDelegate, I'm sure this isn't the right place or approach but it's comparable to the previous one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we have Date.monthAgo
in BSK.Common.DateExtensions
, worths removing this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Much better, thanks, fixed
@testable import DuckDuckGo_Privacy_Browser | ||
|
||
/* | ||
WARNING: This component doesn't work anymore, re-implementation needed | ||
https://app.asana.com/0/0/1207002879349166/f |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's no active experiments in macOS atm, the re-implementation is scheduled as part of this refactoring.
# Conflicts: # DuckDuckGo/HomePage/Model/HomePageContinueSetUpModel.swift # DuckDuckGo/NavigationBar/View/MoreOptionsMenu.swift # DuckDuckGo/NavigationBar/View/NavigationBarViewController.swift # DuckDuckGo/Tab/Model/Tab.swift
@@ -22,6 +22,7 @@ import Combine | |||
import BrowserServicesKit | |||
import PrivacyDashboard | |||
import Common | |||
import PixelKit |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed and tested by me
# Conflicts: # DuckDuckGo/Tab/Model/Tab.swift
# Conflicts: # DuckDuckGo/DBP/DBPHomeViewController.swift # DuckDuckGo/History/Services/EncryptedHistoryStore.swift # DuckDuckGo/NetworkProtection/NetworkExtensionTargets/NetworkExtensionTargets/MacPacketTunnelProvider.swift # LocalPackages/PixelKit/Sources/PixelKit/PixelKit.swift # LocalPackages/PixelKit/Tests/PixelKitTests/PixelKitTests.swift
DuckDuckGo.xcodeproj/xcshareddata/xcschemes/sandbox-test-tool.xcscheme
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Narrow +1 on the /PasswordManager
code, which LGTM 🚀. However, I left a comment on an unrelated part of the code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added some more comments, will be testing meanwhile.
LocalPackages/PixelKit/Sources/PixelKitTestingUtilities/XCTestCase+PixelKit.swift
Show resolved
Hide resolved
DuckDuckGo/NetworkProtection/AppTargets/BothAppTargets/NetworkProtectionDebugMenu.swift
Outdated
Show resolved
Hide resolved
@@ -16,7 +16,13 @@ | |||
// limitations under the License. | |||
// | |||
|
|||
/* | |||
WARNING: This component doesn't work anymore, re-implementation needed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not to drop it then?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason is that the overall implementation is probably correct but it will need to be migrated to PixelKit, I wanted to make the re-implementation easier avoiding the need to recover the files. Anyway, I added all the info in https://app.asana.com/0/0/1207002879349166/f so I have no preferences, I can remove it if needed.
case .protectionToggledOffBreakageReport: return "m_mac_protection-toggled-off-breakage-report" | ||
case .toggleProtectionsDailyCount: return "m_mac_toggle-protections-daily-count" | ||
case .toggleReportDoNotSend: return "m_mac_toggle-report-do-not-send" | ||
case .toggleReportDismiss: return "m_mac_toggle-report-dismiss" | ||
|
||
// Password Import Keychain Prompt | ||
// Password Import Keychain Prompt |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indentation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that's apparently the correct indentation in the context, all other comments are the same and Xcode re-intend it like that
case .bitwardenRespondedCannotDecryptUnique: | ||
return "bitwarden_responded_cannot_decrypt_unique" | ||
case .bitwardenRespondedCannotDecrypt: | ||
return "bitwarden_responded_cannot_decrypt_d" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just making sure, is this change reflected in grafana?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The changes look good to me, see minor styling comments inline;
One note: as I remember we were going to drop pixel CoreData storage in favor of User Defaults storage, and here it‘s renamed…
# Conflicts: # DuckDuckGo/Tab/Model/Tab.swift
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved.
Task/Issue URL:https://app.asana.com/0/1205842942115003/1206999268603553/f Tech Design URL:https://app.asana.com/0/1205842942115003/1206989773504216/f CC: @diegoreymendez **Description**: Migrating the entire app to PixelKit changing pixel.fire() to PixelKit.fire() with related name and frequency changes. The few logic changes are concentrated in PixelKit. - Old Pixel implementation removed - PixelKit adopted for every Pixel - PixelKit code improved - Debug menu "remove daily pixels" changed in "Remove Pixels Storage" (reset all unique and daily pixels)
Pixels fired for email autofill use-cases are intentionally not prefixed with `m.mac.`, though the historical reason isn't clear to me. The migration to PixelKit for pixel management[^1] caused those email-related pixels to be prefixed. Wrap email-related JS pixels in `NonStandardEvent`s to prevent that prefixing, to restore their original intended names. [^1]: d885fd0 (PixelKit adoption (#2557), 2024-04-17)
Pixels fired for email autofill use-cases are intentionally not prefixed with `m.mac.`, though the historical reason isn't clear to me. The migration to PixelKit for pixel management[^1] caused those email-related pixels to be prefixed. Wrap email-related JS pixels in `NonStandardEvent`s to prevent that prefixing, to restore their original intended names. [^1]: d885fd0 (PixelKit adoption (#2557), 2024-04-17)
Task/Issue URL: https://app.asana.com/0/1206682621538333/1207380134103391/f Tech Design URL: N/A Pixels fired for email autofill use-cases are intentionally not prefixed with `m.mac.`, though the historical reason isn't clear to me. The migration to PixelKit for pixel management[^1] caused those email-related pixels to be prefixed. Wrap email-related JS pixels in `NonStandardEvent`s to prevent that prefixing, to restore their original intended names. [^1]: d885fd0 (PixelKit adoption (#2557), 2024-04-17)
Task/Issue URL:https://app.asana.com/0/1205842942115003/1206999268603553/f
Tech Design URL:https://app.asana.com/0/1205842942115003/1206989773504216/f
CC: @diegoreymendez
Description:
90% of this PR is changes from pixel.fire() to PixelKit.fire() with related name and frequency changes. The few logic changes are concentrated in PixelKit.
Steps to test this PR:
For each area of responsibility as discussed in https://app.asana.com/0/0/1206999268603553/1207035044172102/f:
Internal references:
Pull Request Review Checklist
Software Engineering Expectations
Technical Design Template
Pull Request Documentation