2
This commit is contained in:
@@ -56,7 +56,7 @@ final class KBStoreKitBridge: NSObject, StoreKitDelegate {
|
|||||||
self.verifySignedPayload(payload, completion: completion)
|
self.verifySignedPayload(payload, completion: completion)
|
||||||
} else {
|
} else {
|
||||||
await MainActor.run {
|
await MainActor.run {
|
||||||
completion(false, "Unable to obtain transaction payload.")
|
completion(false, self.failureMessage(for: productId))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch {
|
} catch {
|
||||||
@@ -119,4 +119,18 @@ final class KBStoreKitBridge: NSObject, StoreKitDelegate {
|
|||||||
private func fetchPayload(for productId: String) async -> String? {
|
private func fetchPayload(for productId: String) async -> String? {
|
||||||
return manager.consumeRecentPayload(for: productId)
|
return manager.consumeRecentPayload(for: productId)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@MainActor
|
||||||
|
private func failureMessage(for productId: String) -> String {
|
||||||
|
switch manager.currentState {
|
||||||
|
case .purchaseCancelled(let id) where id == productId:
|
||||||
|
return "Purchase cancelled."
|
||||||
|
case .purchasePending(let id) where id == productId:
|
||||||
|
return "Purchase pending approval."
|
||||||
|
case .purchaseFailed(let id, let error) where id == productId:
|
||||||
|
return error.localizedDescription
|
||||||
|
default:
|
||||||
|
return "Unable to obtain transaction payload."
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user