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

Add desktop specific RMF attributes #883

Merged
merged 13 commits into from
Jul 12, 2024
Merged

Conversation

ayoy
Copy link
Contributor

@ayoy ayoy commented Jul 10, 2024

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:

  • iOS 14
  • iOS 15
  • iOS 16
  • macOS 10.15
  • macOS 11
  • macOS 12

Internal references:

Software Engineering Expectations
Technical Design Template

@ayoy ayoy self-assigned this Jul 10, 2024
Comment on lines +23 to +27
#if os(iOS)
public typealias AppAttributeMatcher = MobileAppAttributeMatcher
#elseif os(macOS)
public typealias AppAttributeMatcher = DesktopAppAttributeMatcher
#endif
Copy link
Contributor Author

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:
Copy link
Contributor Author

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:
Copy link
Contributor Author

@ayoy ayoy Jul 10, 2024

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.

Copy link
Contributor Author

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.

@ayoy ayoy marked this pull request as ready for review July 10, 2024 07:52
@ayoy ayoy requested a review from jaceklyp July 10, 2024 09:03
@ayoy ayoy assigned jaceklyp and unassigned ayoy Jul 10, 2024
Copy link
Contributor

@jaceklyp jaceklyp left a 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
Copy link
Contributor

Choose a reason for hiding this comment

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

self can be skipped

Copy link
Contributor Author

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
Copy link
Contributor

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?

Copy link
Contributor Author

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.

@ayoy ayoy merged commit 9ee9b37 into main Jul 12, 2024
7 checks passed
@ayoy ayoy deleted the dominik/rmf-desktop-attributes branch July 12, 2024 13:38
samsymons added a commit that referenced this pull request Jul 19, 2024
* 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)
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.

2 participants