Skip to content

Commit

Permalink
Handle Success screen dismissal by swipe down (#1244)
Browse files Browse the repository at this point in the history
  • Loading branch information
GhenadieVP committed Jul 26, 2024
1 parent 4ce9251 commit fde2eb1
Showing 1 changed file with 15 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -248,8 +248,7 @@ struct DappInteractor: Sendable, FeatureReducer {
}

case .dappInteractionCompletion(.delegate(.dismiss)):
state.destination = nil
return delayedMediumEffect(internal: .presentQueuedRequestIfNeeded)
return onCompletionScreenDismissed(&state)

case let .responseFailure(action):
switch action {
Expand Down Expand Up @@ -278,6 +277,15 @@ struct DappInteractor: Sendable, FeatureReducer {
}
}

func reduceDismissedDestination(into state: inout State) -> Effect<Action> {
switch state.destination {
case .dappInteractionCompletion:
onCompletionScreenDismissed(&state)
default:
.none
}
}

func presentQueuedRequestIfNeededEffect(
for state: inout State
) -> Effect<Action> {
Expand Down Expand Up @@ -347,6 +355,11 @@ struct DappInteractor: Sendable, FeatureReducer {
state.requestQueue.remove(id: request.id)
state.destination = nil
}

func onCompletionScreenDismissed(_ state: inout State) -> Effect<Action> {
state.destination = nil
return delayedMediumEffect(internal: .presentQueuedRequestIfNeeded)
}
}

extension DappInteractionClient.ValidatedDappRequest.InvalidRequestReason {
Expand Down

0 comments on commit fde2eb1

Please sign in to comment.