Offering/StoreProductType: Sendable conformance#1826
Merged
Conversation
Merged
cc57e12 to
5d98f54
Compare
Offering: Sendable conformanceOffering/StoreProductType Sendable conformance
Offering/StoreProductType Sendable conformanceOffering/StoreProductType: Sendable conformance
09faf10 to
15ab93e
Compare
The type is now immutable, so the compiler ensures it's thread-safe. For [CSDK-379]. Extracted from #1795 to make it easier to review this in isolation.
15ab93e to
6cc5fd5
Compare
Contributor
Author
|
Bump @RevenueCat/core-sdk |
aboedo
approved these changes
Aug 22, 2022
Comment on lines
+131
to
138
| case .lifetime: lifetime = package | ||
| case .annual: annual = package | ||
| case .sixMonth: sixMonth = package | ||
| case .threeMonth: threeMonth = package | ||
| case .twoMonth: twoMonth = package | ||
| case .monthly: monthly = package | ||
| case .weekly: weekly = package | ||
| case .custom where package.storeProduct.productCategory == .nonSubscription: |
Comment on lines
+64
to
+68
| #if swift(<5.7) | ||
| // `SK1ProductDiscount` isn't `Sendable` until iOS 16.0 / Swift 5.7 | ||
| @available(iOS 11.2, macOS 10.13.2, tvOS 11.2, watchOS 6.2, *) | ||
| extension SK1StoreProductDiscount: @unchecked Sendable {} | ||
| #endif |
Member
There was a problem hiding this comment.
I wonder if we should keep all of these in one file. Then again, it's easy to look for swift(<5.7) in one pass whenever we're ready to remove the extra checks
Contributor
Author
There was a problem hiding this comment.
Yeah I can see an argument for both.
Merged
NachoSoto
added a commit
that referenced
this pull request
Aug 31, 2022
Fixes [CSDK-379] and #1041 (comment) [CSDK-379]: https://revenuecats.atlassian.net/browse/CSDK-379?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ ### Main changes: - `Sendable` conformances to all types that are thread-safe - `@unchecked Sendable` for types that the compiler can't enforce, but with documentation as to why - Made classes that aren't mocked `final` (note that this doesn't change the API, because none of these were `open` to begin with) - Made some classes thread-safe that weren't (like `DeviceCache`) For the non-`final` `class`es, I've actually managed to compile the SDK with all of them as `final` and `Sendable`, to make sure that making them `@unchecked Sendable` didn't hide any other issues. ### Future improvements: - https://twitter.com/nachosoto/status/1557139992056500224?s=21&t=arWdvEzTIFANBvwqQ0vPiA - https://twitter.com/nachosoto/status/1557141944777592832?s=21&t=arWdvEzTIFANBvwqQ0vPiA - https://twitter.com/nachosoto/status/1557143374922059776?s=21&t=arWdvEzTIFANBvwqQ0vPiA ### Depends on: - #1794 - #1804 - #1806 - #1807 - #1808 - #1813 - #1822 - #1823 - #1824 - #1825 - #1826
kaushikpaperboat
pushed a commit
to Kiddopia/purchases-ios
that referenced
this pull request
Sep 7, 2022
* rc-4.11.0: (964 commits) Update RevenueCat-Swift.h for version 4.11.0 Version bump for 4.11.0 skip if needed and adds automatic_release (RevenueCat#1870) Fixed crash on `async` SK1 cancelled purchase (RevenueCat#1869) Added `beginRefundRequest` overload with completion block (RevenueCat#1861) Release/4.10.3 (RevenueCat#1867) Update fastlane-plugin-revenuecat_internal and fix release-train job (RevenueCat#1866) fix typo in comment (RevenueCat#1863) Use Dangerfile repository (RevenueCat#1864) `CircleCI`: added job for building SDK with `SPM` (RevenueCat#1860) `TrialOrIntroPriceEligibilityChecker`: return `.noIntroOfferExists` if the product has no introductory offer (RevenueCat#1859) `Lock`: changed default implementation to use `NSLock` (RevenueCat#1819) `Offering: Sendable` conformance (RevenueCat#1826) `ReceiptParser: Sendable` conformance (RevenueCat#1825) `CustomerInfo: Sendable` conformance (RevenueCat#1824) Added `Collection.onlyElement` (RevenueCat#1857) README updates (RevenueCat#1856) `IntegrationTests`: actually fail test if tests aren't configured (RevenueCat#1855) `watchOS`: fixed crash on single-target apps (RevenueCat#1849) Prepare next version: 4.11.0-SNAPSHOT (RevenueCat#1854) ... # Conflicts: # .circleci/config.yml # .jazzy.yaml # .version # CHANGELOG.latest.md # CHANGELOG.md # Gemfile.lock # Package.swift # Purchases/Attribution/RCAttributionFetcher.h # Purchases/Attribution/RCAttributionFetcher.m # Purchases/Attribution/RCAttributionPoster.m # Purchases/Attribution/RCAttributionTypeFactory.h # Purchases/Attribution/RCAttributionTypeFactory.m # Purchases/Caching/RCDeviceCache.m # Purchases/Misc/RCSystemInfo.m # Purchases/Networking/RCBackend.h # Purchases/Networking/RCBackend.m # Purchases/ProtectedExtensions/RCAttributionTypeFactory+Protected.h # Purchases/Public/RCPurchases.h # Purchases/Public/RCPurchases.m # Purchases/Public/RCPurchasesErrorUtils.h # Purchases/Public/RCPurchasesErrorUtils.m # Purchases/Purchasing/RCOfferingsFactory.m # Purchases/Purchasing/RCStoreKitRequestFetcher.h # Purchases/Purchasing/RCStoreKitRequestFetcher.m # Purchases/SubscriberAttributes/RCSubscriberAttributesManager.h # Purchases/SubscriberAttributes/RCSubscriberAttributesManager.m # PurchasesCoreSwift.podspec # PurchasesCoreSwift/Info.plist # PurchasesCoreSwift/Logging/Strings/AttributionStrings.swift # PurchasesCoreSwift/Logging/Strings/IdentityStrings.swift # PurchasesCoreSwift/Logging/Strings/OfferingStrings.swift # PurchasesCoreSwift/Misc/OperationDispatcher.swift # PurchasesCoreSwift/SubscriberAttributes/SpecialSubscriberAttributes.swift # PurchasesTests/Info.plist # PurchasesTests/Mocks/MockAttributionFetcher.swift # PurchasesTests/Mocks/MockAttributionTypeFactory.swift # PurchasesTests/Mocks/MockBackend.swift # PurchasesTests/Mocks/MockOfferingsFactory.swift # PurchasesTests/Mocks/MockRequestFetcher.swift # PurchasesTests/Networking/BackendTests.swift # PurchasesTests/Purchasing/OfferingsTests.swift # PurchasesTests/Purchasing/PurchasesTests.swift # PurchasesTests/SubscriberAttributes/PurchasesSubscriberAttributesTests.swift # RevenueCat.podspec # Sources/Info.plist # Tests/BackendIntegrationTestApp/Info.plist # Tests/BackendIntegrationTests/Info.plist # Tests/InstallationTests/CocoapodsInstallation/Gemfile.lock # Tests/InstallationTests/XcodeDirectInstallation/XcodeDirectInstallation.xcodeproj/project.pbxproj # Tests/UnitTests/Attribution/AttributionTypeFactoryTests.swift # Tests/UnitTests/Info.plist # Tests/UnitTests/Mocks/MockProductsRequest.swift # Tests/UnitTests/Mocks/MockSubscriberAttributesManager.swift # Tests/UnitTests/Purchasing/StoreKitRequestFetcherTests.swift # fastlane/Fastfile
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The type is now immutable, so the compiler ensures it's thread-safe.
For CSDK-379.
Extracted from #1795 to make it easier to review this in isolation.