From 01585e99b44ddac3648f643ae9dde82275a87db4 Mon Sep 17 00:00:00 2001 From: rjrjr Date: Wed, 24 Jan 2024 21:28:25 +0000 Subject: [PATCH] Apply changes from ktLintFormat Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- .../compose/nestedrenderings/RecursiveViewFactory.kt | 2 +- .../sample/compose/textinput/TextInputViewFactory.kt | 2 +- .../ui/compose/tooling/PreviewViewFactoryTest.kt | 2 +- .../ui/compose/tooling/PlaceholderViewFactory.kt | 1 - .../ui/compose/tooling/PreviewViewEnvironment.kt | 8 +++++--- .../com/squareup/workflow1/ui/compose/tooling/Previews.kt | 6 ++++-- .../squareup/workflow1/ui/compose/WorkflowRendering.kt | 1 - 7 files changed, 12 insertions(+), 10 deletions(-) diff --git a/samples/compose-samples/src/main/java/com/squareup/sample/compose/nestedrenderings/RecursiveViewFactory.kt b/samples/compose-samples/src/main/java/com/squareup/sample/compose/nestedrenderings/RecursiveViewFactory.kt index 793414abf2..0a8025cce1 100644 --- a/samples/compose-samples/src/main/java/com/squareup/sample/compose/nestedrenderings/RecursiveViewFactory.kt +++ b/samples/compose-samples/src/main/java/com/squareup/sample/compose/nestedrenderings/RecursiveViewFactory.kt @@ -26,8 +26,8 @@ import com.squareup.sample.compose.nestedrenderings.RecursiveWorkflow.Rendering import com.squareup.workflow1.ui.Screen import com.squareup.workflow1.ui.ViewEnvironment import com.squareup.workflow1.ui.WorkflowUiExperimentalApi -import com.squareup.workflow1.ui.compose.WorkflowRendering import com.squareup.workflow1.ui.compose.ScreenComposableFactory +import com.squareup.workflow1.ui.compose.WorkflowRendering import com.squareup.workflow1.ui.compose.tooling.Preview /** diff --git a/samples/compose-samples/src/main/java/com/squareup/sample/compose/textinput/TextInputViewFactory.kt b/samples/compose-samples/src/main/java/com/squareup/sample/compose/textinput/TextInputViewFactory.kt index 7f06381c84..979dedf2ea 100644 --- a/samples/compose-samples/src/main/java/com/squareup/sample/compose/textinput/TextInputViewFactory.kt +++ b/samples/compose-samples/src/main/java/com/squareup/sample/compose/textinput/TextInputViewFactory.kt @@ -19,8 +19,8 @@ import androidx.compose.ui.unit.dp import com.squareup.sample.compose.textinput.TextInputWorkflow.Rendering import com.squareup.workflow1.ui.TextController import com.squareup.workflow1.ui.WorkflowUiExperimentalApi -import com.squareup.workflow1.ui.compose.asMutableState import com.squareup.workflow1.ui.compose.ScreenComposableFactory +import com.squareup.workflow1.ui.compose.asMutableState import com.squareup.workflow1.ui.compose.tooling.Preview @OptIn(WorkflowUiExperimentalApi::class) diff --git a/workflow-ui/compose-tooling/src/androidTest/java/com/squareup/workflow1/ui/compose/tooling/PreviewViewFactoryTest.kt b/workflow-ui/compose-tooling/src/androidTest/java/com/squareup/workflow1/ui/compose/tooling/PreviewViewFactoryTest.kt index 5ab7c993b9..a9e261a209 100644 --- a/workflow-ui/compose-tooling/src/androidTest/java/com/squareup/workflow1/ui/compose/tooling/PreviewViewFactoryTest.kt +++ b/workflow-ui/compose-tooling/src/androidTest/java/com/squareup/workflow1/ui/compose/tooling/PreviewViewFactoryTest.kt @@ -17,8 +17,8 @@ import androidx.test.ext.junit.runners.AndroidJUnit4 import com.squareup.workflow1.ui.Screen import com.squareup.workflow1.ui.ViewEnvironmentKey import com.squareup.workflow1.ui.WorkflowUiExperimentalApi -import com.squareup.workflow1.ui.compose.WorkflowRendering import com.squareup.workflow1.ui.compose.ScreenComposableFactory +import com.squareup.workflow1.ui.compose.WorkflowRendering import com.squareup.workflow1.ui.internal.test.IdleAfterTestRule import com.squareup.workflow1.ui.internal.test.IdlingDispatcherRule import leakcanary.DetectLeaksAfterTestSuccess diff --git a/workflow-ui/compose-tooling/src/main/java/com/squareup/workflow1/ui/compose/tooling/PlaceholderViewFactory.kt b/workflow-ui/compose-tooling/src/main/java/com/squareup/workflow1/ui/compose/tooling/PlaceholderViewFactory.kt index 67ac0bd9e5..80483e3bfb 100644 --- a/workflow-ui/compose-tooling/src/main/java/com/squareup/workflow1/ui/compose/tooling/PlaceholderViewFactory.kt +++ b/workflow-ui/compose-tooling/src/main/java/com/squareup/workflow1/ui/compose/tooling/PlaceholderViewFactory.kt @@ -23,7 +23,6 @@ import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.dp import com.squareup.workflow1.ui.Screen -import com.squareup.workflow1.ui.ScreenViewFactory import com.squareup.workflow1.ui.WorkflowUiExperimentalApi import com.squareup.workflow1.ui.compose.ScreenComposableFactory diff --git a/workflow-ui/compose-tooling/src/main/java/com/squareup/workflow1/ui/compose/tooling/PreviewViewEnvironment.kt b/workflow-ui/compose-tooling/src/main/java/com/squareup/workflow1/ui/compose/tooling/PreviewViewEnvironment.kt index f497bb3ab9..f324f8d91e 100644 --- a/workflow-ui/compose-tooling/src/main/java/com/squareup/workflow1/ui/compose/tooling/PreviewViewEnvironment.kt +++ b/workflow-ui/compose-tooling/src/main/java/com/squareup/workflow1/ui/compose/tooling/PreviewViewEnvironment.kt @@ -41,9 +41,11 @@ import com.squareup.workflow1.ui.compose.asViewFactory ) } return remember(composableFactoryFinder, viewEnvironmentUpdater) { - (ViewEnvironment.EMPTY + - (ScreenComposableFactoryFinder to composableFactoryFinder) + - (ScreenViewFactoryFinder to screenFactoryFinder)).let { environment -> + ( + ViewEnvironment.EMPTY + + (ScreenComposableFactoryFinder to composableFactoryFinder) + + (ScreenViewFactoryFinder to screenFactoryFinder) + ).let { environment -> // Give the preview a chance to add its own elements to the ViewEnvironment. viewEnvironmentUpdater?.let { it(environment) } ?: environment } diff --git a/workflow-ui/compose-tooling/src/main/java/com/squareup/workflow1/ui/compose/tooling/Previews.kt b/workflow-ui/compose-tooling/src/main/java/com/squareup/workflow1/ui/compose/tooling/Previews.kt index 25cf705829..394a0cebd3 100644 --- a/workflow-ui/compose-tooling/src/main/java/com/squareup/workflow1/ui/compose/tooling/Previews.kt +++ b/workflow-ui/compose-tooling/src/main/java/com/squareup/workflow1/ui/compose/tooling/Previews.kt @@ -41,8 +41,10 @@ public fun Screen.Preview( placeholderModifier: Modifier = Modifier, viewEnvironmentUpdater: ((ViewEnvironment) -> ViewEnvironment)? = null ) { - val factoryEnv = (viewEnvironmentUpdater?.invoke(ViewEnvironment.EMPTY) - ?: ViewEnvironment.EMPTY) + val factoryEnv = ( + viewEnvironmentUpdater?.invoke(ViewEnvironment.EMPTY) + ?: ViewEnvironment.EMPTY + ) factoryEnv[ScreenComposableFactoryFinder] .getComposableFactoryForRendering(factoryEnv, this) diff --git a/workflow-ui/compose/src/main/java/com/squareup/workflow1/ui/compose/WorkflowRendering.kt b/workflow-ui/compose/src/main/java/com/squareup/workflow1/ui/compose/WorkflowRendering.kt index 4dd155b5d6..e8a4f9b24e 100644 --- a/workflow-ui/compose/src/main/java/com/squareup/workflow1/ui/compose/WorkflowRendering.kt +++ b/workflow-ui/compose/src/main/java/com/squareup/workflow1/ui/compose/WorkflowRendering.kt @@ -21,7 +21,6 @@ import com.squareup.workflow1.ui.ScreenViewHolder import com.squareup.workflow1.ui.ViewEnvironment import com.squareup.workflow1.ui.WorkflowUiExperimentalApi import com.squareup.workflow1.ui.WorkflowViewStub -import com.squareup.workflow1.ui.androidx.OnBackPressedDispatcherOwnerKey import com.squareup.workflow1.ui.androidx.WorkflowLifecycleOwner /**