From 9637d5822a2c709ed0b3667c99f8b4e9d82de23b Mon Sep 17 00:00:00 2001 From: Nikola Milicevic <12729242+nikola-milicevic@users.noreply.github.com> Date: Tue, 14 Feb 2023 17:29:58 +0100 Subject: [PATCH] Fix/ABW-957 Biometrics check cancelled causes blank screen (#295) Co-authored-by: David Roman <116723827+davdroman-rdx@users.noreply.github.com> --- .../Children/CreationOfEntity/CreationOfEntity+Action.swift | 1 + .../Children/CreationOfEntity/CreationOfEntity+Reducer.swift | 5 ++--- .../Coordinator/CreateEntityCoordinator+Reducer.swift | 4 ++++ .../CreateEntityFeatureTests/CreationOfEntityTests.swift | 4 +--- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/Sources/Features/CreateEntityFeature/Children/CreationOfEntity/CreationOfEntity+Action.swift b/Sources/Features/CreateEntityFeature/Children/CreationOfEntity/CreationOfEntity+Action.swift index c7f15c7212..a65a0e013a 100644 --- a/Sources/Features/CreateEntityFeature/Children/CreationOfEntity/CreationOfEntity+Action.swift +++ b/Sources/Features/CreateEntityFeature/Children/CreationOfEntity/CreationOfEntity+Action.swift @@ -38,5 +38,6 @@ extension CreationOfEntity.Action { extension CreationOfEntity.Action { public enum DelegateAction: Sendable, Equatable { case createdEntity(Entity) + case createEntityFailed } } diff --git a/Sources/Features/CreateEntityFeature/Children/CreationOfEntity/CreationOfEntity+Reducer.swift b/Sources/Features/CreateEntityFeature/Children/CreationOfEntity/CreationOfEntity+Reducer.swift index 5b0cca9332..820b8c286f 100644 --- a/Sources/Features/CreateEntityFeature/Children/CreationOfEntity/CreationOfEntity+Reducer.swift +++ b/Sources/Features/CreateEntityFeature/Children/CreationOfEntity/CreationOfEntity+Reducer.swift @@ -42,9 +42,8 @@ public struct CreationOfEntity: Sendable, ReducerProtoco )))) } - case let .internal(.system(.createEntityResult(.failure(error)))): - errorQueue.schedule(error) - return .none + case .internal(.system(.createEntityResult(.failure))): + return .send(.delegate(.createEntityFailed)) case let .internal(.system(.createEntityResult(.success(entity)))): return .run { send in diff --git a/Sources/Features/CreateEntityFeature/Coordinator/CreateEntityCoordinator+Reducer.swift b/Sources/Features/CreateEntityFeature/Coordinator/CreateEntityCoordinator+Reducer.swift index 263bf5675f..9664b2e3a2 100644 --- a/Sources/Features/CreateEntityFeature/Coordinator/CreateEntityCoordinator+Reducer.swift +++ b/Sources/Features/CreateEntityFeature/Coordinator/CreateEntityCoordinator+Reducer.swift @@ -90,6 +90,10 @@ public struct CreateEntityCoordinator< state: &state ) + case .child(.step2_creationOfEntity(.delegate(.createEntityFailed))): + state.step = .step0_nameNewEntity(.init(config: state.config)) + return .none + case .child(.step3_completion(.delegate(.completed))): return .run { send in await send(.delegate(.completed)) diff --git a/Tests/Features/CreateEntityFeatureTests/CreationOfEntityTests.swift b/Tests/Features/CreateEntityFeatureTests/CreationOfEntityTests.swift index 41d8d15fa8..a2449d37b8 100644 --- a/Tests/Features/CreateEntityFeatureTests/CreationOfEntityTests.swift +++ b/Tests/Features/CreateEntityFeatureTests/CreationOfEntityTests.swift @@ -57,8 +57,6 @@ final class CreationOfEntityTests: TestCase { let expectedErrors = Set([createNewAccountError]) await store.send(.view(.appeared)) await store.receive(.internal(.system(.createEntityResult(.failure(createNewAccountError))))) - await errorQueue.withValue { errors in - XCTAssertEqual(errors, expectedErrors) - } + await store.receive(.delegate(.createEntityFailed)) } }