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

🎁 Version 0.4.0 Epic Branch #71

Merged
merged 17 commits into from
Oct 12, 2017
Merged

🎁 Version 0.4.0 Epic Branch #71

merged 17 commits into from
Oct 12, 2017

Conversation

crexista
Copy link
Owner

@crexista crexista commented Jun 24, 2017

UPDATE at least

  • check scene is released when add scene or release
  • fix miscellaneous argument name

@crexista crexista added this to the ver 0.4.0 milestone Jun 24, 2017
@codecov-io
Copy link

codecov-io commented Jun 24, 2017

Codecov Report

Merging #71 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master      #71   +/-   ##
=======================================
  Coverage   93.49%   93.49%           
=======================================
  Files           7        7           
  Lines         123      123           
=======================================
  Hits          115      115           
  Misses          8        8

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 09695d8...2ae9094. Read the comment docs.

Abstract:

- Set type parameter name as "${Target}Type"
- Set type parameter name (declared with `associatedtype` ) as "${Target}"

Note:

- This commit will break following thing.
  - `ContextType` declared in `Scene` protocol.
    - `ContextType` must be replaced with `Context` .
Abstract:

- Expand few variable names
- Make variable name more clear
Abstract:

- Update `ContextType` to `Context`
Abstract:

- Adds test cases for SceneSequenceTest, SceneTest, ScreenTest
kmhjs and others added 13 commits July 26, 2017 18:43
Abstract:

- Set type parameter name as "${Target}Type"
- Set type parameter name (declared with `associatedtype` ) as "${Target}"

Note:

- This commit will break following thing.
  - `ContextType` declared in `Scene` protocol.
    - `ContextType` must be replaced with `Context` .
Abstract:

- Expand few variable names
- Make variable name more clear
Now, `SceneSequence` cannot stop and maybe leak when dispose sub sequence.
So, I have to remodel `SceneSequence`

**UPDATE**

- When SceneSequence's `leave` is called, SceneSequence will be able to be disposed.
- SceneSequence's type generics `Context` is useless. So,  SceneSequence's type generics match with First Scene.
- SceneSequence's 'startWith' method is too difficult to use. if context is not set, SceneSequence refer to `self.context` .

**Breaking Change**
This commit has breaking change
- `SceanSequence`'s `startWith` method deleted. instead of that method, start(on ~

**Hankey Changes**
- SceneSequence override `leave`. But it is a update that we do not need.
- So, this hankey update will be fixed later(maybe #74 fixed)
**Abstruct**

1. Scene, Scenario, Sequence are redesigned, and refactored
2. Some new feature added.

**Refactor**

**A. redefine deference screen and scene**
`Screen` was just Scene's type erasure protocol
And, `Screen` had `sendTransitionRequest` and `leaveFromCurrent`.

but I redefine `Screen` and `Scene` as below.

- Screen
  1. Just Display, like a plate.
  2. Screen has two status
    - activated
    - suspended

- Scene
  1. Scene is transitionable screen.
  2. So, Scene has context and returnValue(when rewind)

So, `Screen` does not have `sendTransitionRequest` and `leaveFromCurrent` from now.
And, `Scene` has `sendTransitionRequest` and `leaveFromCurrent` insted of `Screen`.

**B. SceneSequence separate to SceneCollection, ScreenContainer**

`SceneSequence` become complex, so redesigned `SceneSequence`
So, `SceneSequence` become to extend SceneCollection and implement ScreenContainer

SceneCollection's job is stacking `Scene` and activate `Scene`
detail will be write later..

**New Feature**

- `Scene` can define associeated Type `ReturnValue`
  ReturnValue is type of argument to previous scene when rewind to back scene.

  can use like this
  ```swift
  // on Fist Scene
  sendTransitionRequest(SampleRequest(value){ (result: String) in
    print(result)
  })

  // on Second Scene
  leaveFromCurrent(returnValue: String) // SampleRequest's ResultValue Type
  ```

- `SceneSequence` can suspend.
  `SceneSequence` become to be able to suspend.
  suspended screen cannot sendTransitionRequest(if request is send, it will be ignored)

- `SceneSequenceBuilder` added.
  `SceneSequence`'s initial parameter is many.
   So `SceneSequenceBuilder` is maked.

   ```swift
   let builder = SceneSequence.builder(scene: scene, guide: rule)
                              .setup(UINavigationController(rootViewController: UIViewController()), with: false)
   sequence = builder.build(onInvoke: { (stage, scene) in
       stage.isNavigationBarHidden = true
       stage.pushViewController(scene, animated: true)
   }, onActive: { (stage, screens) in
       self.window?.rootViewController?.addChildViewController(stage)
       self.window?.rootViewController?.view.addSubview(stage.view)
   }, onSuspend: { (stage, screens) in
       stage.view.removeFromSuperview()
       stage.removeFromParentViewController()
   })

   sequence?.activate()
   ```

**Breaking Change**
- `SceneOperation`'s I/F is changed.

   **old**

   ```swift
  operation.at(Sample1BViewController.self) { (scenario) in
      scenario.given(SampleARequest.self, { Sample1AViewController() }) { (args) in
          args.stage.pushViewController(args.next, animated: true)
             return {
                args.stage.popViewController(animated: true)
             }
          }
      }
  }
  ```
  **new**

  ```swift
  operation.at(Sample1BViewController.self) { (scenario) in
      scenario.given(SampleARequest.self, nextTo: { Sample1AViewController() }) { (args) in
          args.stage.pushViewController(args.next, animated: true)
             return {
                args.stage.popViewController(animated: true)
             }
          }
      }
  }
  ```
…ecture-sequence

[#79] Re Architecture SceneSequence And Several new feature
**Detail**
- fixed `currnt` -> `current`
**Detail**
This commit change `Scene`'s ReturnValue gained through `rewind method` was Optional to Non Optional.
Because, it is inconvenient because it is necessary to check nil when receiving RetuneValue.

**Breaking Change**
initialize `TransitionRequest` have to change this.

- before

```swift
let request = HogeRequest() { ret in // result is optional
   guard let result = result else { return }
   // process using result
}
```
- after

```swift
let request = HogeRequest() { ret in // result is non-optional
   // process using result
}
```
Change Scene's ReturnValue associetedType
**Abstruct**
* SceneSequenceBuilder's Build method change to this
  before
  ```swift
  sequence = builder.build { (stage, scene) in
    stage.pushViewController(scene, animated: true)
  }, onActive: { (stage, screens) in
    self.window?.rootViewController?.addChildViewController(stage)
    self.window?.rootViewController?.view.addSubview(stage.view)
  }, onSuspend: { (stage, screens) in
    stage.view.removeFromSuperview()
    stage.removeFromParentViewController()
  })
  ```
  after
  ```swift
   sequence = builder.build {
      let stage = $0.stage
      let scene = $0.firstScene
      stage.pushViewController(scene, animated: true)

      $0.execute.onActivate { (screens) in
         self.window?.rootViewController?.addChildViewController(stage)
         self.window?.rootViewController?.view.addSubview(stage.view)
      }

      $0.execute.onSuspend { (screens) in
          stage.view.removeFromSuperview()
          stage.removeFromParentViewController()
       }
       return {
         // rewind process
       }
     }
  ```
…_initializer

🔨 SceneSequenceBuilder add new builder interface
@crexista crexista merged commit 73109bf into master Oct 12, 2017
@crexista crexista deleted the versions/0.4.0 branch October 22, 2017 13:08
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.

3 participants