فهرست منبع

Merge pull request #41 from florianweich/tvos

Add tvOS support
Andrea Bizzotto 9 سال پیش
والد
کامیت
ee0def276b

+ 135 - 0
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 = "<group>"; };
+		54C0D5301CF7404500F90BCE /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
 		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 = "<group>"; };
 		6502F6151B985858004E342D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
@@ -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 = "<group>";
+		};
 		6502F5F51B985833004E342D = {
 			isa = PBXGroup;
 			children = (
@@ -152,6 +179,7 @@
 				6502F6131B985858004E342D /* SwiftyStoreDemo */,
 				C4D74BBC1C24CECA0071AD3E /* SwiftyStoreKitOSX */,
 				C4FD3A021C2954C10035CFF3 /* SwiftyStoreOSXDemo */,
+				54C0D52D1CF7404500F90BCE /* SwiftyStoreKitTV */,
 				6502F5FF1B985833004E342D /* Products */,
 			);
 			sourceTree = "<group>";
@@ -163,6 +191,7 @@
 				6502F62D1B985C40004E342D /* SwiftyStoreKit.framework */,
 				C4D74BBB1C24CEC90071AD3E /* SwiftyStoreKit.framework */,
 				C4FD3A011C2954C10035CFF3 /* SwiftyStoreOSXDemo.app */,
+				54C0D52C1CF7404500F90BCE /* SwiftyStoreKitTV.framework */,
 			);
 			name = Products;
 			sourceTree = "<group>";
@@ -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 = (

+ 1 - 1
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)!

+ 1 - 1
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)!

+ 1 - 1
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)
     }

+ 1 - 1
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

+ 1 - 1
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 {

+ 1 - 1
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 {

+ 1 - 1
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

+ 26 - 0
SwiftyStoreKitTV/Info.plist

@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+	<key>CFBundleDevelopmentRegion</key>
+	<string>en</string>
+	<key>CFBundleExecutable</key>
+	<string>$(EXECUTABLE_NAME)</string>
+	<key>CFBundleIdentifier</key>
+	<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
+	<key>CFBundleInfoDictionaryVersion</key>
+	<string>6.0</string>
+	<key>CFBundleName</key>
+	<string>$(PRODUCT_NAME)</string>
+	<key>CFBundlePackageType</key>
+	<string>FMWK</string>
+	<key>CFBundleShortVersionString</key>
+	<string>1.0</string>
+	<key>CFBundleSignature</key>
+	<string>????</string>
+	<key>CFBundleVersion</key>
+	<string>$(CURRENT_PROJECT_VERSION)</string>
+	<key>NSPrincipalClass</key>
+	<string></string>
+</dict>
+</plist>

+ 19 - 0
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 <UIKit/UIKit.h>
+
+//! 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 <SwiftyStoreKitTV/PublicHeader.h>
+
+