diff --git a/.travis.yml b/.travis.yml index eaeacba4..703ba2d6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,5 @@ language: objective-c -osx_image: xcode10 +osx_image: xcode10.2 before_install: - gem install xcpretty diff --git a/SwiftyStoreKit.xcodeproj/project.pbxproj b/SwiftyStoreKit.xcodeproj/project.pbxproj index 9b2725e3..276344f1 100644 --- a/SwiftyStoreKit.xcodeproj/project.pbxproj +++ b/SwiftyStoreKit.xcodeproj/project.pbxproj @@ -560,7 +560,7 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0820; - LastUpgradeCheck = 1000; + LastUpgradeCheck = 1020; ORGANIZATIONNAME = musevisions; TargetAttributes = { 54C0D52B1CF7404500F90BCE = { @@ -574,7 +574,7 @@ }; 6502F62C1B985C40004E342D = { CreatedOnToolsVersion = 7.0; - LastSwiftMigration = 0800; + LastSwiftMigration = 1020; }; 654287ED1E79F5A000F61800 = { CreatedOnToolsVersion = 8.2.1; @@ -597,7 +597,7 @@ }; buildConfigurationList = 6502F5F91B985833004E342D /* Build configuration list for PBXProject "SwiftyStoreKit" */; compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; + developmentRegion = en; hasScannedForEncodings = 0; knownRegions = ( en, @@ -941,6 +941,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; @@ -989,7 +990,7 @@ ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 4.2; + SWIFT_VERSION = 5.0; }; name = Debug; }; @@ -997,6 +998,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; @@ -1037,7 +1039,7 @@ MACOSX_DEPLOYMENT_TARGET = 10.10; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; - SWIFT_VERSION = 4.2; + SWIFT_VERSION = 5.0; VALIDATE_PRODUCT = YES; }; name = Release; @@ -1093,6 +1095,7 @@ PRODUCT_BUNDLE_IDENTIFIER = com.musevisions.iOS.SwiftyStoreKit; PRODUCT_NAME = SwiftyStoreKit; SKIP_INSTALL = YES; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; @@ -1118,6 +1121,7 @@ PRODUCT_NAME = SwiftyStoreKit; SKIP_INSTALL = YES; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; diff --git a/SwiftyStoreKit.xcodeproj/xcshareddata/xcschemes/SwiftyStoreKit-iOS-Demo.xcscheme b/SwiftyStoreKit.xcodeproj/xcshareddata/xcschemes/SwiftyStoreKit-iOS-Demo.xcscheme index 98a03860..f6475fd5 100644 --- a/SwiftyStoreKit.xcodeproj/xcshareddata/xcschemes/SwiftyStoreKit-iOS-Demo.xcscheme +++ b/SwiftyStoreKit.xcodeproj/xcshareddata/xcschemes/SwiftyStoreKit-iOS-Demo.xcscheme @@ -1,6 +1,6 @@ Void - typealias ReceiptRefresh = (_ receiptProperties: [String : Any]?, _ callback: @escaping RequestCallback) -> InAppReceiptRefreshRequest + typealias ReceiptRefresh = (_ receiptProperties: [String: Any]?, _ callback: @escaping RequestCallback) -> InAppReceiptRefreshRequest - class func refresh(_ receiptProperties: [String : Any]? = nil, callback: @escaping RequestCallback) -> InAppReceiptRefreshRequest { + class func refresh(_ receiptProperties: [String: Any]? = nil, callback: @escaping RequestCallback) -> InAppReceiptRefreshRequest { let request = InAppReceiptRefreshRequest(receiptProperties: receiptProperties, callback: callback) request.start() return request @@ -49,7 +49,7 @@ class InAppReceiptRefreshRequest: NSObject, SKRequestDelegate { refreshReceiptRequest.delegate = nil } - init(receiptProperties: [String : Any]? = nil, callback: @escaping RequestCallback) { + init(receiptProperties: [String: Any]? = nil, callback: @escaping RequestCallback) { self.callback = callback self.refreshReceiptRequest = SKReceiptRefreshRequest(receiptProperties: receiptProperties) super.init() diff --git a/SwiftyStoreKit/PaymentQueueController.swift b/SwiftyStoreKit/PaymentQueueController.swift index 834e18e8..a23d0d15 100644 --- a/SwiftyStoreKit/PaymentQueueController.swift +++ b/SwiftyStoreKit/PaymentQueueController.swift @@ -78,6 +78,7 @@ extension SKPaymentTransactionState: CustomDebugStringConvertible { case .failed: return "failed" case .restored: return "restored" case .deferred: return "deferred" + @unknown default: return "default" } } } diff --git a/SwiftyStoreKit/PaymentsController.swift b/SwiftyStoreKit/PaymentsController.swift index 1fad4eed..36e65591 100644 --- a/SwiftyStoreKit/PaymentsController.swift +++ b/SwiftyStoreKit/PaymentsController.swift @@ -33,9 +33,14 @@ struct Payment: Hashable { let simulatesAskToBuyInSandbox: Bool let callback: (TransactionResult) -> Void - var hashValue: Int { - return product.productIdentifier.hashValue + func hash(into hasher: inout Hasher) { + hasher.combine(product) + hasher.combine(quantity) + hasher.combine(atomically) + hasher.combine(applicationUsername) + hasher.combine(simulatesAskToBuyInSandbox) } + static func == (lhs: Payment, rhs: Payment) -> Bool { return lhs.product.productIdentifier == rhs.product.productIdentifier } @@ -47,7 +52,7 @@ class PaymentsController: TransactionController { private func findPaymentIndex(withProductIdentifier identifier: String) -> Int? { for payment in payments where payment.product.productIdentifier == identifier { - return payments.index(of: payment) + return payments.firstIndex(of: payment) } return nil } diff --git a/SwiftyStoreKit/SKProduct+LocalizedPrice.swift b/SwiftyStoreKit/SKProduct+LocalizedPrice.swift index f6ebb498..2ba1818e 100644 --- a/SwiftyStoreKit/SKProduct+LocalizedPrice.swift +++ b/SwiftyStoreKit/SKProduct+LocalizedPrice.swift @@ -27,7 +27,7 @@ import StoreKit public extension SKProduct { - public var localizedPrice: String? { + var localizedPrice: String? { return priceFormatter(locale: priceLocale).string(from: price) } diff --git a/SwiftyStoreKit/SwiftyStoreKit+Types.swift b/SwiftyStoreKit/SwiftyStoreKit+Types.swift index fdb70029..fb3e387f 100644 --- a/SwiftyStoreKit/SwiftyStoreKit+Types.swift +++ b/SwiftyStoreKit/SwiftyStoreKit+Types.swift @@ -59,7 +59,7 @@ public protocol PaymentTransaction { } // Add PaymentTransaction conformance to SKPaymentTransaction -extension SKPaymentTransaction : PaymentTransaction { } +extension SKPaymentTransaction: PaymentTransaction { } // Products information public struct RetrieveResults {