Skip to content
This repository was archived by the owner on Feb 24, 2025. It is now read-only.

Conversation

@diegoreymendez
Copy link
Contributor

@diegoreymendez diegoreymendez commented Aug 29, 2023

Task/Issue URL: https://app.asana.com/0/0/1205381133187306/f

Related PRs

BSK PR: duckduckgo/BrowserServicesKit#483
iOS PR: duckduckgo/iOS#1967

Description

Adds logic to handle the remote waitlistBetaActive subfeature, and to reset Network Protection once the beta is no longer active.

Tests:

Before testing you'll want to apply the change suggested in this comment: https://github.com/duckduckgo/macos-browser/pull/1562/files#r1313326009

Filter your Xcode console by "NetP Debug"

Test 1: Easter Egg User + Waitlist Ended

In this test we're going to check that easter egg users have Network Protection enabled

  1. Restart Network Protection
  2. Enable NetP using an easter egg code.
  3. Set the Waitlist Enabled override to ON and the Waitlist Active override to OFF.
  4. Make sure Network Protection is visible in the more menu.
  5. Make sure there are no messages in the Xcode console (using the filter from above).

Test 2: Waitlist User + Waitlist Ongoing

In this test we're going to check that Waitlist users can see Network Protection when the waitlist is enabled.

  1. Change this line to return true.
  2. Restart Network Protection
  3. Set the Waitlist Enabled override to ON and the Waitlist Active override to ON.
  4. Make sure Network Protection is visible in the more menu.
  5. Make sure there are no messages in the Xcode console (using the filter from above).

Test 3: Waitlist User + Waitlist Ended

In this test we're going to check that Waitlist users can see Network Protection when the waitlist is enabled.

  1. Change this line to return true.
  2. Restart Network Protection
  3. Set the Waitlist Enabled override to ON and the Waitlist Active override to OFF.
  4. Make sure Network Protection is NOT visible in the more menu.
  5. Check that you have a message in the console stating NetP was disabled.

Internal references:

Pull Request Review Checklist
Software Engineering Expectations
Technical Design Template
Pull Request Documentation

Comment on lines +29 to +32
protocol WaitlistBetaOverriding {
var waitlistActive: WaitlistOverride { get }
var waitlistEnabled: WaitlistOverride { get }
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Protocol for obtaining the overrides in a way that we can mock this easily for testing.


// MARK: - UI Additions

private func waitlistOFFAlert() -> NSAlert {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Overriding the subfeatures to OFF will be "dangerous" to some degree when we start disabling NetP.

Comment on lines +87 to +96
private var isWaitlistEnabled: Bool {
switch featureOverrides.waitlistEnabled {
case .useRemoteValue:
return privacyConfigurationManager.privacyConfig.isSubfeatureEnabled(NetworkProtectionSubfeature.waitlist)
case .on:
return true
case .off:
return false
}
}
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 the gist of the overriding mechanism I'm proposing, where the client app takes care of overriding the flags.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I like it 👍

case on
case off

static let `default`: WaitlistOverride = .on
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 default should change to .remote once we start the waitlist in our backend.

Comment on lines 98 to 107
private func disableNetworkProtectionForExternalUsers() {
#if DEBUG
if internalUserDecider.isInternalUser {
print("NetP Debug: Internal user detected. Network Protection is still enabled.")
} else {
print("NetP Debug: Network Protection was disabled.")
}
#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.

No deleting anything yet to avoid breakage. I think we should review the exact conditions that would trigger this.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm going to open a PR to turn the test feature flag on, so that this will never technically run for users for a few months. That gives us time to decide how to handle internal users properly.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Follow up to my last comment, it's important to note that we should only include this when the bundled version of the config in the app includes the enabled flag. Otherwise, any F&F users who launch the browser will have NetP state removed, because the remote config won't have been fetched yet.

We could probably merge the privacy config PR on Friday, and then update the embedded copy of the config file as a part of this PR to solve that.

@diegoreymendez diegoreymendez changed the title Diego/waitlist beta disable feature flag 2 Implement waitlistBetaActive logic (without actually resetting) Aug 29, 2023
@diegoreymendez diegoreymendez marked this pull request as ready for review August 29, 2023 22:31
Copy link
Collaborator

@samsymons samsymons left a comment

Choose a reason for hiding this comment

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

LGTM! I'll refine the conditions and wire up the waitlist state as a part of my PR.

@github-actions
Copy link
Contributor

github-actions bot commented Sep 1, 2023

Warnings
⚠️ PR has more than 500 lines of code changing. Consider splitting into smaller PRs if possible.

Generated by 🚫 dangerJS against d72eac0

diegoreymendez added a commit to duckduckgo/BrowserServicesKit that referenced this pull request Sep 3, 2023
Task/Issue URL: https://app.asana.com/0/0/1205381133187308/f

iOS PR: duckduckgo/iOS#1967
macOS PR: duckduckgo/macos-browser#1562
What kind of version bump will this require?: Minor

## Description

Adds the waitlist remote flags.

---------

* Add the Network Protection feature and waitlist subfeature.

* Rename NetworkProtectionFeatureVisibility to NetworkProtectionFeatureActivation.

* Hardcode NetP on.

* Adds the waitlistBetaActive remote subfeature

* Removes an override

---------

Co-authored-by: Sam Symons <[email protected]>
@diegoreymendez diegoreymendez merged commit 3cbb529 into develop Sep 3, 2023
@diegoreymendez diegoreymendez deleted the diego/waitlist-beta-disable-feature-flag-2 branch September 3, 2023 06:26
diegoreymendez added a commit to duckduckgo/iOS that referenced this pull request Sep 3, 2023
Task/Issue URL: https://app.asana.com/0/0/1205381133187310/f

## Related PRs

BSK PR: duckduckgo/BrowserServicesKit#483
macOS PR: duckduckgo/macos-browser#1562

## Description

Integrates some of the latest changes from BSK.

--------

Co-authored-by: Sam Symons <[email protected]>
samsymons added a commit that referenced this pull request Sep 4, 2023
# By Diego Rey Mendez
# Via GitHub
* develop:
  Implement waitlistBetaActive logic (without actually resetting) (#1562)

# Conflicts:
#	DuckDuckGo.xcodeproj/project.pbxproj
#	DuckDuckGo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved
samsymons added a commit that referenced this pull request Sep 4, 2023
# By Alexey Martemyanov (5) and others
# Via GitHub (1) and Tomas Strba (1)
* develop:
  DBP Debug UI (#1587)
  Bump version to 1.55.0 (57)
  Update embedded files
  Auto start DBP scheduler (#1586)
  Add broker updater mechanism (#1580)
  Update develop with Bitwarden fix (#1585)
  fix outlook popups loading; set popup window mode to match Safari (#1564)
  remove AppActivityMonitor and related unused code (#1582)
  Popovers positioning (#1574)
  Version 1.54.1
  xcode 15 synthesized color constants fixes (#1583)
  Fixes issue with password saving when using Bitwarden (#1584)
  Remove the incremental test pixel sender (#1578)
  Implement waitlistBetaActive logic (without actually resetting) (#1562)
  Lock Form fill when autofill is locked (#1559)
  show alert when user tries to open file in AppStore version (#1494)
  DBP UI Middleware  (#1553)
  Dashboard & Profile Creation  (#1567)
  roll out the bookmarks bar experiment (#1572)
  Open duck player for youtube same-document navigation (#1560)

# Conflicts:
#	DuckDuckGo.xcodeproj/project.pbxproj
#	DuckDuckGo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved
#	DuckDuckGo/Common/Localizables/UserText.swift
#	DuckDuckGo/NavigationBar/PinningManager.swift
#	DuckDuckGo/NavigationBar/View/NavigationBarViewController.swift
#	DuckDuckGo/Waitlist/NetworkProtectionFeatureVisibility.swift
#	UnitTests/Menus/MoreOptionsMenuTests.swift
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants