diff --git a/gradle.properties b/gradle.properties index f5ffe19141..0a6dec9ba9 100644 --- a/gradle.properties +++ b/gradle.properties @@ -8,7 +8,7 @@ android.useAndroidX=true systemProp.org.gradle.internal.publish.checksums.insecure=true GROUP=com.squareup.workflow1 -VERSION_NAME=1.8.0-uiUpdate01-SNAPSHOT +VERSION_NAME=1.8.0-uiUpdate02-SNAPSHOT POM_DESCRIPTION=Square Workflow diff --git a/workflow-ui/core-android/api/core-android.api b/workflow-ui/core-android/api/core-android.api index fd0c9bddb9..fff19b9e8f 100644 --- a/workflow-ui/core-android/api/core-android.api +++ b/workflow-ui/core-android/api/core-android.api @@ -570,6 +570,13 @@ public final class com/squareup/workflow1/ui/container/DispatchCancelEventKt { public static final fun dispatchCancelEvent (Lkotlin/jvm/functions/Function1;)V } +public final class com/squareup/workflow1/ui/container/EnvironmentScreenLegacyViewFactory : com/squareup/workflow1/ui/ViewFactory { + public static final field INSTANCE Lcom/squareup/workflow1/ui/container/EnvironmentScreenLegacyViewFactory; + public fun buildView (Lcom/squareup/workflow1/ui/container/EnvironmentScreen;Lcom/squareup/workflow1/ui/ViewEnvironment;Landroid/content/Context;Landroid/view/ViewGroup;)Landroid/view/View; + public synthetic fun buildView (Ljava/lang/Object;Lcom/squareup/workflow1/ui/ViewEnvironment;Landroid/content/Context;Landroid/view/ViewGroup;)Landroid/view/View; + public fun getType ()Lkotlin/reflect/KClass; +} + public final class com/squareup/workflow1/ui/container/EnvironmentScreenViewFactoryKt { public static final fun EnvironmentScreenViewFactory ()Lcom/squareup/workflow1/ui/ScreenViewFactory; } diff --git a/workflow-ui/core-android/src/main/java/com/squareup/workflow1/ui/AndroidViewRegistry.kt b/workflow-ui/core-android/src/main/java/com/squareup/workflow1/ui/AndroidViewRegistry.kt index 0740ddaed7..0f1b456275 100644 --- a/workflow-ui/core-android/src/main/java/com/squareup/workflow1/ui/AndroidViewRegistry.kt +++ b/workflow-ui/core-android/src/main/java/com/squareup/workflow1/ui/AndroidViewRegistry.kt @@ -6,6 +6,8 @@ import android.content.Context import android.view.View import android.view.ViewGroup import com.squareup.workflow1.ui.container.BackStackScreen +import com.squareup.workflow1.ui.container.EnvironmentScreen +import com.squareup.workflow1.ui.container.EnvironmentScreenLegacyViewFactory import kotlin.reflect.KClass @Deprecated("Use ScreenViewFactoryFinder.getViewFactoryForRendering()") @@ -20,6 +22,9 @@ public fun ViewRegistry.getFactoryForRendering( ?: (rendering as? BackStackScreen<*>)?.let { BackStackScreenLegacyViewFactory as ViewFactory } + ?: (rendering as? EnvironmentScreen<*>)?.let { + EnvironmentScreenLegacyViewFactory as ViewFactory + } ?: (rendering as? Named<*>)?.let { NamedViewFactory as ViewFactory } ?: throw IllegalArgumentException( "A ViewFactory should have been registered to display $rendering, " + diff --git a/workflow-ui/core-android/src/main/java/com/squareup/workflow1/ui/container/EnvironmentScreenLegacyViewFactory.kt b/workflow-ui/core-android/src/main/java/com/squareup/workflow1/ui/container/EnvironmentScreenLegacyViewFactory.kt new file mode 100644 index 0000000000..1cf55202a7 --- /dev/null +++ b/workflow-ui/core-android/src/main/java/com/squareup/workflow1/ui/container/EnvironmentScreenLegacyViewFactory.kt @@ -0,0 +1,18 @@ +@file:Suppress("DEPRECATION") + +package com.squareup.workflow1.ui.container + +import com.squareup.workflow1.ui.DecorativeViewFactory +import com.squareup.workflow1.ui.ViewFactory +import com.squareup.workflow1.ui.WorkflowUiExperimentalApi +import com.squareup.workflow1.ui.merge + +@Suppress("DEPRECATION") +@WorkflowUiExperimentalApi +internal object EnvironmentScreenLegacyViewFactory : ViewFactory> +by DecorativeViewFactory( + type = EnvironmentScreen::class, + map = { environmentScreen, inheritedEnvironment -> + Pair(environmentScreen.wrapped, environmentScreen.environment merge inheritedEnvironment) + } +)