diff --git a/SwiftyStoreKit.xcodeproj/project.pbxproj b/SwiftyStoreKit.xcodeproj/project.pbxproj index aa36d33d..b85573d1 100644 --- a/SwiftyStoreKit.xcodeproj/project.pbxproj +++ b/SwiftyStoreKit.xcodeproj/project.pbxproj @@ -7,6 +7,14 @@ objects = { /* Begin PBXBuildFile section */ + 54B069911CF742CE00BAFE38 /* InAppCompleteTransactionsObserver.swift in Sources */ = {isa = PBXBuildFile; fileRef = 651A71241CD651AF000B4091 /* InAppCompleteTransactionsObserver.swift */; }; + 54B069921CF742D100BAFE38 /* InAppReceipt.swift in Sources */ = {isa = PBXBuildFile; fileRef = C4A7C7621C29B8D00053ED64 /* InAppReceipt.swift */; }; + 54B069931CF742D300BAFE38 /* InAppReceiptRefreshRequest.swift in Sources */ = {isa = PBXBuildFile; fileRef = C4083C561C2AB0A900295248 /* InAppReceiptRefreshRequest.swift */; }; + 54B069941CF742D600BAFE38 /* InAppProductQueryRequest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6502F6231B98586A004E342D /* InAppProductQueryRequest.swift */; }; + 54B069951CF742D900BAFE38 /* InAppProductPurchaseRequest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6502F6221B98586A004E342D /* InAppProductPurchaseRequest.swift */; }; + 54B069961CF744DC00BAFE38 /* OS.swift in Sources */ = {isa = PBXBuildFile; fileRef = C40C680F1C29414C00B60B7E /* OS.swift */; }; + 54C0D52F1CF7404500F90BCE /* SwiftyStoreKitTV.h in Headers */ = {isa = PBXBuildFile; fileRef = 54C0D52E1CF7404500F90BCE /* SwiftyStoreKitTV.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 54C0D5681CF7428400F90BCE /* SwiftyStoreKit.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6502F6241B98586A004E342D /* SwiftyStoreKit.swift */; }; 6502F61C1B985858004E342D /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6502F6141B985858004E342D /* AppDelegate.swift */; }; 6502F61D1B985858004E342D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 6502F6151B985858004E342D /* Assets.xcassets */; }; 6502F61E1B985858004E342D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 6502F6161B985858004E342D /* LaunchScreen.storyboard */; }; @@ -82,6 +90,9 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ + 54C0D52C1CF7404500F90BCE /* SwiftyStoreKitTV.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SwiftyStoreKitTV.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 54C0D52E1CF7404500F90BCE /* SwiftyStoreKitTV.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SwiftyStoreKitTV.h; sourceTree = ""; }; + 54C0D5301CF7404500F90BCE /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 6502F5FE1B985833004E342D /* SwiftyStoreDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SwiftyStoreDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; 6502F6141B985858004E342D /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 6502F6151B985858004E342D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; @@ -112,6 +123,13 @@ /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ + 54C0D5281CF7404500F90BCE /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; 6502F5FB1B985833004E342D /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; @@ -145,6 +163,15 @@ /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + 54C0D52D1CF7404500F90BCE /* SwiftyStoreKitTV */ = { + isa = PBXGroup; + children = ( + 54C0D52E1CF7404500F90BCE /* SwiftyStoreKitTV.h */, + 54C0D5301CF7404500F90BCE /* Info.plist */, + ); + path = SwiftyStoreKitTV; + sourceTree = ""; + }; 6502F5F51B985833004E342D = { isa = PBXGroup; children = ( @@ -152,6 +179,7 @@ 6502F6131B985858004E342D /* SwiftyStoreDemo */, C4D74BBC1C24CECA0071AD3E /* SwiftyStoreKitOSX */, C4FD3A021C2954C10035CFF3 /* SwiftyStoreOSXDemo */, + 54C0D52D1CF7404500F90BCE /* SwiftyStoreKitTV */, 6502F5FF1B985833004E342D /* Products */, ); sourceTree = ""; @@ -163,6 +191,7 @@ 6502F62D1B985C40004E342D /* SwiftyStoreKit.framework */, C4D74BBB1C24CEC90071AD3E /* SwiftyStoreKit.framework */, C4FD3A011C2954C10035CFF3 /* SwiftyStoreOSXDemo.app */, + 54C0D52C1CF7404500F90BCE /* SwiftyStoreKitTV.framework */, ); name = Products; sourceTree = ""; @@ -221,6 +250,14 @@ /* End PBXGroup section */ /* Begin PBXHeadersBuildPhase section */ + 54C0D5291CF7404500F90BCE /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + 54C0D52F1CF7404500F90BCE /* SwiftyStoreKitTV.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; 6502F62A1B985C40004E342D /* Headers */ = { isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; @@ -240,6 +277,24 @@ /* End PBXHeadersBuildPhase section */ /* Begin PBXNativeTarget section */ + 54C0D52B1CF7404500F90BCE /* SwiftyStoreKitTV */ = { + isa = PBXNativeTarget; + buildConfigurationList = 54C0D5331CF7404500F90BCE /* Build configuration list for PBXNativeTarget "SwiftyStoreKitTV" */; + buildPhases = ( + 54C0D5271CF7404500F90BCE /* Sources */, + 54C0D5281CF7404500F90BCE /* Frameworks */, + 54C0D5291CF7404500F90BCE /* Headers */, + 54C0D52A1CF7404500F90BCE /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = SwiftyStoreKitTV; + productName = SwiftyStoreKitTV; + productReference = 54C0D52C1CF7404500F90BCE /* SwiftyStoreKitTV.framework */; + productType = "com.apple.product-type.framework"; + }; 6502F5FD1B985833004E342D /* SwiftyStoreDemo */ = { isa = PBXNativeTarget; buildConfigurationList = 6502F6101B985833004E342D /* Build configuration list for PBXNativeTarget "SwiftyStoreDemo" */; @@ -324,6 +379,9 @@ LastUpgradeCheck = 0700; ORGANIZATIONNAME = musevisions; TargetAttributes = { + 54C0D52B1CF7404500F90BCE = { + CreatedOnToolsVersion = 7.3.1; + }; 6502F5FD1B985833004E342D = { CreatedOnToolsVersion = 7.0; }; @@ -355,11 +413,19 @@ 6502F62C1B985C40004E342D /* SwiftyStoreKit */, C4FD3A001C2954C10035CFF3 /* SwiftyStoreOSXDemo */, C4D74BBA1C24CEC90071AD3E /* SwiftyStoreKitOSX */, + 54C0D52B1CF7404500F90BCE /* SwiftyStoreKitTV */, ); }; /* End PBXProject section */ /* Begin PBXResourcesBuildPhase section */ + 54C0D52A1CF7404500F90BCE /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; 6502F5FC1B985833004E342D /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; @@ -396,6 +462,20 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ + 54C0D5271CF7404500F90BCE /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 54B069911CF742CE00BAFE38 /* InAppCompleteTransactionsObserver.swift in Sources */, + 54B069951CF742D900BAFE38 /* InAppProductPurchaseRequest.swift in Sources */, + 54C0D5681CF7428400F90BCE /* SwiftyStoreKit.swift in Sources */, + 54B069961CF744DC00BAFE38 /* OS.swift in Sources */, + 54B069931CF742D300BAFE38 /* InAppReceiptRefreshRequest.swift in Sources */, + 54B069921CF742D100BAFE38 /* InAppReceipt.swift in Sources */, + 54B069941CF742D600BAFE38 /* InAppProductQueryRequest.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; 6502F5FA1B985833004E342D /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; @@ -486,6 +566,52 @@ /* End PBXVariantGroup section */ /* Begin XCBuildConfiguration section */ + 54C0D5311CF7404500F90BCE /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ANALYZER_NONNULL = YES; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + INFOPLIST_FILE = SwiftyStoreKitTV/Info.plist; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = me.florianweich.SwiftyStoreKitTV; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = appletvos; + SKIP_INSTALL = YES; + TARGETED_DEVICE_FAMILY = 3; + TVOS_DEPLOYMENT_TARGET = 9.0; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Debug; + }; + 54C0D5321CF7404500F90BCE /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ANALYZER_NONNULL = YES; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + INFOPLIST_FILE = SwiftyStoreKitTV/Info.plist; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = me.florianweich.SwiftyStoreKitTV; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = appletvos; + SKIP_INSTALL = YES; + TARGETED_DEVICE_FAMILY = 3; + TVOS_DEPLOYMENT_TARGET = 9.0; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Release; + }; 6502F60E1B985833004E342D /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { @@ -720,6 +846,15 @@ /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ + 54C0D5331CF7404500F90BCE /* Build configuration list for PBXNativeTarget "SwiftyStoreKitTV" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 54C0D5311CF7404500F90BCE /* Debug */, + 54C0D5321CF7404500F90BCE /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; 6502F5F91B985833004E342D /* Build configuration list for PBXProject "SwiftyStoreKit" */ = { isa = XCConfigurationList; buildConfigurations = ( diff --git a/SwiftyStoreKit/InAppCompleteTransactionsObserver.swift b/SwiftyStoreKit/InAppCompleteTransactionsObserver.swift index 56b62c73..d5b5dd5a 100644 --- a/SwiftyStoreKit/InAppCompleteTransactionsObserver.swift +++ b/SwiftyStoreKit/InAppCompleteTransactionsObserver.swift @@ -74,7 +74,7 @@ class InAppCompleteTransactionsObserver: NSObject, SKPaymentTransactionObserver for transaction in transactions { - #if os(iOS) + #if os(iOS) || os(tvOS) let transactionState = transaction.transactionState #elseif os(OSX) let transactionState = PaymentTransactionState(rawValue: transaction.transactionState)! diff --git a/SwiftyStoreKit/InAppProductPurchaseRequest.swift b/SwiftyStoreKit/InAppProductPurchaseRequest.swift index 6cc53863..26056b78 100644 --- a/SwiftyStoreKit/InAppProductPurchaseRequest.swift +++ b/SwiftyStoreKit/InAppProductPurchaseRequest.swift @@ -103,7 +103,7 @@ class InAppProductPurchaseRequest: NSObject, SKPaymentTransactionObserver { isPurchaseRequest = true } - #if os(iOS) + #if os(iOS) || os(tvOS) let transactionState = transaction.transactionState #elseif os(OSX) let transactionState = PaymentTransactionState(rawValue: transaction.transactionState)! diff --git a/SwiftyStoreKit/InAppProductQueryRequest.swift b/SwiftyStoreKit/InAppProductQueryRequest.swift index a8f924d9..1284c16a 100644 --- a/SwiftyStoreKit/InAppProductQueryRequest.swift +++ b/SwiftyStoreKit/InAppProductQueryRequest.swift @@ -74,7 +74,7 @@ class InAppProductQueryRequest: NSObject, SKProductsRequestDelegate { } // MARK: - missing SKPaymentTransactionState on OSX - #if os(iOS) + #if os(iOS) || os(tvOS) func request(request: SKRequest, didFailWithError error: NSError) { requestFailed(error) } diff --git a/SwiftyStoreKit/InAppReceipt.swift b/SwiftyStoreKit/InAppReceipt.swift index 3221fbf9..eeab7c62 100644 --- a/SwiftyStoreKit/InAppReceipt.swift +++ b/SwiftyStoreKit/InAppReceipt.swift @@ -127,7 +127,7 @@ public enum ReceiptInfoField: String { case expires_date // For a transaction that was canceled by Apple customer support, the time and date of the cancellation. Treat a canceled receipt the same as if no purchase had ever been made. case cancellation_date - #if os(iOS) + #if os(iOS) || os(tvOS) // A string that the App Store uses to uniquely identify the application that created the transaction. If your server supports multiple applications, you can use this value to differentiate between them. Apps are assigned an identifier only in the production environment, so this key is not present for receipts created in the test environment. This field is not present for Mac apps. See also Bundle Identifier. case app_item_id #endif diff --git a/SwiftyStoreKit/InAppReceiptRefreshRequest.swift b/SwiftyStoreKit/InAppReceiptRefreshRequest.swift index fe689c63..659f8936 100644 --- a/SwiftyStoreKit/InAppReceiptRefreshRequest.swift +++ b/SwiftyStoreKit/InAppReceiptRefreshRequest.swift @@ -26,7 +26,7 @@ import StoreKit import Foundation -#if os(iOS) +#if os(iOS) || os(tvOS) class InAppReceiptRefreshRequest: NSObject, SKRequestDelegate { enum ResultType { diff --git a/SwiftyStoreKit/OS.swift b/SwiftyStoreKit/OS.swift index 4a70c52c..930cbf7f 100644 --- a/SwiftyStoreKit/OS.swift +++ b/SwiftyStoreKit/OS.swift @@ -25,7 +25,7 @@ import StoreKit // MARK: - missing SKPaymentTransactionState on OSX -#if os(iOS) +#if os(iOS) || os(tvOS) public typealias PaymentTransactionState = SKPaymentTransactionState #elseif os(OSX) public enum PaymentTransactionState : Int { diff --git a/SwiftyStoreKit/SwiftyStoreKit.swift b/SwiftyStoreKit/SwiftyStoreKit.swift index c8172ebd..0f4e1032 100644 --- a/SwiftyStoreKit/SwiftyStoreKit.swift +++ b/SwiftyStoreKit/SwiftyStoreKit.swift @@ -52,7 +52,7 @@ public class SwiftyStoreKit { private var inflightPurchases: [String: InAppProductPurchaseRequest] = [:] private var restoreRequest: InAppProductPurchaseRequest? private var completeTransactionsObserver: InAppCompleteTransactionsObserver? - #if os(iOS) + #if os(iOS) || os(tvOS) private var receiptRefreshRequest: InAppReceiptRefreshRequest? #endif // MARK: Enums diff --git a/SwiftyStoreKitTV/Info.plist b/SwiftyStoreKitTV/Info.plist new file mode 100644 index 00000000..d3de8eef --- /dev/null +++ b/SwiftyStoreKitTV/Info.plist @@ -0,0 +1,26 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + $(CURRENT_PROJECT_VERSION) + NSPrincipalClass + + + diff --git a/SwiftyStoreKitTV/SwiftyStoreKitTV.h b/SwiftyStoreKitTV/SwiftyStoreKitTV.h new file mode 100644 index 00000000..f677df91 --- /dev/null +++ b/SwiftyStoreKitTV/SwiftyStoreKitTV.h @@ -0,0 +1,19 @@ +// +// SwiftyStoreKitTV.h +// SwiftyStoreKitTV +// +// Created by Florian Weich on 26.05.16. +// Copyright © 2016 musevisions. All rights reserved. +// + +#import + +//! Project version number for SwiftyStoreKitTV. +FOUNDATION_EXPORT double SwiftyStoreKitTVVersionNumber; + +//! Project version string for SwiftyStoreKitTV. +FOUNDATION_EXPORT const unsigned char SwiftyStoreKitTVVersionString[]; + +// In this header, you should import all the public headers of your framework using statements like #import + +