Skip to content

Commit ce6242f

Browse files
committed
Deletes deprecated enterState and modifyState
A tiny bit of convenience, a lot of landmines.
1 parent e931852 commit ce6242f

File tree

2 files changed

+0
-98
lines changed

2 files changed

+0
-98
lines changed

workflow-core/api/workflow-core.api

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -139,14 +139,6 @@ public abstract interface class com/squareup/workflow/WorkflowAction {
139139
}
140140

141141
public final class com/squareup/workflow/WorkflowAction$Companion {
142-
public final fun emitOutput (Ljava/lang/Object;)Lcom/squareup/workflow/WorkflowAction;
143-
public final fun emitOutput (Ljava/lang/String;Ljava/lang/Object;)Lcom/squareup/workflow/WorkflowAction;
144-
public final fun enterState (Ljava/lang/Object;Ljava/lang/Object;)Lcom/squareup/workflow/WorkflowAction;
145-
public final fun enterState (Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Lcom/squareup/workflow/WorkflowAction;
146-
public static synthetic fun enterState$default (Lcom/squareup/workflow/WorkflowAction$Companion;Ljava/lang/Object;Ljava/lang/Object;ILjava/lang/Object;)Lcom/squareup/workflow/WorkflowAction;
147-
public static synthetic fun enterState$default (Lcom/squareup/workflow/WorkflowAction$Companion;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;ILjava/lang/Object;)Lcom/squareup/workflow/WorkflowAction;
148-
public final fun modifyState (Lkotlin/jvm/functions/Function0;Ljava/lang/Object;Lkotlin/jvm/functions/Function1;)Lcom/squareup/workflow/WorkflowAction;
149-
public static synthetic fun modifyState$default (Lcom/squareup/workflow/WorkflowAction$Companion;Lkotlin/jvm/functions/Function0;Ljava/lang/Object;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lcom/squareup/workflow/WorkflowAction;
150142
public final fun noAction ()Lcom/squareup/workflow/WorkflowAction;
151143
}
152144

workflow-core/src/main/java/com/squareup/workflow/WorkflowAction.kt

Lines changed: 0 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -79,96 +79,6 @@ interface WorkflowAction<in PropsT, StateT, out OutputT> {
7979
fun <PropsT, StateT, OutputT> noAction(): WorkflowAction<PropsT, StateT, OutputT> =
8080
NO_ACTION as WorkflowAction<Any?, StateT, OutputT>
8181

82-
/**
83-
* Convenience function that returns a [WorkflowAction] that will just set the state to
84-
* [newState] (without considering the current state) and optionally emit an output.
85-
*/
86-
@Deprecated(
87-
message = "Use action",
88-
replaceWith = ReplaceWith(
89-
expression = "action { state = newState }",
90-
imports = arrayOf("com.squareup.workflow.action")
91-
)
92-
)
93-
fun <StateT, OutputT> enterState(
94-
newState: StateT,
95-
emittingOutput: OutputT? = null
96-
): WorkflowAction<Any?, StateT, OutputT> =
97-
action({ "enterState($newState, $emittingOutput)" }) {
98-
state = newState
99-
emittingOutput?.let { setOutput(it) }
100-
}
101-
102-
/**
103-
* Convenience function that returns a [WorkflowAction] that will just set the state to
104-
* [newState] (without considering the current state) and optionally emit an output.
105-
*/
106-
@Deprecated(
107-
message = "Use action",
108-
replaceWith = ReplaceWith(
109-
expression = "action { state = newState }",
110-
imports = arrayOf("com.squareup.workflow.action")
111-
)
112-
)
113-
fun <StateT, OutputT> enterState(
114-
name: String,
115-
newState: StateT,
116-
emittingOutput: OutputT? = null
117-
): WorkflowAction<Any?, StateT, OutputT> =
118-
action({ "enterState($name, $newState, $emittingOutput)" }) {
119-
state = newState
120-
emittingOutput?.let { setOutput(it) }
121-
}
122-
123-
/**
124-
* Convenience function to implement [WorkflowAction] without returning the output.
125-
*/
126-
@Deprecated(
127-
message = "Use action",
128-
replaceWith = ReplaceWith(
129-
expression = "action(name) { state = state }",
130-
imports = arrayOf("com.squareup.workflow.action")
131-
)
132-
)
133-
fun <StateT, OutputT> modifyState(
134-
name: () -> String,
135-
emittingOutput: OutputT? = null,
136-
modify: (StateT) -> StateT
137-
): WorkflowAction<Any?, StateT, OutputT> =
138-
action({ "modifyState(${name()}, $emittingOutput)" }) {
139-
state = modify(state)
140-
emittingOutput?.let { setOutput(it) }
141-
}
142-
143-
/**
144-
* Convenience function to implement [WorkflowAction] without changing the state.
145-
*/
146-
@Deprecated(
147-
message = "Use action",
148-
replaceWith = ReplaceWith(
149-
expression = "action { setOutput(output) }",
150-
imports = arrayOf("com.squareup.workflow.action")
151-
)
152-
)
153-
fun <StateT, OutputT> emitOutput(output: OutputT): WorkflowAction<Any?, StateT, OutputT> =
154-
action({ "emitOutput($output)" }) { setOutput(output) }
155-
156-
/**
157-
* Convenience function to implement [WorkflowAction] without changing the state.
158-
*/
159-
@Deprecated(
160-
message = "Use action",
161-
replaceWith = ReplaceWith(
162-
expression = "action { setOutput(output) }",
163-
imports = arrayOf("com.squareup.workflow.action")
164-
)
165-
)
166-
fun <PropsT, StateT, OutputT> emitOutput(
167-
name: String,
168-
output: OutputT
169-
): WorkflowAction<PropsT, StateT, OutputT> =
170-
action({ "emitOutput($name, $output)" }) { setOutput(output) }
171-
17282
private val NO_ACTION = action<Any, Any, Any>({ "noAction" }) { }
17383
}
17484
}

0 commit comments

Comments
 (0)