-
Notifications
You must be signed in to change notification settings - Fork 283
Exposure submission coordinator #910
Exposure submission coordinator #910
Conversation
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.
Hi! Thanks for this major refactor of the navigation flow in the exposure submission part 👍 . Please take a look at some of my comments.
// MARK: - Navigation. | ||
|
||
/// Starts the coordinator and displays the initial root view controller. | ||
func start(with result: TestResult?) |
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.
where's the "start with intro screen" part? in case it is handled by the same method, make sure to mention it here.
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 agree, this is misleading! I will add a comment to clarify this behavior
} | ||
|
||
/// Concrete implementation of the ExposureSubmissionCoordinator protocol. | ||
class ESCoordinator: ExposureSubmissionCoordinator { |
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.
not a fan of the naming here, to be honest! Is there any better way you could name the protocol and the concrete implementation class?
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.
maybe something like:
- protocol: ExposureSubmissionCoordinating
- implementation: ExposureSubmissionCoordinator
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.
If you want to set ExposureSubmissionCoordinatorViewController
as a Marker protocol only for view controller, you can use this syntax:
protocol ExposureSubmissionCoordinatorViewController: UIViewController {
var coordinator: ExposureSubmissionCoordinator? { get set }
}
This constraint makes sure, it can only be used by UIViewController.
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.
Thanks for the proposal, I will remember your tip! However, I was able to completely get rid of the protocol by injecting the coordinator via the initializer 🎉 I guess that is simpler and cleaner than my initial approach
// MARK: - Helpers. | ||
|
||
private func push(_ vc: UIViewController) { | ||
self.navigationController?.pushViewController(vc, animated: 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.
which of our views are pushed and which are presented? why is the differentiation needed here?
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.
the default behavior is push. however, the QR Scanner comes with its own navigation controller that needs to be presented. therefore i added the two separate methods.
src/xcode/ENA/ENA/Source/Scenes/ExposureSubmission/ExposureSubmissionCoordinator.swift
Outdated
Show resolved
Hide resolved
exposureSubmissionService: self.exposureSubmissionService, | ||
testResult: result |
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 is the reason for passing in the exposure submission service like this? I believe since we now have the coordinator, this is not necessary. please double check this.
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.
the coordinator injects the service into the view controller. Am I missing something here?
|
||
// MARK: - Attributes. |
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.
please leave break inbetween MARK and code. you did it for the rest of the change as well
weak var scannerViewController: ExposureSubmissionQRScannerViewController? { | ||
viewControllers.first as? ExposureSubmissionQRScannerViewController | ||
} | ||
|
||
// MARK: - Initializers. |
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.
same as above
...ce/Scenes/ExposureSubmission/View/Controller/ExposureSubmissionQRScannerViewController.swift
Outdated
Show resolved
Hide resolved
withIdentifier: Segue.labResultsSegue, | ||
sender: self | ||
) | ||
// A TAN always indicates a positive test result. |
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.
thanks for the comment 👍👌
func start(with result: TestResult?) | ||
func dismiss() | ||
|
||
func showOverviewScreen() |
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.
In MockExposureSubmissionCoordinator
you had empty lines between each of those methods. please adjust in a unified way.
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 refactoring👍 , please check my comments.
src/xcode/ENA/ENA/Source/Scenes/ExposureSubmission/ExposureSubmissionCoordinator.swift
Outdated
Show resolved
Hide resolved
} | ||
|
||
/// Concrete implementation of the ExposureSubmissionCoordinator protocol. | ||
class ESCoordinator: ExposureSubmissionCoordinator { |
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.
If you want to set ExposureSubmissionCoordinatorViewController
as a Marker protocol only for view controller, you can use this syntax:
protocol ExposureSubmissionCoordinatorViewController: UIViewController {
var coordinator: ExposureSubmissionCoordinator? { get set }
}
This constraint makes sure, it can only be used by UIViewController.
...ce/Scenes/ExposureSubmission/View/Controller/ExposureSubmissionQRScannerViewController.swift
Outdated
Show resolved
Hide resolved
* develop: Improved readability. Changes in accordance with PR feedback. Adjust DynamicTableViewTextViewCell tint color Add more unit tests Add unit tests for DynamicTableViewTextViewCell Impressum + DynamicTableViewTextViewCell changes DynamicTableViewTextViewCell background color fix DynamicTableViewTextViewCell fixes Add interactivity to App Settings Imprint Screen Display underline in ENATanInput when character is invalid.
weak var delegate: ExposureSubmissionCoordinatorDelegate? | ||
weak var parentNavigationController: UINavigationController? | ||
|
||
/// - Note: We keep a weak reference here to avoid a reference cycle. |
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.
just a teeny tiny comment: Up in line 62 you wrote NOTE
capitalized. It's great that you have added so many comments though, love it! 😊
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.
Hi! I have just found 2 minor things to look at. Would be cool if you ad changed them. Nonetheless, I will approve. Cheers! 👌
var coordinator: ExposureSubmissionCoordinator? | ||
private(set) weak var coordinator: ExposureSubmissionCoordinating? | ||
private(set) weak var exposureSubmissionService: ExposureSubmissionService? | ||
|
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.
remove this line here
This PR refactors the exposure submission flow to use a coordinator instead of individual segues. To test the changes, I recommend to mock the ExposureSubmissionService that is provided to the coordinator in the HomeInteractor which allows testing all screens even with limited access to the backend.
Checklist
Description