Skip to content

Commit 61b94d1

Browse files
authored
Merge pull request #632 from square/ray/embrace-the-viewmodel
WorkflowLayout.start needs a Lifecycle, BackStackScreen is supported.
2 parents be479f2 + 01eb576 commit 61b94d1

File tree

24 files changed

+171
-107
lines changed

24 files changed

+171
-107
lines changed

samples/compose-samples/src/main/java/com/squareup/sample/compose/hellocomposebinding/HelloBindingActivity.kt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,7 @@ class HelloBindingActivity : AppCompatActivity() {
3636
val model: HelloBindingModel by viewModels()
3737
setContentView(
3838
WorkflowLayout(this).apply {
39-
start(
40-
renderings = model.renderings,
41-
environment = viewEnvironment
42-
)
39+
start(lifecycle, model.renderings, viewEnvironment)
4340
}
4441
)
4542
}

samples/compose-samples/src/main/java/com/squareup/sample/compose/hellocomposeworkflow/HelloComposeWorkflowActivity.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class HelloComposeWorkflowActivity : AppCompatActivity() {
1717
super.onCreate(savedInstanceState)
1818
val model: HelloComposeModel by viewModels()
1919
setContentView(
20-
WorkflowLayout(this).apply { start(model.renderings) }
20+
WorkflowLayout(this).apply { start(lifecycle, model.renderings) }
2121
)
2222
}
2323

samples/compose-samples/src/main/java/com/squareup/sample/compose/inlinerendering/InlineRenderingActivity.kt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,7 @@ class InlineRenderingActivity : AppCompatActivity() {
2121

2222
val model: HelloBindingModel by viewModels()
2323
setContentView(
24-
WorkflowLayout(this).apply {
25-
start(renderings = model.renderings)
26-
}
24+
WorkflowLayout(this).apply { start(lifecycle, model.renderings) }
2725
)
2826
}
2927

samples/compose-samples/src/main/java/com/squareup/sample/compose/nestedrenderings/NestedRenderingsActivity.kt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,7 @@ class NestedRenderingsActivity : AppCompatActivity() {
3838
val model: NestedRenderingsModel by viewModels()
3939
setContentView(
4040
WorkflowLayout(this).apply {
41-
start(
42-
renderings = model.renderings,
43-
environment = viewEnvironment
44-
)
41+
start(lifecycle, model.renderings, viewEnvironment)
4542
}
4643
)
4744
}

samples/containers/android/src/main/java/com/squareup/sample/container/BackButtonScreen.kt

Lines changed: 0 additions & 23 deletions
This file was deleted.

samples/containers/android/src/main/java/com/squareup/sample/container/BackButtonViewFactory.kt

Lines changed: 0 additions & 31 deletions
This file was deleted.

samples/containers/android/src/main/java/com/squareup/sample/container/SampleContainers.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ import com.squareup.workflow1.ui.WorkflowUiExperimentalApi
88

99
@OptIn(WorkflowUiExperimentalApi::class)
1010
val SampleContainers = ViewRegistry(
11-
BackButtonViewFactory, OverviewDetailContainer, PanelContainer, ScrimContainer
11+
OverviewDetailContainer, PanelContainer, ScrimContainer
1212
)

samples/containers/app-poetry/src/main/java/com/squareup/sample/poetryapp/PoetryActivity.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class PoetryActivity : AppCompatActivity() {
2626

2727
val model: PoetryModel by viewModels()
2828
setContentView(
29-
WorkflowLayout(this).apply { start(model.renderings, viewRegistry) }
29+
WorkflowLayout(this).apply { start(lifecycle, model.renderings, viewRegistry) }
3030
)
3131
}
3232

samples/containers/app-raven/src/main/java/com/squareup/sample/ravenapp/RavenActivity.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class RavenActivity : AppCompatActivity() {
3030

3131
val model: RavenModel by viewModels()
3232
setContentView(
33-
WorkflowLayout(this).apply { start(model.renderings, viewRegistry) }
33+
WorkflowLayout(this).apply { start(lifecycle, model.renderings, viewRegistry) }
3434
)
3535

3636
lifecycleScope.launch {

samples/containers/hello-back-button/src/main/java/com/squareup/sample/hellobackbutton/AreYouSureWorkflow.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package com.squareup.sample.hellobackbutton
22

33
import android.os.Parcelable
4-
import com.squareup.sample.container.BackButtonScreen
54
import com.squareup.sample.hellobackbutton.AreYouSureWorkflow.Finished
65
import com.squareup.sample.hellobackbutton.AreYouSureWorkflow.State
76
import com.squareup.sample.hellobackbutton.AreYouSureWorkflow.State.Quitting
@@ -10,6 +9,7 @@ import com.squareup.workflow1.Snapshot
109
import com.squareup.workflow1.StatefulWorkflow
1110
import com.squareup.workflow1.WorkflowAction.Companion.noAction
1211
import com.squareup.workflow1.action
12+
import com.squareup.workflow1.ui.BackButtonScreen
1313
import com.squareup.workflow1.ui.WorkflowUiExperimentalApi
1414
import com.squareup.workflow1.ui.modal.AlertContainerScreen
1515
import com.squareup.workflow1.ui.modal.AlertScreen

0 commit comments

Comments
 (0)