diff --git a/.circleci/config.yml b/.circleci/config.yml index a9e4a568e6..962010d88c 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -127,14 +127,14 @@ jobs: storekit_tests: macos: - xcode: "12.5.0" + xcode: "12.5.1" working_directory: ~/purchases-ios shell: /bin/bash --login -o pipefail steps: - checkout - run: name: Open simulator - command: xcrun instruments -w "iPhone 11 Pro (14.2) [" || true + command: xcrun instruments -w "iPhone 11 Pro (14.5) [" || true - install-gems @@ -142,7 +142,7 @@ jobs: name: Run StoreKit Tests command: bundle exec fastlane storekit_tests environment: - SCAN_DEVICE: iPhone 11 Pro (14.2) + SCAN_DEVICE: iPhone 11 Pro (14.5) - store_test_results: path: fastlane/test_output - store_artifacts: diff --git a/Gemfile.lock b/Gemfile.lock index 2f2ede08aa..45d7fbbb92 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -7,7 +7,7 @@ GEM i18n (>= 0.7, < 2) minitest (~> 5.1) tzinfo (~> 1.1) - addressable (2.7.0) + addressable (2.8.0) public_suffix (>= 2.0.2, < 5.0) algoliasearch (1.27.5) httpclient (~> 2.8, >= 2.8.3) @@ -15,20 +15,20 @@ GEM artifactory (3.0.15) atomos (0.1.3) aws-eventstream (1.1.1) - aws-partitions (1.465.0) - aws-sdk-core (3.114.1) + aws-partitions (1.477.0) + aws-sdk-core (3.117.0) aws-eventstream (~> 1, >= 1.0.2) aws-partitions (~> 1, >= 1.239.0) aws-sigv4 (~> 1.1) jmespath (~> 1.0) - aws-sdk-kms (1.43.0) + aws-sdk-kms (1.44.0) aws-sdk-core (~> 3, >= 3.112.0) aws-sigv4 (~> 1.1) - aws-sdk-s3 (1.95.1) + aws-sdk-s3 (1.96.1) aws-sdk-core (~> 3, >= 3.112.0) aws-sdk-kms (~> 1) aws-sigv4 (~> 1.1) - aws-sigv4 (1.2.3) + aws-sigv4 (1.2.4) aws-eventstream (~> 1, >= 1.0.2) babosa (1.0.4) claide (1.0.3) @@ -84,13 +84,15 @@ GEM escape (0.0.4) ethon (0.12.0) ffi (>= 1.3.0) - excon (0.82.0) - faraday (1.4.2) + excon (0.84.0) + faraday (1.5.1) faraday-em_http (~> 1.0) faraday-em_synchrony (~> 1.0) faraday-excon (~> 1.1) + faraday-httpclient (~> 1.0.1) faraday-net_http (~> 1.0) faraday-net_http_persistent (~> 1.1) + faraday-patron (~> 1.0) multipart-post (>= 1.2, < 3) ruby2_keywords (>= 0.0.4) faraday-cookie_jar (0.0.7) @@ -99,12 +101,14 @@ GEM faraday-em_http (1.0.0) faraday-em_synchrony (1.0.0) faraday-excon (1.1.0) + faraday-httpclient (1.0.1) faraday-net_http (1.0.1) - faraday-net_http_persistent (1.1.0) + faraday-net_http_persistent (1.2.0) + faraday-patron (1.0.0) faraday_middleware (1.0.0) faraday (~> 1.0) fastimage (2.2.4) - fastlane (2.184.1) + fastlane (2.187.0) CFPropertyList (>= 2.3, < 4.0.0) addressable (>= 2.3, < 3.0.0) artifactory (~> 3.0) @@ -147,37 +151,36 @@ GEM fourflusher (2.3.1) fuzzy_match (2.0.4) gh_inspector (1.1.3) - google-apis-androidpublisher_v3 (0.5.0) - google-apis-core (~> 0.1) - google-apis-core (0.3.0) + google-apis-androidpublisher_v3 (0.8.0) + google-apis-core (>= 0.4, < 2.a) + google-apis-core (0.4.0) addressable (~> 2.5, >= 2.5.1) - googleauth (~> 0.14) - httpclient (>= 2.8.1, < 3.0) + googleauth (>= 0.16.2, < 2.a) + httpclient (>= 2.8.1, < 3.a) mini_mime (~> 1.0) representable (~> 3.0) - retriable (>= 2.0, < 4.0) + retriable (>= 2.0, < 4.a) rexml - signet (~> 0.14) webrick - google-apis-iamcredentials_v1 (0.4.0) - google-apis-core (~> 0.1) - google-apis-playcustomapp_v1 (0.3.0) - google-apis-core (~> 0.1) - google-apis-storage_v1 (0.4.0) - google-apis-core (~> 0.1) + google-apis-iamcredentials_v1 (0.6.0) + google-apis-core (>= 0.4, < 2.a) + google-apis-playcustomapp_v1 (0.5.0) + google-apis-core (>= 0.4, < 2.a) + google-apis-storage_v1 (0.6.0) + google-apis-core (>= 0.4, < 2.a) google-cloud-core (1.6.0) google-cloud-env (~> 1.0) google-cloud-errors (~> 1.0) google-cloud-env (1.5.0) faraday (>= 0.17.3, < 2.0) google-cloud-errors (1.1.0) - google-cloud-storage (1.31.1) + google-cloud-storage (1.34.1) addressable (~> 2.5) digest-crc (~> 0.4) google-apis-iamcredentials_v1 (~> 0.1) google-apis-storage_v1 (~> 0.1) - google-cloud-core (~> 1.2) - googleauth (~> 0.9) + google-cloud-core (~> 1.6) + googleauth (>= 0.16.2, < 2.a) mini_mime (~> 1.0) googleauth (0.16.2) faraday (>= 0.17.3, < 2.0) @@ -187,7 +190,7 @@ GEM os (>= 0.9, < 2.0) signet (~> 0.14) highline (2.0.3) - http-cookie (1.0.3) + http-cookie (1.0.4) domain_name (~> 0.5) httpclient (2.8.3) i18n (1.8.7) @@ -221,7 +224,7 @@ GEM os (1.1.1) plist (3.6.0) public_suffix (4.0.6) - rake (13.0.3) + rake (13.0.6) redcarpet (3.5.1) representable (3.1.1) declarative (< 0.1.0) @@ -232,7 +235,7 @@ GEM rouge (2.0.7) ruby-macho (1.4.0) ruby2_keywords (0.0.4) - rubyzip (2.3.0) + rubyzip (2.3.2) sassc (2.4.0) ffi (~> 1.9) security (0.1.3) @@ -267,12 +270,13 @@ GEM word_wrap (1.0.0) xcinvoke (0.3.0) liferaft (~> 0.0.6) - xcodeproj (1.19.0) + xcodeproj (1.20.0) CFPropertyList (>= 2.3.3, < 4.0) atomos (~> 0.1.3) claide (>= 1.0.2, < 2.0) colored2 (~> 3.1) nanaimo (~> 0.3.0) + rexml (~> 3.2.4) xcpretty (0.3.0) rouge (~> 2.0.7) xcpretty-travis-formatter (1.0.1) @@ -289,4 +293,4 @@ DEPENDENCIES jazzy BUNDLED WITH - 2.2.14 + 2.2.19 diff --git a/IntegrationTests/PurchaseTester/Configuration.storekit b/IntegrationTests/PurchaseTester/Configuration.storekit index fa129be200..bf6bbecd61 100644 --- a/IntegrationTests/PurchaseTester/Configuration.storekit +++ b/IntegrationTests/PurchaseTester/Configuration.storekit @@ -21,7 +21,7 @@ } ], "settings" : { - + "_timeRate" : 6 }, "subscriptionGroups" : [ { diff --git a/Purchases.xcodeproj/project.pbxproj b/Purchases.xcodeproj/project.pbxproj index 2afc18d413..451593aa09 100644 --- a/Purchases.xcodeproj/project.pbxproj +++ b/Purchases.xcodeproj/project.pbxproj @@ -2081,6 +2081,7 @@ CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CODE_SIGN_STYLE = Automatic; DEVELOPMENT_ASSET_PATHS = "\"StoreKitTestApp/Preview Content\""; + DEVELOPMENT_TEAM = ""; ENABLE_PREVIEWS = YES; INFOPLIST_FILE = StoreKitTestApp/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 14.1; @@ -2108,6 +2109,7 @@ CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CODE_SIGN_STYLE = Automatic; DEVELOPMENT_ASSET_PATHS = "\"StoreKitTestApp/Preview Content\""; + DEVELOPMENT_TEAM = ""; ENABLE_PREVIEWS = YES; INFOPLIST_FILE = StoreKitTestApp/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 14.1; diff --git a/Purchases.xcodeproj/xcshareddata/xcschemes/StoreKitTests.xcscheme b/Purchases.xcodeproj/xcshareddata/xcschemes/StoreKitTests.xcscheme index d0fdf7b868..c6f86c3675 100644 --- a/Purchases.xcodeproj/xcshareddata/xcschemes/StoreKitTests.xcscheme +++ b/Purchases.xcodeproj/xcshareddata/xcschemes/StoreKitTests.xcscheme @@ -29,7 +29,8 @@ shouldUseLaunchSchemeArgsEnv = "YES"> + skipped = "NO" + testExecutionOrdering = "random"> Void)? = nil) { + Purchases.shared.offerings { offerings, error in + expect(error).to(beNil()) + + let offering = offerings?.current + expect(offering).toNot(beNil()) + + let monthlyPackage = offering?.monthly + expect(monthlyPackage).toNot(beNil()) + + Purchases.shared.purchaseProduct(monthlyPackage!.product) { transaction, + purchaserInfo, + purchaseError, + userCancelled in + expect(purchaseError).to(beNil()) + expect(purchaserInfo).toNot(beNil()) + } + + DispatchQueue.main.asyncAfter(deadline: .now() + .seconds(2)) { + Purchases.shared.syncPurchases(completion) + } + } + } + + func configurePurchases() { + purchasesDelegate = TestPurchaseDelegate() + Purchases.configure(withAPIKey: Constants.apiKey, + appUserID: nil, + observerMode: false, + userDefaults: userDefaults) + Purchases.logLevel = .debug + Purchases.shared.delegate = purchasesDelegate + } + + func waitUntilEntitlementsGoThrough() { + expect(self.purchasesDelegate.purchaserInfo?.entitlements.all.count) + .toEventually(equal(1), timeout: .seconds(10)) + } + + func assertNoPurchases(_ purchaserInfo: Purchases.PurchaserInfo?) { + expect(purchaserInfo?.entitlements.all.count) == 0 + } } diff --git a/fastlane/Fastfile b/fastlane/Fastfile index 74de4cf41b..d7a6deacd7 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -140,8 +140,8 @@ platform :ios do replace_in("REVENUECAT_API_KEY", ENV["REVENUECAT_API_KEY"], '../StoreKitTests/Constants.swift') replace_in("REVENUECAT_API_KEY", ENV["REVENUECAT_API_KEY"], '../IntegrationTests/CommonFiles/RCIntegrationRunner.m') - replace_in("REVENUECAT_PROXY_URL", ENV["REVENUECAT_PROXY_URL"].to_s, '../StoreKitTests/Constants.swift') - replace_in("REVENUECAT_PROXY_URL", ENV["REVENUECAT_PROXY_URL"].to_s, '../IntegrationTests/CommonFiles/RCIntegrationRunner.m') + replace_in("REVENUECAT_PROXY_URL", ENV["REVENUECAT_PROXY_URL"].to_s, '../StoreKitTests/Constants.swift', allow_empty: true) + replace_in("REVENUECAT_PROXY_URL", ENV["REVENUECAT_PROXY_URL"].to_s, '../IntegrationTests/CommonFiles/RCIntegrationRunner.m', allow_empty: true) end desc "Deploy" @@ -266,8 +266,8 @@ def attach_changelog_to_master(version_number) } end -def replace_in(previous_text, new_text, path) - if new_text.to_s.strip.empty? +def replace_in(previous_text, new_text, path, allow_empty=false) + if new_text.to_s.strip.empty? and not allow_empty fail "Missing `new_text` in call to `replace_in`, looking for replacement for #{previous_text} 😵." end sed_regex = 's|' + previous_text + '|' + new_text + '|' diff --git a/fastlane/README.md b/fastlane/README.md index 567832fedf..2fa477639d 100644 --- a/fastlane/README.md +++ b/fastlane/README.md @@ -89,6 +89,6 @@ Run StoreKitTests ---- -This README.md is auto-generated and will be re-generated every time [fastlane](https://fastlane.tools) is run. +This README.md is auto-generated and will be re-generated every time [_fastlane_](https://fastlane.tools) is run. More information about fastlane can be found on [fastlane.tools](https://fastlane.tools). The documentation of fastlane can be found on [docs.fastlane.tools](https://docs.fastlane.tools).