-
Notifications
You must be signed in to change notification settings - Fork 35
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
Add desktop specific RMF attributes #883
Conversation
#if os(iOS) | ||
public typealias AppAttributeMatcher = MobileAppAttributeMatcher | ||
#elseif os(macOS) | ||
public typealias AppAttributeMatcher = DesktopAppAttributeMatcher | ||
#endif |
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.
installedMacAppStore
is an "app" attribute, so we're adding platform-specific structs for app attribute matching.
|
||
public func evaluate(matchingAttribute: MatchingAttribute) -> EvaluationResult? { | ||
switch matchingAttribute { | ||
case let matchingAttribute as IsInstalledMacAppStoreMatchingAttribute: |
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.
Handle installedMacAppStore
here, and handle other attributes via common matcher.
|
||
public func evaluate(matchingAttribute: MatchingAttribute) -> EvaluationResult? { | ||
switch matchingAttribute { | ||
case let matchingAttribute as PinnedTabsMatchingAttribute: |
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.
Similar to app attributes matcher, handle pinned tab, custom home page and duck player here and use common matcher for the rest.
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.
Lots of duplicated code was removed from this file via introducing common interfaces for handling matching attributes: SingleValueMatching
, NumericRangeMatching
and StringRangeMatching
.
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.
nice and clean :)
variantManager: VariantManager, | ||
isInstalledMacAppStore: Bool | ||
) { | ||
self.isInstalledMacAppStore = isInternalUser |
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.
self can be skipped
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.
Lol it's a bug 😮 should be = isInstalledMacAppStore
. Thanks for this 🙏
currentVariant: MockVariant(name: "zo", weight: 44, isIncluded: { return true }, features: [.dummy])) | ||
let emailManagerStorage = MockEmailManagerStorage() | ||
|
||
// EmailEnabledMatchingAttribute isSignedIn = true |
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.
is it part of documentation or can be removed?
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.
This is an explanation of the code below that sets username and token, which is equivalent to making isSignedIn return true. I'll update this to be more specific.
* main: Remove unused VPN session utilities (#898) Add new deprecated Mac remote message attribute. (#903) Resetting all state for the VPN will cancel the tunnel and stop the monitors (#900) Add support for skipping sending usage pixels for remote messages (#902) Bump Tests/BrowserServicesKitTests/Resources/privacy-reference-tests (#896) Removes the listen port from the wireguard client (#901) Be explicit when performing developer redirects (#884) C-S-S cross origin fixes Update C-S-S version (#892) Add a debug menu action to reset Remote Messages on macOS (#891) Add desktop specific RMF attributes (#883) Upload exception message to Sentry (#856) Add locale to broken site report (#889) Add new subfeature for duckplayer (#885) Swiftlint refactoring (#882) Remote Messaging Framework for macOS (#876)
Please review the release process for BrowserServicesKit here.
Required:
Task/Issue URL: https://app.asana.com/0/72649045549333/1207774753650441/f
iOS PR: duckduckgo/iOS#3062
macOS PR: duckduckgo/macos-browser#2954
What kind of version bump will this require?: Major/Minor/Patch
Optional:
CC: @amddg44 @samsymons
Description:
Add support for customHomePage, pinnedTab, installedMacAppStore, duckPlayerOnboarded
and duckPlayerEnabled attributes on macOS. Attribute matchers have been refactored by introducing
common protocols for matching single value, numeric ranges and string ranges, allowing to remove
a lot of duplicated code as a result.
Steps to test this PR:
Verify that unit tests pass.
OS Testing:
Internal references:
Software Engineering Expectations
Technical Design Template