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

Flows #13

Merged
merged 1 commit into from Apr 9, 2020
Merged

Flows #13

merged 1 commit into from Apr 9, 2020

Conversation

bielikb
Copy link
Collaborator

@bielikb bielikb commented Apr 7, 2020

Changes

  • user is no longer required to verify his phone number when app starts
  • user is asked for phone number only in "quarantine" flow
  • quarantine data are sent in the end of the quarantine flow

New stuff in codebase

Seamless instantiation of viewcontrollers defined in main storyboard

This dumb protocol

protocol HasStoryBoardIdentifier {
    static var storyboardIdentifier: String { get }
}

in cooperation with new UIStoryboard extension:

extension UIStoryboard {

    class func controller<T: UIViewController>(ofType type: T.Type) -> T? where T: HasStoryBoardIdentifier {
        main.instantiateViewController(withIdentifier: type.storyboardIdentifier) as? T
    }
}

allows us to instantiate the VC's declared in storyboard in more seamless way:
Common way of instantiating the VC from storyboard looks like this:

let mainStoryboard: UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
let viewController = mainStoryboard.instantiateViewController(withIdentifier: "MainViewController") as UIViewController

Here's new, type-safe way, that results into 1-liner:

UIStoryboard.controller(ofType: MainViewController.self)

Segues

All segues are now listed in enum Segue:

enum Segue: String {
    case quarantineVerifyNumber
    case startQuarantineFlow = "initQuarantine"
    case foreignAlert
    case searchAddress = "search"
    case phoneNumberVerification = "verification"
}

Instead of using string-based APIs:

performSegue(withIdentifier: "initQuarantine", sender: nil)

we're now able to perform segues in a type-safe way:

performSegue(.startQuarantineFlow)

@bielikb bielikb requested a review from anonymcek April 7, 2020 23:15
@bielikb bielikb force-pushed the feature/remove_verification_step branch from c4e722f to a0f3937 Compare April 8, 2020 06:56
@bielikb bielikb force-pushed the feature/remove_verification_step branch from e8ea3bd to e8f048f Compare April 8, 2020 07:11
if Defaults.pushToken == nil {
observer = Defaults.observe(\.pushToken) { _ in
DispatchQueue.main.async {
action()
}
}
} else {
action()
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@anonymcek registerUser API call sa pri prvom starte volal 2x za sebou.

  1. action() by default
  2. pri setupnuti observera na push token

Copy link
Collaborator

Choose a reason for hiding this comment

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

takto som to mal a z nejakeho dovodu som to prehodil, ale netusim preco

if Defaults.pushToken == nil {
observer = Defaults.observe(\.pushToken) { _ in
DispatchQueue.main.async {
action()
}
}
} else {
action()
Copy link
Collaborator

Choose a reason for hiding this comment

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

takto som to mal a z nejakeho dovodu som to prehodil, ale netusim preco

welcomeViewController?.onAgree = {
Defaults.didRunApp = true
welcomeViewController?.dismiss(animated: true) { [weak self] in
self?.registerForPushNotifications()
Copy link
Collaborator

Choose a reason for hiding this comment

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

registrujes sa len pri prvom spusteni?

@@ -0,0 +1,25 @@
//
Copy link
Collaborator

Choose a reason for hiding this comment

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

licka

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

ok dodam

@@ -50,29 +50,7 @@ final class AddressConfirmationViewController: UIViewController {
Defaults.quarantineLatitude = location?.latitude
Defaults.quarantineLongitude = location?.longitude

if Defaults.phoneNumber != nil, let token = Defaults.mfaToken {
networkService.requestQuarantine(quarantineRequestData: QuarantineRequestData(mfaToken: token)) { [weak self] (result) in
Copy link
Collaborator

Choose a reason for hiding this comment

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

som slepy, alebo to nikde nemame?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

MainViewController. registerForQuarantine

vynal som ten call z oboch VC's a teraz sa to vola raz po dokonceni celeho flowu

@anonymcek anonymcek merged commit d1e595e into master Apr 9, 2020
@anonymcek anonymcek deleted the feature/remove_verification_step branch April 9, 2020 21:29
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.

None yet

2 participants