Skip to content

Commit 69dbee7

Browse files
committed
Merge branch 'release-v0.22.x'
* release-v0.22.x: Finish release v0.22.4 Releasing v0.22.4. 0.22.4 CHANGELOG.md Flag out WorkflowTesting APIs when in Release mode Allow empty snapshots to be passed into launchWorkflowIn.
2 parents fadd192 + 844e489 commit 69dbee7

File tree

6 files changed

+31
-8
lines changed

6 files changed

+31
-8
lines changed

CHANGELOG.md

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
Change Log
22
==========
3+
## Version 0.22.4
4+
5+
_2020-01-15_
6+
7+
### Kotlin
8+
9+
* Allow empty snapshots to be passed into launchWorkflowIn (#881)
10+
11+
### Swift
12+
13+
* Flag out WorkflowTesting APIs when in Release mode (#872)
314

415
## Version 0.22.3
516

@@ -508,7 +519,7 @@ _2019-3-12_
508519
method. (#57)
509520
* `BackStackEffect` allows configuration of transition effects between `BackStackScreen`s.
510521
* `ModalContainer` adds support for `AlertDialog` and custom views in `Dialog` windows.
511-
* Sample app consolidated to two modules, `samples/tictactoe/android` and
522+
* Sample app consolidated to two modules, `samples/tictactoe/android` and
512523
`samples/tictactoe/common`. Various `Shell*` classes in sample renamed to `Main*`.
513524
* Breaking change, `EventHandlingScreen` interface eliminated. It wasn't useful.
514525
* Breaking change, `workflow-core`, `workflow-rx2`, and `workflow-test` modules moved to legacy
@@ -528,7 +539,7 @@ _2019-1-4_
528539

529540
* Breaking change, further API refinement of `WorkflowPool` and friends.
530541
Extracts `WorkflowUpdate` and `WorkflowPool.Handle` from the defunct
531-
`WorkflowHandle`. (#114)
542+
`WorkflowHandle`. (#114)
532543

533544
## Version 0.6.0
534545

Workflow.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Pod::Spec.new do |s|
1717
s.source_files = 'swift/Workflow/Sources/*.swift'
1818

1919
s.dependency 'ReactiveSwift', '~> 6.0.0'
20-
20+
2121
s.test_spec 'Tests' do |test_spec|
2222
test_spec.source_files = 'swift/Workflow/Tests/**/*.swift'
2323
test_spec.framework = 'XCTest'

WorkflowUI.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Pod::Spec.new do |s|
1717
s.source_files = 'swift/WorkflowUI/Sources/**/*.swift'
1818

1919
s.dependency 'Workflow', "#{s.version}"
20-
20+
2121
s.test_spec 'Tests' do |test_spec|
2222
test_spec.source_files = 'swift/WorkflowUI/Tests/**/*.swift'
2323
test_spec.framework = 'XCTest'

kotlin/workflow-runtime/src/main/java/com/squareup/workflow/LaunchWorkflow.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ internal typealias Configurator <O, R, T> = CoroutineScope.(
8585
* will fail (report an exception up through [scope]). If this flow completes _after_ emitting at
8686
* least one value, the runtime will _not_ fail or stop, it will continue running with the
8787
* last-emitted input.
88-
* @param initialSnapshot If not null, used to restore the workflow.
88+
* @param initialSnapshot If not null or empty, used to restore the workflow.
8989
* @param beforeStart Called exactly once with the flows for renderings/snapshots and outputs.
9090
* It also gets a sub-scope of [scope] with a newly created child [Job] which defines the lifetime
9191
* of the launched workflow tree. Cancelling that job ends the new workflow session.

kotlin/workflow-runtime/src/main/java/com/squareup/workflow/internal/WorkflowLoop.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ internal interface WorkflowLoop {
3535
* Loops forever, or until the coroutine is cancelled, processing the workflow tree and emitting
3636
* updates by calling [onRendering] and [onOutput].
3737
*
38-
* This function is the lowest-level entry point into the runtime. Don't call this directly, instead
39-
* call [com.squareup.workflow.launchWorkflowIn].
38+
* This function is the lowest-level entry point into the runtime. Don't call this directly,
39+
* instead call [com.squareup.workflow.launchWorkflowIn].
4040
*/
4141
@Suppress("LongParameterList")
4242
suspend fun <PropsT, StateT, OutputT : Any, RenderingT> runWorkflowLoop(
@@ -76,7 +76,7 @@ internal open class RealWorkflowLoop : WorkflowLoop {
7676
id = workflow.id(),
7777
workflow = workflow,
7878
initialProps = input,
79-
snapshot = initialSnapshot?.bytes,
79+
snapshot = initialSnapshot?.bytes?.takeUnless { it.size == 0 },
8080
baseContext = coroutineContext,
8181
parentDiagnosticId = null,
8282
diagnosticListener = diagnosticListener,

kotlin/workflow-testing/src/test/java/com/squareup/workflow/SnapshottingIntegrationTest.kt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,18 @@ class SnapshottingIntegrationTest {
4949
}
5050
}
5151

52+
@Test fun `empty snapshot is ignored`() {
53+
val root = TreeWorkflow("root")
54+
val snapshot = Snapshot.EMPTY
55+
56+
root.testFromStart(
57+
props = "initial props",
58+
testParams = WorkflowTestParams(startFrom = StartFromCompleteSnapshot(snapshot))
59+
) {
60+
// Success!
61+
}
62+
}
63+
5264
@Test fun `snapshots and restores parent child workflows`() {
5365
val root = TreeWorkflow("root", TreeWorkflow("leaf"))
5466
var snapshot: Snapshot? = null

0 commit comments

Comments
 (0)