Skip to content

Commit

Permalink
Preparing for next version (#312)
Browse files Browse the repository at this point in the history
* Preparing for next version

* Update RCSystemInfo.m

* Update .jazzy.yaml

* Update .jazzy.yaml

* back to 3.6.0-SNAPSHOT

added TPInAppReceipt pod, added logic to get intro eligibility from receipt

finished main logic for intro eligibility

small fixes to retention in closures

replaced pod dependency with embedded classes

added TPInAppReceipt license

clean up on intro eligibility calculator

updated the logic to get products info so that only one SKProductsRequest gets issued

added using the cache in productsManager

cleanup: used DI for the IntroEligibilityCalculator

fixed TPInAppReceipt compatibility with watchOS

added syncing with a queue + support for multiple concurrent requests to product manager

remove api key

specified os version availability for intro calculation in detail

ensured that data can't be nil before sending it to parser

also covered the case where receipt data is not null, but is empty

added missing import

remove pod from podspec

added files for local testing

WIP interpreting bytes from receipt

added parsing of data length, added methods to make parsing individual bits and bit ranges easier

added more generalized code to get asn1 containers

cleanup: moved methods into UInt8 extensinos

more cleanup: moved method into ASN1Container init

made constructor recursive, fixed issues with indexes

more iteration fixes

small cleanup

started unpacking InAppReceiptAttributes

more decoding of attributes

more decoding of attributes

decoded missing attributes

added algorithm for decoding object identifier

started cleanup: moved stuff to a separate class

cleanup, separated objectIdentifierParser

WIP extracting stuff into classes

added methods for easier print debugging

more cleanup

added more (undocummented) fields to in app purchase

moved to using our own solution instead of TPInAppReceipt for intro eligibility

removed TPInAppReceipt

cleanup, renames, removed unused files

separated inAppPurchase into its own class

split extraction logic into several factories

moved to using a single date formatter

method naming clenaup

separated ASN1ObjectIdentifier from factory

small update to use DI for the date formatter

more cleanup: unified duplicated logic to convert from bytes to different value types

renamed file from previous commit

moved more responsibility to the apple receipt factory, simplified the AppleReceipt class

moved logic for querying the apple receipt into the apple receipt class

moved more responsibility to the inAppPurchaseFactory and away from InAppPurchase

removed redundant class LocalReceiptParser

removed all force unwraps and replaced assumptions with more robust error handling and throwing custom exceptions

split code into builders, basic types and utilities

renamed factory -> builder

renamed factory -> builder

renamed Utilities -> Data Converters

removed unused extractableValueType protocols

added UInt8 extensions tests, simplified guard conditions

added tests for ArraySlice<UInt8>+Extensions

added tests for iOS3601 date formatter

renamed ASN1Type -> ASN1Identifier. Added first tests for ASN1ContainerBuilder

added more tests for asn1ContainerBuiler

added tests for short length asn1 containers

fixed rebase issues

cleanup

added tests for container length, added description to ASN1 errors

added more details to error cases, added tests for container length

removed unused property

added more tests for length and internal payload

made internal containers `let` since it's never modified outside of construction.
added tests for asn1ContainerBuilder's building of internal containers

- removed receiptAsData.txt, renamed sample receipt, added tests that compare directly against the sample receipt and serve as integration tests for local receipt parsing.

small cleanup

changed type of ASN1Length.value from UInt -> Int

inApp -> inAppPurchase

purchasedIntroOfferProductIdentifiers -> purchasedIntroOfferOrFreeTrialProductIdentifiers

clean up naming oid -> objectIdentifier

more naming cleanup

WIP adding container factory to make tests easier

added more factory methods

added more logic to be able to compose receipts for testing purposes.

added tests for minimal attributes in the receipt

added more tests for minimal attributes

added test for expires date

cleanup in container factory

added base code to be able to compose in app purchase containers for testing purposes

added tests for minimal attributes in in-app purchases

added tests for optional attributes

adds tests to ensure that in-app purchase build fails if attributes are missing, fixed tests not running for in-app purchase builder.

fixed bug in tests

added ASN.1 object identifier encoding to be able test decoding

added tests for all known object identifiers

added checks for empty and invalid object identifiers

cleanup

added tests to check that in app purchases are correctly added to the receipt

simplified ASN1ObjectIdentifierBuilder logic

fixed rebase issues

added some tests for ReceiptParser

renamed the methods in container factory removing the redundant build prefix

added remaining tests for ReceiptParser

moved containerFactory into TestHelpers

cleanup in IntroEligibilityCalculator, added class for tests

replaced classes with mocks

added more tests

updated intro eligibility calculator swift name so name lookup works correctly in tests

updated Swift name for other internal swift classes so we won't run into lookup issues with them

added test to check that only one SKProducts call is issued

added tests to check that eligibility is calculated correctly

removed redundant file SKProduct+TestExtensions, replaced with mockSKProduct

extracted mockProductsRequest into separate file for reuse

added more tests

added final tests for productsManager

fixed rebase issue

added link to docs for object identifiers

added link to apple docs for apple receipt fields

cleanup: extracted method to build internal containers

added docs and extracted method for variable length quantity decoder

added a couple of comments
  • Loading branch information
vegaro authored and aboedo committed Aug 26, 2020
1 parent 9a068ab commit 5a5faa1
Show file tree
Hide file tree
Showing 55 changed files with 3,665 additions and 147 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@ CarthageUploads
fastlane/report.xml
fastlane/test_output/
CHANGELOG.latest.md

builds/
builds/
Pods/
Original file line number Diff line number Diff line change
Expand Up @@ -55,16 +55,18 @@
debugServiceExtension = "internal"
allowLocationSimulation = "YES"
notificationPayloadFile = "WatchExample Extension/PushNotificationPayload.apns">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<RemoteRunnable
runnableDebuggingMode = "2"
BundleIdentifier = "com.apple.Carousel"
RemotePath = "/SwiftExample">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "2D54BF602437DED800FF4EE4"
BuildableName = "WatchExample.app"
BlueprintName = "WatchExample"
ReferencedContainer = "container:SwiftExample.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</RemoteRunnable>
<StoreKitConfigurationFileReference
identifier = "../Configuration.storekit">
</StoreKitConfigurationFileReference>
Expand All @@ -75,16 +77,27 @@
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<RemoteRunnable
runnableDebuggingMode = "2"
BundleIdentifier = "com.apple.Carousel"
RemotePath = "/SwiftExample">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "2D54BF602437DED800FF4EE4"
BuildableName = "WatchExample.app"
BlueprintName = "WatchExample"
ReferencedContainer = "container:SwiftExample.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</RemoteRunnable>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "2D54BF602437DED800FF4EE4"
BuildableName = "WatchExample.app"
BlueprintName = "WatchExample"
ReferencedContainer = "container:SwiftExample.xcodeproj">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,33 +55,46 @@
debugServiceExtension = "internal"
allowLocationSimulation = "YES"
notificationPayloadFile = "WatchExample Extension/PushNotificationPayload.apns">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<RemoteRunnable
runnableDebuggingMode = "2"
BundleIdentifier = "com.apple.Carousel"
RemotePath = "/SwiftExample">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "2D54BF602437DED800FF4EE4"
BuildableName = "WatchExample.app"
BlueprintName = "WatchExample"
ReferencedContainer = "container:SwiftExample.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</RemoteRunnable>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<RemoteRunnable
runnableDebuggingMode = "2"
BundleIdentifier = "com.apple.Carousel"
RemotePath = "/SwiftExample">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "2D54BF602437DED800FF4EE4"
BuildableName = "WatchExample.app"
BlueprintName = "WatchExample"
ReferencedContainer = "container:SwiftExample.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</RemoteRunnable>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "2D54BF602437DED800FF4EE4"
BuildableName = "WatchExample.app"
BlueprintName = "WatchExample"
ReferencedContainer = "container:SwiftExample.xcodeproj">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
Expand Down
4 changes: 4 additions & 0 deletions Examples/SwiftExample/SwiftExample/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ class AppDelegate: UIResponder, UIApplicationDelegate {

// we're requesting push notifications on app start only to showcase how to set the push token in RevenueCat
requestPushNotificationsPermissions()

Purchases.shared.checkTrialOrIntroductoryPriceEligibility(["com.revenuecat.monthly_4.99.1_week_intro"]) { introEligibilityDict in
print(introEligibilityDict)
}

return true
}
Expand Down
Loading

0 comments on commit 5a5faa1

Please sign in to comment.