changeset 73:2b85d6ed433e

Implemented StoreKit Testing in Simulator
author Dennis Concepción Martín <dennisconcepcionmartin@gmail.com>
date Thu, 29 Jul 2021 10:51:08 +0100
parents f9c598661700
children bfb959bee6d7
files Configuration.storekit Simoleon.xcodeproj/project.pbxproj Simoleon.xcodeproj/project.xcworkspace/xcuserdata/dennis.xcuserdatad/UserInterfaceState.xcuserstate Simoleon.xcodeproj/xcuserdata/dennis.xcuserdatad/xcschemes/Simoleon - StoreKit Test.xcscheme Simoleon.xcodeproj/xcuserdata/dennis.xcuserdatad/xcschemes/xcschememanagement.plist Simoleon/Helpers/CurrencySelector.swift Simoleon/Settings.swift StoreKitTestCertificate.cer
diffstat 8 files changed, 172 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Configuration.storekit	Thu Jul 29 10:51:08 2021 +0100
@@ -0,0 +1,49 @@
+{
+  "identifier" : "DAA348ED",
+  "nonRenewingSubscriptions" : [
+
+  ],
+  "products" : [
+
+  ],
+  "settings" : {
+
+  },
+  "subscriptionGroups" : [
+    {
+      "id" : "22DC70A2",
+      "localizations" : [
+
+      ],
+      "name" : "Simoleon Subscription",
+      "subscriptions" : [
+        {
+          "adHocOffers" : [
+
+          ],
+          "displayPrice" : "0.99",
+          "familyShareable" : true,
+          "groupNumber" : 1,
+          "internalID" : "5C46FFC9",
+          "introductoryOffer" : null,
+          "localizations" : [
+            {
+              "description" : "",
+              "displayName" : "",
+              "locale" : "en_US"
+            }
+          ],
+          "productID" : "simoleon_all_monthly",
+          "recurringSubscriptionPeriod" : "P1M",
+          "referenceName" : "All Access",
+          "subscriptionGroupID" : "22DC70A2",
+          "type" : "RecurringSubscription"
+        }
+      ]
+    }
+  ],
+  "version" : {
+    "major" : 1,
+    "minor" : 1
+  }
+}
--- a/Simoleon.xcodeproj/project.pbxproj	Thu Jul 29 10:25:05 2021 +0100
+++ b/Simoleon.xcodeproj/project.pbxproj	Thu Jul 29 10:51:08 2021 +0100
@@ -18,6 +18,12 @@
 		9585BB1426A6B7F400E3193E /* NetworkRequest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9585BB1326A6B7F400E3193E /* NetworkRequest.swift */; };
 		9585BB1A26A6E8FD00E3193E /* SimpleSuccess.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9585BB1926A6E8FD00E3193E /* SimpleSuccess.swift */; };
 		9587598D26B2A68B004086F0 /* CurrencyMetadata.json in Resources */ = {isa = PBXBuildFile; fileRef = 9587598F26B2A68B004086F0 /* CurrencyMetadata.json */; };
+		9587599E26B2ACA6004086F0 /* Configuration.storekit in Resources */ = {isa = PBXBuildFile; fileRef = 9587599D26B2ACA6004086F0 /* Configuration.storekit */; };
+		9587599F26B2ACA6004086F0 /* Configuration.storekit in Resources */ = {isa = PBXBuildFile; fileRef = 9587599D26B2ACA6004086F0 /* Configuration.storekit */; };
+		958759A026B2ACA6004086F0 /* Configuration.storekit in Resources */ = {isa = PBXBuildFile; fileRef = 9587599D26B2ACA6004086F0 /* Configuration.storekit */; };
+		958759A226B2AE85004086F0 /* StoreKitTestCertificate.cer in Resources */ = {isa = PBXBuildFile; fileRef = 958759A126B2AE85004086F0 /* StoreKitTestCertificate.cer */; };
+		958759A326B2AE85004086F0 /* StoreKitTestCertificate.cer in Resources */ = {isa = PBXBuildFile; fileRef = 958759A126B2AE85004086F0 /* StoreKitTestCertificate.cer */; };
+		958759A426B2AE85004086F0 /* StoreKitTestCertificate.cer in Resources */ = {isa = PBXBuildFile; fileRef = 958759A126B2AE85004086F0 /* StoreKitTestCertificate.cer */; };
 		95909CB326B07BFC00D051AB /* SearchBar.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95909CB226B07BFC00D051AB /* SearchBar.swift */; };
 		95AEBC9526A03ECB00613729 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95AEBC9426A03ECB00613729 /* ContentView.swift */; };
 		95AEBC9B26A04A4200613729 /* CurrencyMetadataModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95AEBC9A26A04A4200613729 /* CurrencyMetadataModel.swift */; };
@@ -131,6 +137,8 @@
 		9587599A26B2A6A8004086F0 /* pt-PT */ = {isa = PBXFileReference; lastKnownFileType = text.json; name = "pt-PT"; path = "pt-PT.lproj/CurrencyMetadata.json"; sourceTree = "<group>"; };
 		9587599B26B2A6A8004086F0 /* ru */ = {isa = PBXFileReference; lastKnownFileType = text.json; name = ru; path = ru.lproj/CurrencyMetadata.json; sourceTree = "<group>"; };
 		9587599C26B2A6AA004086F0 /* es */ = {isa = PBXFileReference; lastKnownFileType = text.json; name = es; path = es.lproj/CurrencyMetadata.json; sourceTree = "<group>"; };
+		9587599D26B2ACA6004086F0 /* Configuration.storekit */ = {isa = PBXFileReference; lastKnownFileType = file; path = Configuration.storekit; sourceTree = SOURCE_ROOT; };
+		958759A126B2AE85004086F0 /* StoreKitTestCertificate.cer */ = {isa = PBXFileReference; lastKnownFileType = file; path = StoreKitTestCertificate.cer; sourceTree = "<group>"; };
 		95909CB226B07BFC00D051AB /* SearchBar.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SearchBar.swift; sourceTree = "<group>"; };
 		95A70BE926B0550000CC0273 /* CloudKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CloudKit.framework; path = Platforms/WatchOS.platform/Developer/SDKs/WatchOS7.4.sdk/System/Library/Frameworks/CloudKit.framework; sourceTree = DEVELOPER_DIR; };
 		95AEBC9426A03ECB00613729 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = "<group>"; };
@@ -292,6 +300,8 @@
 		95C5B21B2697752600941585 = {
 			isa = PBXGroup;
 			children = (
+				9587599D26B2ACA6004086F0 /* Configuration.storekit */,
+				958759A126B2AE85004086F0 /* StoreKitTestCertificate.cer */,
 				95C5B2262697752600941585 /* Simoleon */,
 				95C5B23D2697752700941585 /* SimoleonTests */,
 				95C5B2482697752700941585 /* SimoleonUITests */,
@@ -515,6 +525,8 @@
 			buildActionMask = 2147483647;
 			files = (
 				95DD4ABB269B33810027CA1F /* CurrencyPairs.json in Resources */,
+				9587599E26B2ACA6004086F0 /* Configuration.storekit in Resources */,
+				958759A226B2AE85004086F0 /* StoreKitTestCertificate.cer in Resources */,
 				95C5B22F2697752700941585 /* Preview Assets.xcassets in Resources */,
 				95E76436269DFC1A008E9F31 /* LaunchScreen.storyboard in Resources */,
 				9587598D26B2A68B004086F0 /* CurrencyMetadata.json in Resources */,
@@ -530,6 +542,8 @@
 			isa = PBXResourcesBuildPhase;
 			buildActionMask = 2147483647;
 			files = (
+				9587599F26B2ACA6004086F0 /* Configuration.storekit in Resources */,
+				958759A326B2AE85004086F0 /* StoreKitTestCertificate.cer in Resources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -537,6 +551,8 @@
 			isa = PBXResourcesBuildPhase;
 			buildActionMask = 2147483647;
 			files = (
+				958759A026B2ACA6004086F0 /* Configuration.storekit in Resources */,
+				958759A426B2AE85004086F0 /* StoreKitTestCertificate.cer in Resources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
Binary file Simoleon.xcodeproj/project.xcworkspace/xcuserdata/dennis.xcuserdatad/UserInterfaceState.xcuserstate has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Simoleon.xcodeproj/xcuserdata/dennis.xcuserdatad/xcschemes/Simoleon - StoreKit Test.xcscheme	Thu Jul 29 10:51:08 2021 +0100
@@ -0,0 +1,101 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Scheme
+   LastUpgradeVersion = "1250"
+   version = "1.3">
+   <BuildAction
+      parallelizeBuildables = "YES"
+      buildImplicitDependencies = "YES">
+      <BuildActionEntries>
+         <BuildActionEntry
+            buildForTesting = "YES"
+            buildForRunning = "YES"
+            buildForProfiling = "YES"
+            buildForArchiving = "YES"
+            buildForAnalyzing = "YES">
+            <BuildableReference
+               BuildableIdentifier = "primary"
+               BlueprintIdentifier = "95C5B2232697752600941585"
+               BuildableName = "Simoleon.app"
+               BlueprintName = "Simoleon"
+               ReferencedContainer = "container:Simoleon.xcodeproj">
+            </BuildableReference>
+         </BuildActionEntry>
+      </BuildActionEntries>
+   </BuildAction>
+   <TestAction
+      buildConfiguration = "Debug"
+      selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
+      selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
+      shouldUseLaunchSchemeArgsEnv = "YES">
+      <Testables>
+         <TestableReference
+            skipped = "NO">
+            <BuildableReference
+               BuildableIdentifier = "primary"
+               BlueprintIdentifier = "95C5B2392697752700941585"
+               BuildableName = "SimoleonTests.xctest"
+               BlueprintName = "SimoleonTests"
+               ReferencedContainer = "container:Simoleon.xcodeproj">
+            </BuildableReference>
+         </TestableReference>
+         <TestableReference
+            skipped = "NO">
+            <BuildableReference
+               BuildableIdentifier = "primary"
+               BlueprintIdentifier = "95C5B2442697752700941585"
+               BuildableName = "SimoleonUITests.xctest"
+               BlueprintName = "SimoleonUITests"
+               ReferencedContainer = "container:Simoleon.xcodeproj">
+            </BuildableReference>
+         </TestableReference>
+      </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">
+      <BuildableProductRunnable
+         runnableDebuggingMode = "0">
+         <BuildableReference
+            BuildableIdentifier = "primary"
+            BlueprintIdentifier = "95C5B2232697752600941585"
+            BuildableName = "Simoleon.app"
+            BlueprintName = "Simoleon"
+            ReferencedContainer = "container:Simoleon.xcodeproj">
+         </BuildableReference>
+      </BuildableProductRunnable>
+      <StoreKitConfigurationFileReference
+         identifier = "../../Configuration.storekit">
+      </StoreKitConfigurationFileReference>
+   </LaunchAction>
+   <ProfileAction
+      buildConfiguration = "Release"
+      shouldUseLaunchSchemeArgsEnv = "YES"
+      savedToolIdentifier = ""
+      useCustomWorkingDirectory = "NO"
+      debugDocumentVersioning = "YES">
+      <BuildableProductRunnable
+         runnableDebuggingMode = "0">
+         <BuildableReference
+            BuildableIdentifier = "primary"
+            BlueprintIdentifier = "95C5B2232697752600941585"
+            BuildableName = "Simoleon.app"
+            BlueprintName = "Simoleon"
+            ReferencedContainer = "container:Simoleon.xcodeproj">
+         </BuildableReference>
+      </BuildableProductRunnable>
+   </ProfileAction>
+   <AnalyzeAction
+      buildConfiguration = "Debug">
+   </AnalyzeAction>
+   <ArchiveAction
+      buildConfiguration = "Release"
+      revealArchiveInOrganizer = "YES">
+   </ArchiveAction>
+</Scheme>
--- a/Simoleon.xcodeproj/xcuserdata/dennis.xcuserdatad/xcschemes/xcschememanagement.plist	Thu Jul 29 10:25:05 2021 +0100
+++ b/Simoleon.xcodeproj/xcuserdata/dennis.xcuserdatad/xcschemes/xcschememanagement.plist	Thu Jul 29 10:51:08 2021 +0100
@@ -25,10 +25,15 @@
 			<key>orderHint</key>
 			<integer>0</integer>
 		</dict>
+		<key>Simoleon - StoreKit Test.xcscheme</key>
+		<dict>
+			<key>orderHint</key>
+			<integer>0</integer>
+		</dict>
 		<key>Simoleon.xcscheme_^#shared#^_</key>
 		<dict>
 			<key>orderHint</key>
-			<integer>0</integer>
+			<integer>1</integer>
 		</dict>
 		<key>SimoleonWatchOS (Complication).xcscheme_^#shared#^_</key>
 		<dict>
--- a/Simoleon/Helpers/CurrencySelector.swift	Thu Jul 29 10:25:05 2021 +0100
+++ b/Simoleon/Helpers/CurrencySelector.swift	Thu Jul 29 10:51:08 2021 +0100
@@ -78,12 +78,6 @@
      * Show subscription paywall
      */
     private func select(_ currencyPair: String) {
-        #if targetEnvironment(simulator)
-        // We're in simulator
-        self.currencyPair = currencyPair
-        showingCurrencySelector = false
-        #else
-        // We're in physical device
         Purchases.shared.purchaserInfo { (purchaserInfo, error) in
             if purchaserInfo?.entitlements["all"]?.isActive == true {
                 self.currencyPair = currencyPair
@@ -98,7 +92,6 @@
                 showingAlert = true
             }
         }
-        #endif
     }
 }
 
--- a/Simoleon/Settings.swift	Thu Jul 29 10:25:05 2021 +0100
+++ b/Simoleon/Settings.swift	Thu Jul 29 10:51:08 2021 +0100
@@ -150,11 +150,6 @@
     
     // Check if user subscription is active
     private func checkEntitlement() {
-        #if targetEnvironment(simulator)
-        // We're in simulator
-        entitlementIsActive = true
-        #else
-        // We're in physical device
         Purchases.shared.purchaserInfo { (purchaserInfo, error) in
             if purchaserInfo?.entitlements["all"]?.isActive == true {
                 entitlementIsActive = true
@@ -168,7 +163,6 @@
                 showingAlert = true
             }
         }
-        #endif
     }
 }
 
Binary file StoreKitTestCertificate.cer has changed