Skip to content

Commit

Permalink
Removes the restored result from PurchaseResult
Browse files Browse the repository at this point in the history
- Updates RevenueCat version
- Fixes a sendable warning
  • Loading branch information
yusuftor committed Feb 5, 2025
1 parent 5a1f649 commit 64454fc
Show file tree
Hide file tree
Showing 10 changed files with 18 additions and 18 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

The changelog for `SuperwallKit`. Also see the [releases](https://github.com/superwall/Superwall-iOS/releases) on GitHub.

## 4.0.0-beta.6

### Breaking Changes

- Removes the `restored` result from `PurchaseResult`.

## 4.0.0-beta.5

### Breaking Changes
Expand Down
2 changes: 1 addition & 1 deletion Examples/Advanced/Advanced.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@
repositoryURL = "https://github.com/RevenueCat/purchases-ios.git";
requirement = {
kind = upToNextMajorVersion;
minimumVersion = 5.14.2;
minimumVersion = 5.16.0;
};
};
/* End XCRemoteSwiftPackageReference section */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
"repositoryURL": "https://github.com/RevenueCat/purchases-ios.git",
"state": {
"branch": null,
"revision": "5c413f2ad1888c0bf3910c863c85435fa5e4308d",
"version": "5.14.2"
"revision": "adde1eff5f88403a3527d812fccc26a08c7203fe",
"version": "5.16.0"
}
},
{
Expand Down
2 changes: 1 addition & 1 deletion Sources/SuperwallKit/Misc/Constants.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ let sdkVersion = """
*/

let sdkVersion = """
4.0.0-beta.5
4.0.0-beta.6
"""
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ extension StoreKit.Product.PurchaseResult {
switch verificationResult {
case .unverified(_, let error):
return .failed(error)
case .verified(let transaction):
case .verified:
return .purchased
}
case .userCancelled:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,18 @@ extension Superwall {
.throwableAsync()
}

// Capture only the cancel action because the whole task is non-sendable and gives a warning.
let cancelTask = {
subscriptionStatusTask.cancel()
}

// Create a 5 sec timer. If the subscription status is retrieved it'll
// get cancelled. Otherwise will log a timeout and fail the request.
let timer = Timer(
timeInterval: 5,
repeats: false
) { _ in
subscriptionStatusTask.cancel()
cancelTask()
}
RunLoop.main.add(timer, forMode: .default)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ final class PurchaseControllerObjcAdapter: PurchaseController {
switch result {
case .purchased:
continuation.resume(returning: .purchased)
case .restored:
continuation.resume(returning: .restored)
case .pending:
continuation.resume(returning: .pending)
case .cancelled:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,6 @@ public enum PurchaseResult: Sendable, Equatable {
/// The product was purchased.
case purchased

/// The product was restored.
case restored

/// The purchase is pending and requires action from the developer.
///
/// In StoreKit 1, this is the same as the `.deferred` transaction state.
Expand Down Expand Up @@ -64,7 +61,6 @@ public enum PurchaseResult: Sendable, Equatable {
switch self {
case .cancelled: return .cancelled
case .purchased: return .purchased
case .restored: return .restored
case .pending: return .pending
case .failed: return .failed
}
Expand Down Expand Up @@ -92,9 +88,6 @@ public enum PurchaseResultObjc: Int, Sendable, Equatable {
/// The product was purchased.
case purchased

/// The product was restored.
case restored

/// The purchase is pending and requires action from the developer.
///
/// In StoreKit 1, this is the same as the `.deferred` transaction state.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,6 @@ final class TransactionManager {
switch result {
case .purchased:
await didPurchase()
case .restored:
await didRestore()
case .failed(let error):
let superwallOptions = factory.makeSuperwallOptions()
guard
Expand Down
2 changes: 1 addition & 1 deletion SuperwallKit.podspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Pod::Spec.new do |s|

s.name = "SuperwallKit"
s.version = "4.0.0-beta.5"
s.version = "4.0.0-beta.6"
s.summary = "Superwall: In-App Paywalls Made Easy"
s.description = "Paywall infrastructure for mobile apps :) we make things like editing your paywall and running price tests as easy as clicking a few buttons. superwall.com"

Expand Down

0 comments on commit 64454fc

Please sign in to comment.