-
Notifications
You must be signed in to change notification settings - Fork 424
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
NetP Invite code screen PR 2 #1883
Conversation
f4a6d42
to
088c616
Compare
47e63f4
to
7f5ced2
Compare
To be moved to BSK
088c616
to
2e94e51
Compare
2e94e51
to
72c9596
Compare
@@ -236,43 +236,6 @@ struct AutofillLoginDetailsView: View { | |||
} | |||
} | |||
|
|||
struct ClearTextField: View { |
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 makes more sense in the shared DuckUI library
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 confused me a bit because it was ultimately moved to a different file right next to this one.
That's fine, but just adding a comment to make sure that was the intention.
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.
My comment was incorrect, it was actually moved into its own file in the shared UI components folder, not library. DuckUI doesn’t seem to have much in it at all. Nonetheless, I thought it didn’t make much sense in the AutofillLoginDetailsView file when it’s now being used from a couple of places.
private static let errorEvents: EventMapping<NetworkProtectionError> = .init { _, _, _, _ in | ||
|
||
} | ||
private let completion: () -> Void |
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.
Used to pop the nav stack and navigate to the status view
} | ||
|
||
// MARK: Dev only. Will be removed during https://app.asana.com/0/0/1205084446087078/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.
I was using this same ViewModel for the basic invite code entry on the status view. Rather than move it in there, I will keep these functions here for now until I’ve added a replacement, probably in the debug menu, as part of the status view subtask.
|
||
var body: some View { | ||
let inviteViewModel = NetworkProtectionInviteViewModel( |
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 not idea for now. It would be good to use a more elegant dependency injection mechanism than letting the View do it. But for now, this will do. Once the rest of the feature is more fleshed out, I’ll tidy this up.
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.
What's a "DI mechanism"?
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.
dependency injection (updated original comment)
|
||
import SwiftUI | ||
|
||
final class NetworkProtectionRootViewController: UIHostingController<NetworkProtectionRootView> { |
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 subclass is needed so we can apply some styling to background of the root view. This will probably be a better place to manage the dependency injection in the future too.
@@ -64,38 +64,22 @@ struct NetworkProtectionStatusView: View { | |||
@ViewBuilder | |||
func inviteCodeEntry() -> some View { | |||
Section { | |||
VStack(alignment: .leading) { |
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.
Gets rid of the initial dev-designed invite entry on the dev-designed status view
let statusView = NetworkProtectionRootView() | ||
let hostingController = UIHostingController(rootView: statusView) | ||
hostingController.view.backgroundColor = UIColor(Color(designSystemColor: .background)) | ||
// This will be tidied up as part of https://app.asana.com/0/0/1205084446087078/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.
I will probably pull this out into a presenter / launcher / router type class.
XCTAssertEqual(viewModel.currentStep, .codeEntry) | ||
} | ||
|
||
// Disabled this test but keeping it around to document the behaviour. It is failing inexplicably. |
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.
For some reason, errors thrown in the library are not caught in the main app. This does not apply in production, only the test environment. You can manually test this to be sure by entering an incorrect invite 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.
@graeme - Adding some comments for your consideration. The implementation looks clean and mostly to be working fine.
Please let me know what you think about my comments, so we can move ahead - if we find agreement in the comments I'd even be happy to tackle it in a follow up if you so prefer.
Additional points:
- The invite code input screen felt like it wasn't working at first and the Submit button remained enabled for a bit allowing me to click it 3 times before it worked. I'm not sure what's behind this, but I suspect it's network related... it may be a good idea to offer some visual cue that you've submitted (maybe disable the button?).
- I have to long-press the "Clear invite code" button for it to highlight.
"branch": null, | ||
"revision": "f255099c2c373d7b0c484849b8903831e7b717ce", | ||
"version": "71.0.0" | ||
"branch": "graeme/network-protection-test-utils", |
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.
Friendly visual reminder to help you update the BSK version before merging.
{ | ||
"images" : [ | ||
{ | ||
"filename" : "Intive-Lock-Success-96.pdf", |
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.
Should "Intive" be "Invite"? This typo is present apparently in several file names, but I'm adding a single note here to avoid overcluttering the PR with comments.
@@ -236,43 +236,6 @@ struct AutofillLoginDetailsView: View { | |||
} | |||
} | |||
|
|||
struct ClearTextField: View { |
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 confused me a bit because it was ultimately moved to a different file right next to this one.
That's fine, but just adding a comment to make sure that was the intention.
@diegoreymendez I’ve address the typo in the |
That's fine for me. About this one though:
This is also not blocking, but disabling the button may be a good way to signal to the user that a request is ongoing. That said, since nothing is truly blocking here I'll move ahead to approve. |
Task/Issue URL: https://app.asana.com/0/0/1205084446087083/f Description: First PR for the NetP Invite Code flow. You can find designs in the linked task above. This first PR is just to add a root view which will choose between either the (initially empty) Invite or the Status View.
Task/Issue URL: https://app.asana.com/0/0/1205084446087083/f
BSK PR: duckduckgo/BrowserServicesKit#441
CC:
Description:
Second PR for the NetP Invite Code flow. You can find designs in the linked task above. This builds upon #1881 and adds to the existing Invite Code presentation logic in the
NetworkProtectionInviteViewModel
. It also fleshes out and designs theNetworkProtectionInviteView
which has two states:This also adds some tests which required some mocks / test helpers for types in the NetworkProtection library in BSK. As we will likely need these on macOS when we come to add more tests there, I added a NetworkProtectionTestUtils library to BSK. This PR points to that BSK branch so I will make sure to point to the BSK release once that’s approved. BSK PR linked above.
Steps to test this PR:
Copy Testing:
’
rather than'
Orientation Testing:
Device Testing:
OS Testing:
Theme Testing:
Internal references:
Software Engineering Expectations
Technical Design Template