watchOS Build

Fixes #530
This commit is contained in:
Sam Spencer
2020-05-29 22:48:01 -04:00
parent 152dd68c6d
commit 62a5ee2989
9 changed files with 353 additions and 24 deletions

View File

@@ -74,6 +74,22 @@
A61BF4BE2481F0560017D9BC /* SKProductDiscount+LocalizedPrice.swift in Sources */ = {isa = PBXBuildFile; fileRef = A61BF4BD2481F0560017D9BC /* SKProductDiscount+LocalizedPrice.swift */; };
A61BF4BF2481F0560017D9BC /* SKProductDiscount+LocalizedPrice.swift in Sources */ = {isa = PBXBuildFile; fileRef = A61BF4BD2481F0560017D9BC /* SKProductDiscount+LocalizedPrice.swift */; };
A61BF4C02481F0560017D9BC /* SKProductDiscount+LocalizedPrice.swift in Sources */ = {isa = PBXBuildFile; fileRef = A61BF4BD2481F0560017D9BC /* SKProductDiscount+LocalizedPrice.swift */; };
A61BF4C62481F4970017D9BC /* OS.swift in Sources */ = {isa = PBXBuildFile; fileRef = C40C680F1C29414C00B60B7E /* OS.swift */; };
A61BF4C72481F4970017D9BC /* AppleReceiptValidator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1592CD4F1E27756500D321E6 /* AppleReceiptValidator.swift */; };
A61BF4C82481F4970017D9BC /* InAppProductQueryRequest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6502F6231B98586A004E342D /* InAppProductQueryRequest.swift */; };
A61BF4C92481F4970017D9BC /* InAppReceiptRefreshRequest.swift in Sources */ = {isa = PBXBuildFile; fileRef = C4083C561C2AB0A900295248 /* InAppReceiptRefreshRequest.swift */; };
A61BF4CA2481F4970017D9BC /* PaymentsController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65F70AC81E2EDC3700BF040D /* PaymentsController.swift */; };
A61BF4CB2481F4970017D9BC /* ProductsInfoController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 650307FB1E33154F001332A4 /* ProductsInfoController.swift */; };
A61BF4CC2481F4970017D9BC /* RestorePurchasesController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 650307F31E3177EF001332A4 /* RestorePurchasesController.swift */; };
A61BF4CD2481F4970017D9BC /* PaymentQueueController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 658A08361E2EC24E0074A98F /* PaymentQueueController.swift */; };
A61BF4CE2481F4970017D9BC /* InAppReceiptVerificator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65E9E0781ECADF5E005CF7B4 /* InAppReceiptVerificator.swift */; };
A61BF4CF2481F4970017D9BC /* SKProduct+LocalizedPrice.swift in Sources */ = {isa = PBXBuildFile; fileRef = 653722801DB8282600C8F944 /* SKProduct+LocalizedPrice.swift */; };
A61BF4D02481F4970017D9BC /* InAppReceipt.swift in Sources */ = {isa = PBXBuildFile; fileRef = C4A7C7621C29B8D00053ED64 /* InAppReceipt.swift */; };
A61BF4D12481F4970017D9BC /* CompleteTransactionsController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 650307F71E317BCF001332A4 /* CompleteTransactionsController.swift */; };
A61BF4D22481F4970017D9BC /* SwiftyStoreKit+Types.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65BB6CE71DDB018900218A0B /* SwiftyStoreKit+Types.swift */; };
A61BF4D32481F4970017D9BC /* SwiftyStoreKit.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6502F6241B98586A004E342D /* SwiftyStoreKit.swift */; };
A61BF4D42481F4970017D9BC /* SKProductDiscount+LocalizedPrice.swift in Sources */ = {isa = PBXBuildFile; fileRef = A61BF4BD2481F0560017D9BC /* SKProductDiscount+LocalizedPrice.swift */; };
A61BF4E02481F7400017D9BC /* SwiftyStoreKit-watchOS.h in Headers */ = {isa = PBXBuildFile; fileRef = A61BF4DF2481F7150017D9BC /* SwiftyStoreKit-watchOS.h */; settings = {ATTRIBUTES = (Public, ); }; };
C3099C071E2FCDAA00392A54 /* PaymentsControllerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3099C061E2FCDAA00392A54 /* PaymentsControllerTests.swift */; };
C3099C091E2FCE3A00392A54 /* TestProduct.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3099C081E2FCE3A00392A54 /* TestProduct.swift */; };
C3099C0B1E2FD13200392A54 /* TestPaymentTransaction.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3099C0A1E2FD13200392A54 /* TestPaymentTransaction.swift */; };
@@ -211,6 +227,9 @@
65F7DF981DCD536100835D30 /* SwiftyStoreKit-macOS.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "SwiftyStoreKit-macOS.h"; sourceTree = "<group>"; };
65F7DF991DCD536100835D30 /* SwiftyStoreKit-tvOS.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "SwiftyStoreKit-tvOS.h"; sourceTree = "<group>"; };
A61BF4BD2481F0560017D9BC /* SKProductDiscount+LocalizedPrice.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "SKProductDiscount+LocalizedPrice.swift"; sourceTree = "<group>"; };
A61BF4DD2481F4970017D9BC /* SwiftyStoreKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SwiftyStoreKit.framework; sourceTree = BUILT_PRODUCTS_DIR; };
A61BF4DF2481F7150017D9BC /* SwiftyStoreKit-watchOS.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "SwiftyStoreKit-watchOS.h"; sourceTree = "<group>"; };
A61BF4E12481F7B00017D9BC /* Info-watchOS.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "Info-watchOS.plist"; sourceTree = "<group>"; };
C3099C061E2FCDAA00392A54 /* PaymentsControllerTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PaymentsControllerTests.swift; sourceTree = "<group>"; };
C3099C081E2FCE3A00392A54 /* TestProduct.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TestProduct.swift; sourceTree = "<group>"; };
C3099C0A1E2FD13200392A54 /* TestPaymentTransaction.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TestPaymentTransaction.swift; sourceTree = "<group>"; };
@@ -261,6 +280,13 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
A61BF4D52481F4970017D9BC /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
C4D74BB71C24CEC90071AD3E /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
@@ -301,6 +327,7 @@
54C0D52C1CF7404500F90BCE /* SwiftyStoreKit.framework */,
658A083E1E2EC5120074A98F /* SwiftyStoreKitTests.xctest */,
654287EE1E79F5A000F61800 /* SwiftyStoreKit_tvOSDemo.app */,
A61BF4DD2481F4970017D9BC /* SwiftyStoreKit.framework */,
);
name = Products;
sourceTree = "<group>";
@@ -389,9 +416,11 @@
65F7DF941DCD536100835D30 /* Info-iOS.plist */,
65F7DF951DCD536100835D30 /* Info-macOS.plist */,
65F7DF961DCD536100835D30 /* Info-tvOS.plist */,
A61BF4E12481F7B00017D9BC /* Info-watchOS.plist */,
65F7DF971DCD536100835D30 /* SwiftyStoreKit-iOS.h */,
65F7DF981DCD536100835D30 /* SwiftyStoreKit-macOS.h */,
65F7DF991DCD536100835D30 /* SwiftyStoreKit-tvOS.h */,
A61BF4DF2481F7150017D9BC /* SwiftyStoreKit-watchOS.h */,
);
path = Platforms;
sourceTree = "<group>";
@@ -415,6 +444,14 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
A61BF4D62481F4970017D9BC /* Headers */ = {
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
files = (
A61BF4E02481F7400017D9BC /* SwiftyStoreKit-watchOS.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
C4D74BB81C24CEC90071AD3E /* Headers */ = {
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
@@ -520,6 +557,25 @@
productReference = 658A083E1E2EC5120074A98F /* SwiftyStoreKitTests.xctest */;
productType = "com.apple.product-type.bundle.unit-test";
};
A61BF4C42481F4970017D9BC /* SwiftyStoreKit_watchOS */ = {
isa = PBXNativeTarget;
buildConfigurationList = A61BF4DA2481F4970017D9BC /* Build configuration list for PBXNativeTarget "SwiftyStoreKit_watchOS" */;
buildPhases = (
A61BF4C52481F4970017D9BC /* Sources */,
A61BF4D62481F4970017D9BC /* Headers */,
A61BF4D52481F4970017D9BC /* Frameworks */,
A61BF4D82481F4970017D9BC /* Resources */,
A61BF4D92481F4970017D9BC /* swiftlint */,
);
buildRules = (
);
dependencies = (
);
name = SwiftyStoreKit_watchOS;
productName = SwiftyStoreKit;
productReference = A61BF4DD2481F4970017D9BC /* SwiftyStoreKit.framework */;
productType = "com.apple.product-type.framework";
};
C4D74BBA1C24CEC90071AD3E /* SwiftyStoreKit_macOS */ = {
isa = PBXNativeTarget;
buildConfigurationList = C4D74BC21C24CECA0071AD3E /* Build configuration list for PBXNativeTarget "SwiftyStoreKit_macOS" */;
@@ -616,6 +672,7 @@
6502F62C1B985C40004E342D /* SwiftyStoreKit_iOS */,
C4D74BBA1C24CEC90071AD3E /* SwiftyStoreKit_macOS */,
54C0D52B1CF7404500F90BCE /* SwiftyStoreKit_tvOS */,
A61BF4C42481F4970017D9BC /* SwiftyStoreKit_watchOS */,
6502F5FD1B985833004E342D /* SwiftyStoreKit_iOSDemo */,
C4FD3A001C2954C10035CFF3 /* SwiftyStoreKit_macOSDemo */,
654287ED1E79F5A000F61800 /* SwiftyStoreKit_tvOSDemo */,
@@ -665,6 +722,13 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
A61BF4D82481F4970017D9BC /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
C4D74BB91C24CEC90071AD3E /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
@@ -684,6 +748,20 @@
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
A61BF4D92481F4970017D9BC /* swiftlint */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = swiftlint;
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "if which swiftlint >/dev/null; then\nswiftlint\nelse\necho \"SwiftLint does not exist, download from https://github.com/realm/SwiftLint\"\nfi\n";
};
C4B298341E5C25DD007C87C2 /* swiftlint */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
@@ -797,6 +875,28 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
A61BF4C52481F4970017D9BC /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
A61BF4C62481F4970017D9BC /* OS.swift in Sources */,
A61BF4C72481F4970017D9BC /* AppleReceiptValidator.swift in Sources */,
A61BF4C82481F4970017D9BC /* InAppProductQueryRequest.swift in Sources */,
A61BF4C92481F4970017D9BC /* InAppReceiptRefreshRequest.swift in Sources */,
A61BF4CA2481F4970017D9BC /* PaymentsController.swift in Sources */,
A61BF4CB2481F4970017D9BC /* ProductsInfoController.swift in Sources */,
A61BF4CC2481F4970017D9BC /* RestorePurchasesController.swift in Sources */,
A61BF4CD2481F4970017D9BC /* PaymentQueueController.swift in Sources */,
A61BF4CE2481F4970017D9BC /* InAppReceiptVerificator.swift in Sources */,
A61BF4CF2481F4970017D9BC /* SKProduct+LocalizedPrice.swift in Sources */,
A61BF4D02481F4970017D9BC /* InAppReceipt.swift in Sources */,
A61BF4D12481F4970017D9BC /* CompleteTransactionsController.swift in Sources */,
A61BF4D22481F4970017D9BC /* SwiftyStoreKit+Types.swift in Sources */,
A61BF4D32481F4970017D9BC /* SwiftyStoreKit.swift in Sources */,
A61BF4D42481F4970017D9BC /* SKProductDiscount+LocalizedPrice.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
C4D74BB61C24CEC90071AD3E /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
@@ -1214,6 +1314,61 @@
};
name = Release;
};
A61BF4DB2481F4970017D9BC /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
APPLICATION_EXTENSION_API_ONLY = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
CURRENT_PROJECT_VERSION = 1;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = "";
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
INFOPLIST_FILE = "$(SRCROOT)/SwiftyStoreKit/Platforms/Info-watchOS.plist";
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.musevisions.iOS.SwiftyStoreKit;
PRODUCT_NAME = SwiftyStoreKit;
SDKROOT = watchos;
SKIP_INSTALL = YES;
SUPPORTED_PLATFORMS = "watchsimulator watchos";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = 4;
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
};
name = Debug;
};
A61BF4DC2481F4970017D9BC /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
APPLICATION_EXTENSION_API_ONLY = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
CURRENT_PROJECT_VERSION = 1;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = "";
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
INFOPLIST_FILE = "$(SRCROOT)/SwiftyStoreKit/Platforms/Info-watchOS.plist";
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.musevisions.iOS.SwiftyStoreKit;
PRODUCT_NAME = SwiftyStoreKit;
SDKROOT = watchos;
SKIP_INSTALL = YES;
SUPPORTED_PLATFORMS = "watchsimulator watchos";
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = 4;
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
};
name = Release;
};
C4D74BC01C24CECA0071AD3E /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
@@ -1353,6 +1508,15 @@
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
A61BF4DA2481F4970017D9BC /* Build configuration list for PBXNativeTarget "SwiftyStoreKit_watchOS" */ = {
isa = XCConfigurationList;
buildConfigurations = (
A61BF4DB2481F4970017D9BC /* Debug */,
A61BF4DC2481F4970017D9BC /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
C4D74BC21C24CECA0071AD3E /* Build configuration list for PBXNativeTarget "SwiftyStoreKit_macOS" */ = {
isa = XCConfigurationList;
buildConfigurations = (

View File

@@ -0,0 +1,67 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1150"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "A61BF4C42481F4970017D9BC"
BuildableName = "SwiftyStoreKit_watchOS.framework"
BlueprintName = "SwiftyStoreKit_watchOS"
ReferencedContainer = "container:SwiftyStoreKit.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "A61BF4C42481F4970017D9BC"
BuildableName = "SwiftyStoreKit_watchOS.framework"
BlueprintName = "SwiftyStoreKit_watchOS"
ReferencedContainer = "container:SwiftyStoreKit.xcodeproj">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

View File

@@ -2,29 +2,29 @@
// OS.swift
// SwiftyStoreKit
//
// Copyright (c) 2015 Andrea Bizzotto (bizz84@gmail.com)
// Copyright (c) 2020 Andrea Bizzotto (bizz84@gmail.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
import StoreKit
// MARK: - missing SKMutablePayment init with product on OSX
// MARK: - Missing SKMutablePayment init with product on macOS
#if os(OSX)
extension SKMutablePayment {
convenience init(product: SKProduct) {
@@ -33,3 +33,16 @@ import StoreKit
}
}
#endif
// MARK: - Missing SKError on watchOS
#if os(watchOS)
public struct SKError: Error {
var Code: SKErrorCode = .unknown
var _nsError: NSError?
static var unknown: SKErrorCode = .unknown
static var paymentInvalid: SKErrorCode = .paymentInvalid
}
#endif

View File

@@ -27,11 +27,10 @@ import StoreKit
protocol TransactionController {
/**
* - parameter transactions: transactions to process
* - parameter paymentQueue: payment queue for finishing transactions
* - returns: array of unhandled transactions
*/
/// Process the supplied transactions on a given queue.
/// - parameter transactions: transactions to process
/// - parameter paymentQueue: payment queue for finishing transactions
/// - returns: array of unhandled transactions
func processTransactions(_ transactions: [SKPaymentTransaction], on paymentQueue: PaymentQueue) -> [SKPaymentTransaction]
}
@@ -50,7 +49,11 @@ public protocol PaymentQueue: class {
func start(_ downloads: [SKDownload])
func pause(_ downloads: [SKDownload])
#if os(watchOS)
func resumeDownloads(_ downloads: [SKDownload])
#else
func resume(_ downloads: [SKDownload])
#endif
func cancel(_ downloads: [SKDownload])
func restoreCompletedTransactions(withApplicationUsername username: String?)
@@ -130,7 +133,7 @@ class PaymentQueueController: NSObject, SKPaymentTransactionObserver {
}
#if os(iOS) || os(tvOS)
if #available(iOS 8.3, tvOS 9.0, *) {
if #available(iOS 8.3, *) {
skPayment.simulatesAskToBuyInSandbox = payment.simulatesAskToBuyInSandbox
}
#endif
@@ -176,8 +179,13 @@ class PaymentQueueController: NSObject, SKPaymentTransactionObserver {
func pause(_ downloads: [SKDownload]) {
paymentQueue.pause(downloads)
}
func resume(_ downloads: [SKDownload]) {
#if os(watchOS)
paymentQueue.resumeDownloads(downloads)
#else
paymentQueue.resume(downloads)
#endif
}
func cancel(_ downloads: [SKDownload]) {
paymentQueue.cancel(downloads)

View File

@@ -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>

View File

@@ -0,0 +1,38 @@
//
// SwiftyStoreKit-watchOS.h
// SwiftyStoreKit
//
// Created by Sam Spencer on 5/29/20.
// Copyright © 2020 Sam Spencer. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import <UIKit/UIKit.h>
#import <WatchKit/WatchKit.h>
#import <StoreKit/StoreKit.h>
//! Project version number for SwiftyStoreKit.
FOUNDATION_EXPORT double SwiftyStoreKitVersionNumber;
//! Project version string for SwiftyStoreKit.
FOUNDATION_EXPORT const unsigned char SwiftyStoreKitVersionString[];
// In this header, you should import all the public headers of your framework using statements like #import <SwiftyStoreKit/PublicHeader.h>

View File

@@ -118,10 +118,17 @@ public class SwiftyStoreKit {
return RestoreResults(restoredPurchases: restoredPurchases, restoreFailedPurchases: restoreFailedPurchases)
}
#if os(watchOS)
private func storeInternalError(code: SKErrorCode = SKErrorCode.unknown, description: String = "") -> SKError {
let error = NSError(domain: SKErrorDomain, code: code.rawValue, userInfo: [ NSLocalizedDescriptionKey: description ])
return SKError.init(Code: code, _nsError: error)
}
#else
private func storeInternalError(code: SKError.Code = SKError.unknown, description: String = "") -> SKError {
let error = NSError(domain: SKErrorDomain, code: code.rawValue, userInfo: [ NSLocalizedDescriptionKey: description ])
return SKError(_nsError: error)
}
#endif
}
extension SwiftyStoreKit {

View File

@@ -19,6 +19,12 @@ echo "/* Build: SwiftyStoreKit_tvOS */"
echo "/******************************/${normal}"
set -o pipefail && xcodebuild -project SwiftyStoreKit.xcodeproj -target SwiftyStoreKit_tvOS | tee xcodebuild.log | xcpretty
echo ""
echo "${bold}/******************************/"
echo "/* Build: SwiftyStoreKit_watchOS */"
echo "/******************************/${normal}"
set -o pipefail && xcodebuild -project SwiftyStoreKit.xcodeproj -target SwiftyStoreKit_watchOS | tee xcodebuild.log | xcpretty
echo ""
echo "${bold}/****************************/"
echo "/* Run: SwiftyStoreKitTests */"

View File

@@ -7,7 +7,7 @@
set -e
SWIFTLINT_PKG_PATH="/tmp/SwiftLint.pkg"
SWIFTLINT_PKG_URL="https://github.com/realm/SwiftLint/releases/download/0.22.0/SwiftLint.pkg"
SWIFTLINT_PKG_URL="https://github.com/realm/SwiftLint/releases/download/0.39.2/SwiftLint.pkg"
wget --output-document=$SWIFTLINT_PKG_PATH $SWIFTLINT_PKG_URL