Skip to content

Commit

Permalink
15181 Further simplify payment task cancellation
Browse files Browse the repository at this point in the history
  • Loading branch information
joshheald committed Feb 20, 2025
1 parent 16c35cb commit 0acbbbc
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -165,14 +165,12 @@ final class CardPresentPaymentService: CardPresentPaymentFacade {
}

func cancelPayment() {
paymentTask?.cancel()
paymentTask = nil
cancelPaymentTask()
}

@MainActor
func cancelPayment() async throws {
paymentTask?.cancel()
paymentTask = nil
cancelPaymentTask()

try await withCheckedThrowingContinuation { continuation in
var nillableContinuation: CheckedContinuation<Void, any Error>? = continuation
Expand All @@ -183,6 +181,11 @@ final class CardPresentPaymentService: CardPresentPaymentFacade {
stores.dispatch(action)
}
}

private func cancelPaymentTask() {
paymentTask?.cancel()
paymentTask = nil
}
}

private extension CardPresentPaymentService {
Expand Down

0 comments on commit 0acbbbc

Please sign in to comment.