|
@@ -47,7 +47,12 @@ public protocol PaymentQueue: class {
|
|
func remove(_ observer: SKPaymentTransactionObserver)
|
|
func remove(_ observer: SKPaymentTransactionObserver)
|
|
|
|
|
|
func add(_ payment: SKPayment)
|
|
func add(_ payment: SKPayment)
|
|
-
|
|
|
|
|
|
+
|
|
|
|
+ func start(_ downloads: [SKDownload])
|
|
|
|
+ func pause(_ downloads: [SKDownload])
|
|
|
|
+ func resume(_ downloads: [SKDownload])
|
|
|
|
+ func cancel(_ downloads: [SKDownload])
|
|
|
|
+
|
|
func restoreCompletedTransactions(withApplicationUsername username: String?)
|
|
func restoreCompletedTransactions(withApplicationUsername username: String?)
|
|
|
|
|
|
func finishTransaction(_ transaction: SKPaymentTransaction)
|
|
func finishTransaction(_ transaction: SKPaymentTransaction)
|
|
@@ -151,7 +156,21 @@ class PaymentQueueController: NSObject, SKPaymentTransactionObserver {
|
|
paymentQueue.finishTransaction(skTransaction)
|
|
paymentQueue.finishTransaction(skTransaction)
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ func start(_ downloads: [SKDownload]) {
|
|
|
|
+ paymentQueue.start(downloads)
|
|
|
|
+ }
|
|
|
|
+ func pause(_ downloads: [SKDownload]) {
|
|
|
|
+ paymentQueue.pause(downloads)
|
|
|
|
+ }
|
|
|
|
+ func resume(_ downloads: [SKDownload]) {
|
|
|
|
+ paymentQueue.resume(downloads)
|
|
|
|
+ }
|
|
|
|
+ func cancel(_ downloads: [SKDownload]) {
|
|
|
|
+ paymentQueue.cancel(downloads)
|
|
|
|
+ }
|
|
|
|
+
|
|
var shouldAddStorePaymentHandler: ShouldAddStorePaymentHandler?
|
|
var shouldAddStorePaymentHandler: ShouldAddStorePaymentHandler?
|
|
|
|
+ var updatedDownloadsHandler: UpdatedDownloadsHandler?
|
|
|
|
|
|
// MARK: SKPaymentTransactionObserver
|
|
// MARK: SKPaymentTransactionObserver
|
|
func paymentQueue(_ queue: SKPaymentQueue, updatedTransactions transactions: [SKPaymentTransaction]) {
|
|
func paymentQueue(_ queue: SKPaymentQueue, updatedTransactions transactions: [SKPaymentTransaction]) {
|
|
@@ -210,6 +229,7 @@ class PaymentQueueController: NSObject, SKPaymentTransactionObserver {
|
|
|
|
|
|
func paymentQueue(_ queue: SKPaymentQueue, updatedDownloads downloads: [SKDownload]) {
|
|
func paymentQueue(_ queue: SKPaymentQueue, updatedDownloads downloads: [SKDownload]) {
|
|
|
|
|
|
|
|
+ updatedDownloadsHandler?(downloads)
|
|
}
|
|
}
|
|
|
|
|
|
func paymentQueue(_ queue: SKPaymentQueue, shouldAddStorePayment payment: SKPayment, for product: SKProduct) -> Bool {
|
|
func paymentQueue(_ queue: SKPaymentQueue, shouldAddStorePayment payment: SKPayment, for product: SKProduct) -> Bool {
|