diff --git a/samples/tutorial/Tutorial1.md b/samples/tutorial/Tutorial1.md index 481beba47..6bf0e2f45 100644 --- a/samples/tutorial/Tutorial1.md +++ b/samples/tutorial/Tutorial1.md @@ -245,7 +245,7 @@ class TutorialActivity : AppCompatActivity() { @OptIn(WorkflowExperimentalRuntime::class) val renderings: Flow by lazy { renderWorkflowIn( - workflow = RootNavigationWorkflow, + workflow = WelcomeWorkflow, scope = viewModelScope, savedStateHandle = savedState, runtimeConfig = RuntimeConfigOptions.ALL diff --git a/samples/tutorial/Tutorial2.md b/samples/tutorial/Tutorial2.md index af914ba06..fb1b6276f 100644 --- a/samples/tutorial/Tutorial2.md +++ b/samples/tutorial/Tutorial2.md @@ -255,7 +255,9 @@ At the same time, add a `reportNavigation()` call when creating the `renderings` scope = viewModelScope, savedStateHandle = savedState ) - }.reportNavigation() + }.reportNavigation { + Log.i("navigate", it.toString()) +} ``` Now when you run the app we'll see the welcome screen again. @@ -587,8 +589,7 @@ So far it has output `Nothing`. Define a `BackPressed` object and use it as `TodoListWorkflow`'s output type. Update `render()` to create an `eventHandler` function to post the new output event. -At the same time, update TodoListScreen with an `onBack` event handler, -and use workflow's handy `View.setBackHandler` function to respond to Android back press events. +At the same time, use workflow's handy `View.setBackHandler` function to respond to Android back press events. > [!NOTE] `View.setBackHandler` is implemented via > [OnBackPressedCallback](https://developer.android.com/reference/androidx/activity/OnBackPressedCallback) @@ -614,7 +615,7 @@ object TodoListWorkflow : StatefulWorkflow // Tell our parent that a todo item was selected. setOutput(TodoSelected(index)) - }, - onBackPressed = { context.actionSink.send(reportBackPress) }, + } ) } } @@ -227,7 +226,7 @@ object TodoNavigationWorkflow : StatefulWorkflow