diff --git a/Passepartout-iOS/Global/ProductManager.swift b/Passepartout-iOS/Global/ProductManager.swift index 32039f2c..832d60db 100644 --- a/Passepartout-iOS/Global/ProductManager.swift +++ b/Passepartout-iOS/Global/ProductManager.swift @@ -66,12 +66,14 @@ class ProductManager: NSObject { SKPaymentQueue.default().remove(self) } - func listProducts(completionHandler: (([SKProduct]) -> Void)?) { - inApp.requestProducts(withIdentifiers: Product.all) { _ in + func listProducts(completionHandler: (([SKProduct]?, Error?) -> Void)?) { + inApp.requestProducts(withIdentifiers: Product.all, completionHandler: { _ in log.debug("In-app products: \(self.inApp.products.map { $0.productIdentifier })") - completionHandler?(self.inApp.products) - } + completionHandler?(self.inApp.products, nil) + }, failureHandler: { + completionHandler?(nil, $0) + }) } func product(withIdentifier identifier: Product) -> SKProduct? { diff --git a/Passepartout-iOS/Scenes/Organizer/DonationViewController.swift b/Passepartout-iOS/Scenes/Organizer/DonationViewController.swift index 0cdb8359..417b1057 100644 --- a/Passepartout-iOS/Scenes/Organizer/DonationViewController.swift +++ b/Passepartout-iOS/Scenes/Organizer/DonationViewController.swift @@ -27,6 +27,9 @@ import UIKit import StoreKit import PassepartoutCore import Convenience +import SwiftyBeaver + +private let log = SwiftyBeaver.self class DonationViewController: UITableViewController, StrongTableHost { private var donationList: [Product] = [] @@ -81,7 +84,11 @@ class DonationViewController: UITableViewController, StrongTableHost { ProductManager.shared.listProducts { self.isLoading = false - self.setProducts($0) + guard let products = $0 else { + log.error("Unable to list products: \($1?.localizedDescription ?? "")") + return + } + self.setProducts(products) } } diff --git a/Passepartout-iOS/Scenes/Organizer/WizardProviderViewController.swift b/Passepartout-iOS/Scenes/Organizer/WizardProviderViewController.swift index 886d9451..bf7b85c0 100644 --- a/Passepartout-iOS/Scenes/Organizer/WizardProviderViewController.swift +++ b/Passepartout-iOS/Scenes/Organizer/WizardProviderViewController.swift @@ -94,10 +94,14 @@ class WizardProviderViewController: UITableViewController, StrongTableHost { return } - ProductManager.shared.listProducts { _ in + ProductManager.shared.listProducts { (products, error) in + hud.hide() + if let error = error { + log.error("Unable to list products: \(error)") + return + } self?.reloadModel() self?.tableView.reloadData() - hud.hide() } } } diff --git a/Passepartout-iOS/Scenes/Purchase/PurchaseViewController.swift b/Passepartout-iOS/Scenes/Purchase/PurchaseViewController.swift index 43ce7e22..5903ae22 100644 --- a/Passepartout-iOS/Scenes/Purchase/PurchaseViewController.swift +++ b/Passepartout-iOS/Scenes/Purchase/PurchaseViewController.swift @@ -90,7 +90,7 @@ class PurchaseViewController: UITableViewController, StrongTableHost { super.viewDidAppear(animated) let hud = HUD(view: view) - ProductManager.shared.listProducts { [weak self] _ in + ProductManager.shared.listProducts { [weak self] (_, _) in self?.reloadModel() self?.isLoading = false self?.tableView.reloadData() diff --git a/Podfile b/Podfile index dc6dfaf8..9cd1c968 100644 --- a/Podfile +++ b/Podfile @@ -14,7 +14,7 @@ def shared_pods pod 'SSZipArchive' for spec in ['About', 'Alerts', 'Dialogs', 'InApp', 'Misc', 'Options', 'Persistence', 'Reviewer', 'Tables', 'WebServices'] do - pod "Convenience/#{spec}", :git => 'https://github.com/keeshux/convenience', :commit => '7fe7dcf' + pod "Convenience/#{spec}", :git => 'https://github.com/keeshux/convenience', :commit => '3a191e8' #pod "Convenience/#{spec}", :path => '../../personal/convenience' end end diff --git a/Podfile.lock b/Podfile.lock index a7778eea..34a6afb9 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -36,16 +36,16 @@ PODS: - TunnelKit/Core DEPENDENCIES: - - Convenience/About (from `https://github.com/keeshux/convenience`, commit `7fe7dcf`) - - Convenience/Alerts (from `https://github.com/keeshux/convenience`, commit `7fe7dcf`) - - Convenience/Dialogs (from `https://github.com/keeshux/convenience`, commit `7fe7dcf`) - - Convenience/InApp (from `https://github.com/keeshux/convenience`, commit `7fe7dcf`) - - Convenience/Misc (from `https://github.com/keeshux/convenience`, commit `7fe7dcf`) - - Convenience/Options (from `https://github.com/keeshux/convenience`, commit `7fe7dcf`) - - Convenience/Persistence (from `https://github.com/keeshux/convenience`, commit `7fe7dcf`) - - Convenience/Reviewer (from `https://github.com/keeshux/convenience`, commit `7fe7dcf`) - - Convenience/Tables (from `https://github.com/keeshux/convenience`, commit `7fe7dcf`) - - Convenience/WebServices (from `https://github.com/keeshux/convenience`, commit `7fe7dcf`) + - Convenience/About (from `https://github.com/keeshux/convenience`, commit `3a191e8`) + - Convenience/Alerts (from `https://github.com/keeshux/convenience`, commit `3a191e8`) + - Convenience/Dialogs (from `https://github.com/keeshux/convenience`, commit `3a191e8`) + - Convenience/InApp (from `https://github.com/keeshux/convenience`, commit `3a191e8`) + - Convenience/Misc (from `https://github.com/keeshux/convenience`, commit `3a191e8`) + - Convenience/Options (from `https://github.com/keeshux/convenience`, commit `3a191e8`) + - Convenience/Persistence (from `https://github.com/keeshux/convenience`, commit `3a191e8`) + - Convenience/Reviewer (from `https://github.com/keeshux/convenience`, commit `3a191e8`) + - Convenience/Tables (from `https://github.com/keeshux/convenience`, commit `3a191e8`) + - Convenience/WebServices (from `https://github.com/keeshux/convenience`, commit `3a191e8`) - Kvitto - MBProgressHUD - SSZipArchive @@ -63,7 +63,7 @@ SPEC REPOS: EXTERNAL SOURCES: Convenience: - :commit: 7fe7dcf + :commit: 3a191e8 :git: https://github.com/keeshux/convenience TunnelKit: :commit: 8b17a13 @@ -71,7 +71,7 @@ EXTERNAL SOURCES: CHECKOUT OPTIONS: Convenience: - :commit: 7fe7dcf + :commit: 3a191e8 :git: https://github.com/keeshux/convenience TunnelKit: :commit: 8b17a13 @@ -87,6 +87,6 @@ SPEC CHECKSUMS: SwiftyBeaver: 3d3e93a12d648bd400b6f2948a7ef128b5b183c7 TunnelKit: 4b70c0d8b6727b407248b4271b7613225f63204b -PODFILE CHECKSUM: 10c7cb879b6ee3d5185f541e6a2c6d14e988ff0b +PODFILE CHECKSUM: 5b0c1f2c23e4a3ffa33152e231291a97351d7165 COCOAPODS: 1.8.4