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 10, 2023

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

Stack

Description

Implements the new onboarding UI/UX.

Scope

The UI is designed here: https://www.figma.com/file/nscneJs8hvI6j2m24AFTsD/Setup-steps-macOS-Network-Protection?type=design&node-id=132%3A9918&mode=design&t=qrWZTHgdsccYM1IZ-1

My suggestion though would be not to focus on the UI too strongly unless you see a big issue, as this will be run through a design review anyway.

In Scope:

  • Light mode
  • Showing the UI that signals the user needs to allow the system extension, before the system extension is allowed
  • Showing the UI that signals the user needs to allow the VPN configuration, before the VPN configuration is allowed

Out of Scope:

  • Dark mode
  • Different images for older macOS versions

Steps to test this PR:

  1. Launch the app
  2. Reset Network Protection's status to make sure you start with a clean state.
  3. Kill the menu app through Activity Monitor at least once
  4. Open the NetP popover and make sure it shows a view that shows how to allow the system extension. The controller part of the view should be disabled.
  5. Click on the button in that view, NetP should start and request that you allow the system extension
  6. Allow it
  7. Now the UI (in the popover and menu app) should be updated to show a view that explains how to allow the VPN configuration. The controller part of the view should be disabled.
  8. Allow it
  9. The onboarding UI should go away and you should see the regular NetP popover status view.

Internal references:

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

@diegoreymendez diegoreymendez self-assigned this Aug 10, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Aug 10, 2023

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

Generated by 🚫 dangerJS against 3eaf24c

@diegoreymendez diegoreymendez changed the base branch from develop to diego/feature-network-protection-onboarding August 10, 2023 09:23
@diegoreymendez diegoreymendez changed the base branch from diego/feature-network-protection-onboarding to diego/feature-network-protection-onboarding-3 August 11, 2023 14:30
Comment on lines -908 to -913
<menuItem title="Print onboarding status to console" id="abt-dL-pSE">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="printOnboardingStatusToConsoleWithSender:" target="L82-We-Wwv" id="k2z-AC-UBV"/>
</connections>
</menuItem>
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 was added in the previous PR in the stack for testing purposes.

Comment on lines -67 to -70
@IBAction
func printOnboardingStatusToConsole(sender: NSMenuItem) {
print("Onboarding status is: \(String(describing: OnboardingStatus(rawValue: onboardingStatus)))")
}
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 matches the removal of the debug menu item I added in my last PR. It's no longer needed.

Comment on lines +58 to +60
if let healthWarning = model.issueDescription {
connectionHealthWarningView(message: healthWarning)
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We now only show these warnings if the onboarding is completed.

Comment on lines +441 to +443
if !viewDisabled {
toggleTransition = .switchingOn(locallyInitiated: true)
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The toggle won't move when onboarding is shown, as the tunnel controller view will be disabled.

We'll still start NetP though.


/// Model for AllowSystemExtensionView
///
final class Model: ObservableObject {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Model for the onboarding step view.

@diegoreymendez diegoreymendez changed the title [WIP] Network Protection - Full feature draft PR Implements new onboarding UI/UX Aug 11, 2023
@diegoreymendez diegoreymendez requested a review from graeme August 11, 2023 14:45
@diegoreymendez diegoreymendez marked this pull request as ready for review August 11, 2023 14:46
@diegoreymendez
Copy link
Contributor Author

I'm going to be merging the parent PR in the stack soon, so there'll be some merging back and forth. That said there will be no changes to the code in this PR, just activity noise. :)

Base automatically changed from diego/feature-network-protection-onboarding-3 to diego/feature-network-protection-onboarding August 14, 2023 10:36
diegoreymendez added a commit that referenced this pull request Aug 14, 2023
Task/Issue URL: https://app.asana.com/0/0/1205257341292466/f
Tech Design URL:
CC:

## Stack:

- Feature branch: `diego/feature-network-protection-onboarding`
    - #1474 (this PR)
        - #1464

## Description:

Implements the shared `UserDefaults` that will store the onboarding
status, and the debug menu options to test it.
Copy link
Contributor

@graeme graeme left a comment

Choose a reason for hiding this comment

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

Only blocker is the enum as we discussed.

case alertBubbleBackground = "AlertBubbleBackground"
case defaultText = "TextColor"
case linkColor = "LinkBlueColor"
case onboardingButtonBackgroundColor = "OnboardingButtonBackgroundColor"
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if any of these colours could be found in DesignResourcesKit. If we decide to change the app styling globally this could trip us up later. Not a blocker, just potentially a thought for later.

/// Disables a view giving it opacity and making it impossible to interact with. Most useful on composite views.
///
@ViewBuilder
func disabled(on condition: Bool) -> some View {
Copy link
Contributor

Choose a reason for hiding this comment

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

Doesn’t this clash with the default disabled view modifier? I wonder if this should be named differently. Not a blocker though if you’ve already considered this and it’s okay.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Well I've pondered on this thought but honestly I couldn't find anything better, and unless there's an option to make this better I'd just keep this to be honest.

This does in fact disable the view, and the on: parameter ensures it's clear which one is picked against the regular disabled.

@objc
dynamic var networkProtectionOnboardingStatusRawValue: Int {
get {
value(forKey: networkProtectionOnboardingStatusRawValueKey) as? Int ?? OnboardingStatus.default.rawValue
Copy link
Contributor

Choose a reason for hiding this comment

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

Persisting enums as Ints is a bit risky in case someone inadvertently adds a case. Particularly given this one is performing a calculation for the parameter which simply adds 1 to change values. If someone added a case before or after, it will change the meaning of this. I’d recommend using strings for this case.

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 changed as per our private chat.


onboardingStatusPublisher
.receive(on: DispatchQueue.main)
.sink { [weak self] status in
Copy link
Contributor

Choose a reason for hiding this comment

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

You can simplify this by using the .assign(to:onWeaklyHeld:) instead of .sink (not a blocker, just a tip)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nice call, makes it tidier. Changed.

@diegoreymendez diegoreymendez requested a review from graeme August 14, 2023 12:19
@diegoreymendez
Copy link
Contributor Author

Feedback addressed.

It seems there's a flaky test which I'll address before merging, but I'd suggest we separate the review approval from CI since I won't merge until the CI is green anyways.

Copy link
Contributor

@graeme graeme left a comment

Choose a reason for hiding this comment

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

Tested and works nicely. Thanks for addressing my comments too. Approved! 👍

@diegoreymendez diegoreymendez merged commit bbd4e29 into diego/feature-network-protection-onboarding Aug 14, 2023
@diegoreymendez diegoreymendez deleted the diego/netp-new-onboarding branch August 14, 2023 14:01
diegoreymendez added a commit that referenced this pull request Aug 23, 2023
Task/Issue URL: https://app.asana.com/0/0/1205301030177476/f

## Description:

Implements the new onboarding for Network Protection.

## Incremental PR reviews

This is a list of the individual PRs (and reviews) that make up this
feature:
- #1464
- #1466
- #1474
- #1484
- #1502
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