Skip to content

Commit

Permalink
Hotfix for presenting cancelled payment in a nicer way
Browse files Browse the repository at this point in the history
  • Loading branch information
buggmagnet authored and pinkisemils committed Jul 17, 2023
1 parent 16af77d commit b758f57
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion ios/MullvadVPN/Extensions/SKError+Localized.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ extension SKError: LocalizedError {
return NSLocalizedString(
"PAYMENT_CANCELLED",
tableName: "StoreKitErrors",
value: "User cancelled the request.",
value: "The payment request was cancelled.",
comment: ""
)
case .paymentInvalid:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,11 @@ extension StorePaymentManagerError: DisplayError {
return errorString

case let .storePayment(storeError):
return (storeError as? SKError)?.errorDescription ?? storeError.localizedDescription
guard let error = storeError as? SKError else { return storeError.localizedDescription }
if error.code.rawValue == 0, error.underlyingErrorChain.map({ $0 as NSError }).first?.code == 825 {
return SKError(.paymentCancelled).errorDescription
}
return SKError(error.code).errorDescription
}
}
}

0 comments on commit b758f57

Please sign in to comment.