Skip to content

Commit 83314af

Browse files
authored
Merge pull request #837 from square/ray/deprecation-time
Deprecates old view building API.
2 parents 8ad099d + 51c5caf commit 83314af

File tree

11 files changed

+33
-29
lines changed

11 files changed

+33
-29
lines changed

workflow-ui/container-common/src/main/java/com/squareup/workflow1/ui/backstack/BackStackScreen.kt

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

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

@@ -26,7 +26,7 @@ import com.squareup.workflow1.ui.container.BackStackScreen as NewBackStackScreen
2626
* @param rest the rest of the stack, empty by default
2727
*/
2828
@WorkflowUiExperimentalApi
29-
// @Deprecated("Use com.squareup.workflow1.ui.container.BackStackScreen")
29+
@Deprecated("Use com.squareup.workflow1.ui.container.BackStackScreen")
3030
public class BackStackScreen<StackedT : Any>(
3131
bottom: StackedT,
3232
rest: List<StackedT>

workflow-ui/core-android/src/main/java/com/squareup/workflow1/ui/AndroidViewRegistry.kt

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

33
package com.squareup.workflow1.ui
44

@@ -27,7 +27,7 @@ import kotlin.reflect.KClass
2727
*
2828
* @throws IllegalArgumentException if no factory can be find for type [RenderingT]
2929
*/
30-
// @Deprecated("Use ScreenViewFactoryFinder.getViewFactoryForRendering()")
30+
@Deprecated("Use ScreenViewFactoryFinder.getViewFactoryForRendering()")
3131
@WorkflowUiExperimentalApi
3232
public fun <RenderingT : Any> ViewRegistry.getFactoryForRendering(
3333
rendering: RenderingT
@@ -56,10 +56,10 @@ public fun <RenderingT : Any> ViewRegistry.getFactoryForRendering(
5656
* Returns the [ViewFactory] that was registered for the given [renderingType], or null
5757
* if none was found.
5858
*/
59-
// @Deprecated(
60-
// "Use getEntryFor()",
61-
// ReplaceWith("getEntryFor(renderingType)")
62-
// )
59+
@Deprecated(
60+
"Use getEntryFor()",
61+
ReplaceWith("getEntryFor(renderingType)")
62+
)
6363
@WorkflowUiExperimentalApi
6464
public fun <RenderingT : Any> ViewRegistry.getFactoryFor(
6565
renderingType: KClass<out RenderingT>
@@ -87,7 +87,7 @@ public fun <RenderingT : Any> ViewRegistry.getFactoryFor(
8787
* @throws IllegalStateException if the matching [ViewFactory] fails to call
8888
* [View.bindShowRendering] when constructing the view
8989
*/
90-
// @Deprecated("Use ScreenViewFactory.startShowing")
90+
@Deprecated("Use ScreenViewFactory.startShowing")
9191
@WorkflowUiExperimentalApi
9292
public fun <RenderingT : Any> ViewRegistry.buildView(
9393
initialRendering: RenderingT,

workflow-ui/core-android/src/main/java/com/squareup/workflow1/ui/AndroidViewRendering.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ package com.squareup.workflow1.ui
2929
* reason, you can use [ViewRegistry] to bind your renderings to [ViewFactory]
3030
* implementations at runtime.
3131
*/
32-
// @Suppress("DEPRECATION")
33-
// @Deprecated("Use AndroidScreen")
32+
@Suppress("DEPRECATION")
33+
@Deprecated("Use AndroidScreen")
3434
@WorkflowUiExperimentalApi
3535
public interface AndroidViewRendering<V : AndroidViewRendering<V>> {
3636
/**

workflow-ui/core-android/src/main/java/com/squareup/workflow1/ui/BackButtonScreen.kt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ package com.squareup.workflow1.ui
1818
* is pressed, or null to set no handler -- or clear a handler that was set previously.
1919
* Defaults to `null`.
2020
*/
21-
// @Suppress("DEPRECATION")
21+
@Suppress("DEPRECATION")
2222
@WorkflowUiExperimentalApi
23-
// @Deprecated(
24-
// "Use com.squareup.workflow1.ui.container.BackButtonScreen",
25-
// ReplaceWith("BackButtonScreen", "com.squareup.workflow1.ui.container.BackButtonScreen")
26-
// )
23+
@Deprecated(
24+
"Use com.squareup.workflow1.ui.container.BackButtonScreen",
25+
ReplaceWith("BackButtonScreen", "com.squareup.workflow1.ui.container.BackButtonScreen")
26+
)
2727
public class BackButtonScreen<W : Any>(
2828
public val wrapped: W,
2929
public val shadow: Boolean = false,

workflow-ui/core-android/src/main/java/com/squareup/workflow1/ui/BuilderViewFactory.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ import kotlin.reflect.KClass
2626
* private fun update(rendering: MyView) { ... }
2727
* }
2828
*/
29-
// @Suppress("DEPRECATION")
30-
// @Deprecated("Use ScreenViewFactory.fromCode")
29+
@Suppress("DEPRECATION")
30+
@Deprecated("Use ScreenViewFactory.fromCode")
3131
@WorkflowUiExperimentalApi
3232
public class BuilderViewFactory<RenderingT : Any>(
3333
override val type: KClass<RenderingT>,

workflow-ui/core-android/src/main/java/com/squareup/workflow1/ui/DecorativeViewFactory.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,8 @@ import kotlin.reflect.KClass
110110
* [InnerT], allowing pre- and post-processing. Default implementation simply
111111
* uses [map] to extract the [InnerT] instance from [OuterT] and makes the function call.
112112
*/
113-
// @Suppress("DEPRECATION")
114-
// @Deprecated("Use ScreenViewFactory.toUnwrappingViewFactory")
113+
@Suppress("DEPRECATION")
114+
@Deprecated("Use ScreenViewFactory.toUnwrappingViewFactory")
115115
@WorkflowUiExperimentalApi
116116
public class DecorativeViewFactory<OuterT : Any, InnerT : Any>(
117117
override val type: KClass<OuterT>,

workflow-ui/core-android/src/main/java/com/squareup/workflow1/ui/LayoutRunner.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// @file:Suppress("DEPRECATION")
1+
@file:Suppress("DEPRECATION")
22
package com.squareup.workflow1.ui
33

44
import android.view.View
@@ -17,7 +17,7 @@ import androidx.viewbinding.ViewBinding
1717
* implement this interface at all. For details, see the three overloads of [LayoutRunner.bind].
1818
*/
1919
@WorkflowUiExperimentalApi
20-
// @Deprecated("Use ScreenViewRunner")
20+
@Deprecated("Use ScreenViewRunner")
2121
public fun interface LayoutRunner<RenderingT : Any> {
2222
public fun showRendering(
2323
rendering: RenderingT,

workflow-ui/core-android/src/main/java/com/squareup/workflow1/ui/LegacyFactoryForScreenType.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
@file:Suppress("DEPRECATION")
2+
13
package com.squareup.workflow1.ui
24

35
import android.content.Context

workflow-ui/core-android/src/main/java/com/squareup/workflow1/ui/ViewFactory.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import android.view.ViewGroup
2020
* them with appropriate an appropriate [ViewFactory]. For more flexibility, and to
2121
* avoid coupling your workflow directly to the Android runtime, see [ViewRegistry].
2222
*/
23-
// @Deprecated("Use ScreenViewFactory")
23+
@Deprecated("Use ScreenViewFactory")
2424
@WorkflowUiExperimentalApi
2525
public interface ViewFactory<in RenderingT : Any> : ViewRegistry.Entry<RenderingT> {
2626
/**

workflow-ui/core-android/src/main/java/com/squareup/workflow1/ui/ViewShowRendering.kt

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,9 @@ public typealias ViewShowRendering<RenderingT> =
3131
* @see ViewFactory
3232
* @see DecorativeViewFactory
3333
*/
34+
@Suppress("DeprecatedCallableAddReplaceWith")
3435
@WorkflowUiExperimentalApi
35-
// @Deprecated("Replaced by ScreenViewHolder")
36+
@Deprecated("Replaced by ScreenViewHolder")
3637
public fun <RenderingT : Any> View.bindShowRendering(
3738
initialRendering: RenderingT,
3839
initialViewEnvironment: ViewEnvironment,
@@ -64,7 +65,7 @@ public fun <RenderingT : Any> View.bindShowRendering(
6465
* - It is an error to call [View.showRendering] without having called this method first.
6566
*/
6667
@WorkflowUiExperimentalApi
67-
// @Deprecated("Use ScreenViewFactory.startShowing to create a ScreenViewHolder")
68+
@Deprecated("Use ScreenViewFactory.startShowing to create a ScreenViewHolder")
6869
public fun View.start() {
6970
val current = workflowViewStateAsNew
7071
workflowViewState = Started(current.showing, current.environment, current.showRendering)
@@ -83,7 +84,7 @@ public fun View.start() {
8384
* [View.getRendering] and the new one.
8485
*/
8586
@WorkflowUiExperimentalApi
86-
// @Deprecated("Replaced by ScreenViewHolder.canShow")
87+
@Deprecated("Replaced by ScreenViewHolder.canShow")
8788
public fun View.canShowRendering(rendering: Any): Boolean {
8889
@Suppress("DEPRECATION")
8990
return getRendering<Any>()?.let { compatible(it, rendering) } == true
@@ -101,7 +102,7 @@ public fun View.canShowRendering(rendering: Any): Boolean {
101102
* @throws IllegalStateException if [bindShowRendering] has not been called.
102103
*/
103104
@WorkflowUiExperimentalApi
104-
// @Deprecated("Replaced by ScreenViewHolder.show")
105+
@Deprecated("Replaced by ScreenViewHolder.show")
105106
public fun <RenderingT : Any> View.showRendering(
106107
rendering: RenderingT,
107108
viewEnvironment: ViewEnvironment
@@ -188,8 +189,9 @@ public val View.environmentOrNull: ViewEnvironment?
188189
* Returns the function set by the most recent call to [bindShowRendering], or null
189190
* if that method has never been called.
190191
*/
192+
@Suppress("DeprecatedCallableAddReplaceWith")
191193
@WorkflowUiExperimentalApi
192-
// @Deprecated("Replaced by ScreenViewHolder")
194+
@Deprecated("Replaced by ScreenViewHolder")
193195
public fun <RenderingT : Any> View.getShowRendering(): ViewShowRendering<RenderingT>? {
194196
return workflowViewStateOrNull?.showRendering
195197
}

0 commit comments

Comments
 (0)