wwt / SwiftCurrent

A library for managing complex workflows in Swift
https://wwt.github.io/SwiftCurrent/
Apache License 2.0
308 stars 19 forks source link

staysInViewStack .hiddenInitially is not setting the proceedInWorkflow when coming back to the screen #3

Closed richardagist closed 4 years ago

richardagist commented 4 years ago

Describe the bug Setting a .thenPresent to have a hiddenInitially seems to forget to set the proceedInWorkflow when you navigate back the view.

To Reproduce Steps to reproduce the behavior:

  1. Setup a workflow with hiddenInitially
  2. Skip the hiddenInitially
  3. Navigate back to the hiddenInitially
  4. Try to proceed foorward

Expected behavior Be able to move forward.

Additional context Add any other context about the problem here.

Sample: See comments

richardagist commented 4 years ago

Put this code on a viewController in a sample app:

    override func viewDidAppear(_ animated: Bool) {
        class Skippy: UIWorkflowItem<Never>, FlowRepresentable {
            static func instance() -> AnyFlowRepresentable { Skippy() }
            func shouldLoad() -> Bool { false }
            override func viewDidLoad() { title = "Skip" }
            override func viewWillAppear(_ animated: Bool) {
                proceedInWorkflow()
            }
        }

        class StayPuty: UIWorkflowItem<Never>, FlowRepresentable {
            static func instance() -> AnyFlowRepresentable { StayPuty() }
            func shouldLoad() -> Bool { true }
            override func viewDidLoad() { title = "Stay Put" }
        }

        let problemWorkflow = Workflow()
            .thenPresent(Skippy.self, presentationType: .default, staysInViewStack: .hiddenInitially)
            .thenPresent(StayPuty.self)
        launchInto(problemWorkflow, withLaunchStyle: .navigationStack)
    }
Tyler-Keith-Thompson commented 4 years ago
  var itWorky = true

Should be fixed in 1.0.6, thanks for catching this!