@@ -44,7 +44,7 @@ Modify `State` data class to contain a placeholder parameter, to make the compil
4444We can leave everything else as the default for now:
4545
4646``` kotlin
47- object TodoListWorkflow : StatefulWorkflow<Unit, State, Nothing, TodoListScreen >() {
47+ object TodoListWorkflow : StatefulWorkflow<Unit, State, Nothing, Screen >() {
4848
4949 data class State (val placeholder : String = " " )
5050
@@ -56,7 +56,7 @@ object TodoListWorkflow : StatefulWorkflow<Unit, State, Nothing, TodoListScreen>
5656 override fun render (
5757 renderProps : Unit ,
5858 renderState : State ,
59- context : RenderContext
59+ context : RenderContext < Unit , State , Nothing >
6060 ): TodoListScreen {
6161 return TodoListScreen ()
6262 }
@@ -70,7 +70,7 @@ object TodoListWorkflow : StatefulWorkflow<Unit, State, Nothing, TodoListScreen>
7070For now, let's just show this new screen instead of the login screen/workflow. Update the activity to show the ` TodoListWorkflow ` :
7171
7272``` kotlin
73- val renderings: Flow <Screen > by lazy {
73+ val renderings: StateFlow <Screen > by lazy {
7474 renderWorkflowIn(
7575 workflow = TodoListWorkflow ,
7676 scope = viewModelScope,
@@ -89,7 +89,7 @@ The empty list is rather boring, so let's fill it in with some sample data for n
8989Update the ` State ` type to include a list of todo model objects and change ` initialState ` to include a default one:
9090
9191``` kotlin
92- object TodoListWorkflow : StatefulWorkflow<Unit, State, Nothing, TodoListScreen >() {
92+ object TodoListWorkflow : StatefulWorkflow<Unit, State, Nothing, Screen >() {
9393
9494 data class TodoModel (
9595 val title : String ,
@@ -147,14 +147,14 @@ private fun todoListScreenRunner(
147147Finally, update ` render ` for ` TodoListWorkflow ` to send the titles of the todo models whenever the screen is updated:
148148
149149``` kotlin
150- object TodoListWorkflow : StatefulWorkflow<Unit, State, Nothing, TodoListScreen >() {
150+ object TodoListWorkflow : StatefulWorkflow<Unit, State, Nothing, Screen >() {
151151
152152 // …
153153
154154 override fun render (
155155 renderProps : Unit ,
156156 renderState : State ,
157- context : RenderContext
157+ context : RenderContext < Unit , State , Nothing >
158158 ): TodoListScreen {
159159 val titles = renderState.todos.map { it.title }
160160
@@ -199,7 +199,7 @@ object RootNavigationWorkflow : StatefulWorkflow<Unit, Unit, Nothing, Screen>()
199199 override fun render (
200200 renderProps : Unit ,
201201 renderState : Unit ,
202- context : RenderContext
202+ context : RenderContext < Unit , Unit , Nothing >
203203 ): Screen {
204204 // Render a child workflow of type WelcomeWorkflow. When renderChild is called, the
205205 // infrastructure will start a child workflow session if one is not already running.
@@ -223,7 +223,7 @@ But `WelcomeWorkflow`'s output type is currently a simple object: `object Output
223223For now, delete the ` Output ` on ` WelcomeWorkflow ` and replace it with ` Nothing ` :
224224
225225``` kotlin
226- object WelcomeWorkflow : StatefulWorkflow<Unit, State, Nothing, WelcomeScreen >() {
226+ object WelcomeWorkflow : StatefulWorkflow<Unit, State, Nothing, Screen >() {
227227 // …
228228}
229229```
@@ -235,7 +235,7 @@ The override for using `renderChild` on a child Workflow with `Nothing` as its o
235235 override fun render (
236236 renderProps : Unit ,
237237 renderState : Unit ,
238- context : RenderContext
238+ context : RenderContext < Unit , Unit , Nothing >
239239 ): Screen {
240240 // Render a child workflow of type WelcomeWorkflow. When renderChild is called, the
241241 // infrastructure will start a child workflow session if one is not already running.
@@ -279,7 +279,7 @@ Start by defining the state that needs to be tracked at the root —
279279specifically which screen we're showing, and the actions to log in and log out:
280280
281281``` kotlin
282- object RootNavigationWorkflow : StatefulWorkflow<Unit, State, Nothing, WelcomeScreen >() {
282+ object RootNavigationWorkflow : StatefulWorkflow<Unit, State, Nothing, Screen >() {
283283
284284 sealed interface State {
285285 object ShowingWelcome : State
@@ -320,7 +320,7 @@ Change our `OutputT` type from `Output` to a new `data class LoggedIn`
320320to be able to signal our parent:
321321
322322``` kotlin
323- object WelcomeWorkflow : StatefulWorkflow<Unit, State, LoggedIn, WelcomeScreen >() {
323+ object WelcomeWorkflow : StatefulWorkflow<Unit, State, LoggedIn, Screen >() {
324324
325325 data class LoggedIn (val username : String )
326326
@@ -350,7 +350,7 @@ Finally, map the output event from `WelcomeWorkflow` in `RootNavigationWorkflow`
350350 override fun render (
351351 renderProps : Unit ,
352352 renderState : State ,
353- context : RenderContext
353+ context : RenderContext < Unit , State , Nothing >
354354 ): WelcomeScreen {
355355 // Render a child workflow of type WelcomeWorkflow. When renderChild is called, the
356356 // infrastructure will start a child workflow session if one is not already running.
@@ -374,7 +374,7 @@ We'll update the `RootNavigationWorkflow` `render` method to show either the `We
374374Temporarily define the ` OutputT ` of ` TodoListWorkflow ` as ` Nothing ` (we can only go forward!):
375375
376376``` kotlin
377- object TodoListWorkflow : StatefulWorkflow<Unit, State, Nothing, TodoListScreen >() {
377+ object TodoListWorkflow : StatefulWorkflow<Unit, State, Nothing, Screen >() {
378378```
379379
380380And update the `render` method of `RootNavigationWorkflow `:
@@ -387,7 +387,7 @@ object RootNavigationWorkflow : StatefulWorkflow<Unit, State, Nothing, Screen>()
387387 override fun render (
388388 renderProps : Unit ,
389389 renderState : State ,
390- context : RenderContext
390+ context : RenderContext < Unit , State , Nothing >
391391 ): Screen {
392392 when (renderState) {
393393 // When the state is ShowingWelcome, delegate to the WelcomeWorkflow.
@@ -468,7 +468,7 @@ and use it to receive a `username` string.
468468We will also need to update `TodoListScreen ` to display it.
469469
470470```kotlin
471- object TodoListWorkflow : StatefulWorkflow<ListProps, State, Nothing, TodoListScreen >() {
471+ object TodoListWorkflow : StatefulWorkflow<ListProps, State, Nothing, Screen >() {
472472
473473 data class ListProps (val username : String )
474474
@@ -484,7 +484,7 @@ object TodoListWorkflow : StatefulWorkflow<ListProps, State, Nothing, TodoListSc
484484 override fun render (
485485 renderProps : ListProps ,
486486 renderState : State ,
487- context : RenderContext
487+ context : RenderContext < ListProps , State , BackPressed >
488488 ): TodoListScreen {
489489 val titles = renderState.todos.map { it.title }
490490
@@ -524,7 +524,7 @@ object RootNavigationWorkflow : StatefulWorkflow<Unit, State, Nothing, Screen>()
524524 override fun render (
525525 renderProps : Unit ,
526526 renderState : State ,
527- context : RenderContext
527+ context : RenderContext < Unit , State , Nothing >
528528 ): Screen {
529529 when (renderState) {
530530 // …
@@ -559,7 +559,7 @@ object RootNavigationWorkflow : StatefulWorkflow<Unit, State, Nothing, BackStack
559559 override fun render (
560560 renderProps : Unit ,
561561 renderState : State ,
562- context : RenderContext
562+ context : RenderContext < Unit , State , Nothing >
563563 ): BackStackScreen <* > {
564564 // We always render the welcomeScreen regardless of the current state.
565565 // It's either showing or else we may want to pop back to it.
@@ -603,7 +603,7 @@ At the same time, use workflow's handy `View.setBackHandler` function to respond
603603> and Android ' s [predictive back gesture](https://developer.android.com/guide/navigation/custom-back/predictive-back-gesture).
604604
605605```kotlin
606- object TodoListWorkflow : StatefulWorkflow<ListProps, State, BackPressed, TodoListScreen >() {
606+ object TodoListWorkflow : StatefulWorkflow<ListProps, State, BackPressed, Screen >() {
607607
608608 // ...
609609
@@ -614,7 +614,7 @@ object TodoListWorkflow : StatefulWorkflow<ListProps, State, BackPressed, TodoLi
614614 override fun render(
615615 renderProps: ListProps,
616616 renderState: State,
617- context: RenderContext
617+ context: RenderContext<ListProps, State, BackPressed>
618618 ): TodoListScreen {
619619 val titles = renderState.todos.map { it.title }
620620 return TodoListScreen(
0 commit comments