Skip to content

Commit

Permalink
5017: Updated cancel action
Browse files Browse the repository at this point in the history
  • Loading branch information
Rool committed Nov 4, 2022
1 parent 552b4dd commit 49b9739
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ final class SendIdentitySelectionViewModelTests: XCTestCase {
expect(self.coordinatorDelegateSpy.invokedPresentErrorParameters?.content.body).toEventually(equal( L.holderErrorstateClientMessage("i 1310 000 101")))
}

func test_viewDidAppear_lessThanTwoMatchingBlobs() {
func test_viewDidAppear_emptyMatchingBlobs() {

// Given
setupSut(matchingBlobIds: [["123"]], selectedBlobIds: ["123"])
setupSut(matchingBlobIds: [], selectedBlobIds: ["123"])

// When
sut.viewDidAppear()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,15 +122,20 @@ extension FuzzyMatchingCoordinator: FuzzyMatchingCoordinatorDelegate {

func userWishesToSeeIdentitiyGroups() {

let viewModel = ListIdentitySelectionViewModel(
coordinatorDelegate: self,
dataSource: dataSource,
matchingBlobIds: matchingBlobIds,
shouldHideSkipButton: shouldHideSkipButton
)
let viewController = ListIdentitySelectionViewController(viewModel: viewModel)

navigationController.pushViewController(viewController, animated: true)
if let existingListVC = navigationController.viewControllers.first(where: { $0 is ListIdentitySelectionViewController }) {
navigationController.popToViewController(existingListVC, animated: true)
} else {

let viewModel = ListIdentitySelectionViewModel(
coordinatorDelegate: self,
dataSource: dataSource,
matchingBlobIds: matchingBlobIds,
shouldHideSkipButton: shouldHideSkipButton
)
let viewController = ListIdentitySelectionViewController(viewModel: viewModel)

navigationController.pushViewController(viewController, animated: true)
}
}

func userHasSelectedIdentityGroup(selectedBlobIds: [String]) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class SendIdentitySelectionViewModel {

func viewDidAppear() {

guard matchingBlobIds.count > 1, selectedBlobIds.isNotEmpty else {
guard matchingBlobIds.isNotEmpty, selectedBlobIds.isNotEmpty else {
displayErrorCode(ErrorCode(flow: .fuzzyMatching, step: .removeEventGroups, clientCode: .noSelectionMade))
return
}
Expand Down Expand Up @@ -107,12 +107,12 @@ class SendIdentitySelectionViewModel {

Current.greenCardLoader.signTheEventsIntoGreenCardsAndCredentials(eventMode: nil) { [weak self] result in
// Result<RemoteGreenCards.Response, Error>

guard let self else { return }
switch result {
case .success:
self.coordinatorDelegate?.userWishesToSeeSuccess(name: self.selectedIdentity ?? "")

case let .failure(greenCardError):
let parser = GreenCardResponseErrorParser(flow: ErrorCode.Flow.fuzzyMatching)
switch parser.parse(greenCardError) {
Expand Down Expand Up @@ -142,7 +142,10 @@ class SendIdentitySelectionViewModel {
isPreferred: true
),
cancelAction: AlertContent.Action(
title: L.generalClose()
title: L.generalClose(),
action: { [weak self] _ in
self?.coordinatorDelegate?.userWishesToSeeIdentitiyGroups()
}
)
)
}
Expand Down

0 comments on commit 49b9739

Please sign in to comment.