Skip to content

Commit f3f5e3b

Browse files
buggmagnetpinkisemils
authored andcommitted
Hotfix for presenting cancelled payment in a nicer way
1 parent 16af77d commit f3f5e3b

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

ios/MullvadVPN/Extensions/SKError+Localized.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ extension SKError: LocalizedError {
2929
return NSLocalizedString(
3030
"PAYMENT_CANCELLED",
3131
tableName: "StoreKitErrors",
32-
value: "User cancelled the request.",
32+
value: "The payment request was cancelled.",
3333
comment: ""
3434
)
3535
case .paymentInvalid:

ios/MullvadVPN/Extensions/StorePaymentManagerError+Display.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,11 @@ extension StorePaymentManagerError: DisplayError {
8080
return errorString
8181

8282
case let .storePayment(storeError):
83-
return (storeError as? SKError)?.errorDescription ?? storeError.localizedDescription
83+
guard let error = storeError as? SKError else { return storeError.localizedDescription }
84+
if error.code.rawValue == 0, error.underlyingErrorChain.map({ $0 as NSError }).first?.code == 825 {
85+
return SKError(.paymentCancelled).errorDescription
86+
}
87+
return SKError(error.code).errorDescription
8488
}
8589
}
8690
}

0 commit comments

Comments
 (0)