Skip to content

Commit 93ed6f1

Browse files
rjrjrHelios Alonso Cabanillas
andcommitted
Deletes bad compose null check
This could never have worked, as this method is not and was not the method that swizzles in AndroidViewRendering and such. Compose sample choked on AsIs with this, and spookily works just fine when I delete the check. So...is this transformation actually necessary? Has AndroidViewRendering been broken all along? Will have to check. Co-authored-by: Helios Alonso Cabanillas <[email protected]>
1 parent 993d20c commit 93ed6f1

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

workflow-ui/compose/src/main/java/com/squareup/workflow1/ui/compose/CompositionRoot.kt

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@file:Suppress("RemoveEmptyParenthesesFromAnnotationEntry", "DEPRECATION")
1+
@file:Suppress("RemoveEmptyParenthesesFromAnnotationEntry", "DEPRECATION", "FunctionName")
22

33
package com.squareup.workflow1.ui.compose
44

@@ -7,7 +7,6 @@ import androidx.annotation.VisibleForTesting.PRIVATE
77
import androidx.compose.runtime.Composable
88
import androidx.compose.runtime.CompositionLocalProvider
99
import androidx.compose.runtime.staticCompositionLocalOf
10-
import com.squareup.workflow1.ui.AndroidViewRendering
1110
import com.squareup.workflow1.ui.ViewEnvironment
1211
import com.squareup.workflow1.ui.ViewFactory
1312
import com.squareup.workflow1.ui.ViewRegistry
@@ -94,14 +93,9 @@ private fun ViewRegistry.mapFactories(
9493

9594
override fun <RenderingT : Any> getEntryFor(
9695
renderingType: KClass<out RenderingT>
97-
): ViewFactory<RenderingT> {
98-
val factoryFor =
99-
(this@mapFactories.getEntryFor(renderingType) as? ViewFactory<*>)
100-
?: throw IllegalArgumentException(
101-
"A ${ViewFactory::class.qualifiedName} should have been registered to display " +
102-
"${renderingType.qualifiedName} instances, or that class should implement " +
103-
"${AndroidViewRendering::class.simpleName}<${renderingType.simpleName}>."
104-
)
96+
): ViewFactory<RenderingT>? {
97+
val factoryFor = (this@mapFactories.getEntryFor(renderingType) as? ViewFactory<*>)
98+
?: return null
10599
val transformedFactory = transform(factoryFor)
106100
check(transformedFactory.type == renderingType) {
107101
"Expected transform to return a ViewFactory that is compatible with $renderingType, " +

0 commit comments

Comments
 (0)