Skip to content

Commit

Permalink
Fixed a few warnings in Xcode beta 6
Browse files Browse the repository at this point in the history
  • Loading branch information
NachoSoto committed Aug 31, 2022
1 parent be3b3c1 commit b03899a
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 13 deletions.
26 changes: 16 additions & 10 deletions Sources/Purchasing/IntroEligibility.swift
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,27 @@ private extension IntroEligibilityStatus {
/**
Holds the introductory price status
*/
@objc(RCIntroEligibility) public class IntroEligibility: NSObject {
@objc(RCIntroEligibility) public final class IntroEligibility: NSObject {

/**
The introductory price eligibility status
*/
@objc public let status: IntroEligibilityStatus

init(eligibilityStatus status: IntroEligibilityStatus) {
self.status = status
}

@objc private override init() {
self.status = .unknown
}

}

extension IntroEligibility {

public override var description: String {
switch status {
switch self.status {
case .eligible:
return "Eligible for trial or introductory price."
case .ineligible:
Expand All @@ -104,12 +116,6 @@ private extension IntroEligibilityStatus {
}
}

init(eligibilityStatus status: IntroEligibilityStatus) {
self.status = status
}

@objc private override init() {
self.status = .unknown
}

}

extension IntroEligibility: Sendable {}
6 changes: 4 additions & 2 deletions Sources/Purchasing/StoreKitAbstractions/Storefront.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import StoreKit
/// to the user in your app. Storefront information may not be used to develop or enhance a user profile,
/// or track customers for advertising or marketing purposes.
@objc(RCStorefront)
public class Storefront: NSObject, StorefrontType {
public final class Storefront: NSObject, StorefrontType {

private let storefront: StorefrontType

Expand Down Expand Up @@ -69,6 +69,8 @@ public class Storefront: NSObject, StorefrontType {

}

extension Storefront: Sendable {}

public extension Storefront {

@available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.2, macCatalyst 13.1, *)
Expand Down Expand Up @@ -108,7 +110,7 @@ public extension Storefront {
// MARK: -

/// A type containing the location and unique identifier of an Apple App Store storefront.
internal protocol StorefrontType {
internal protocol StorefrontType: Sendable {

/// The three-letter code representing the country or region
/// associated with the App Store storefront.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ class LocalReceiptParserStoreKitTests: StoreKitConfigTestCase {
self.parser = ReceiptParser()
}

@MainActor
func testReceiptParserParsesEmptyReceipt() async throws {
let data = try await XCTAsyncUnwrap(await self.receiptFetcher.receiptData(refreshPolicy: .always))

Expand All @@ -61,7 +62,8 @@ class LocalReceiptParserStoreKitTests: StoreKitConfigTestCase {
let product = try await fetchSk2Product()
_ = try await product.purchase()

let data = try await XCTAsyncUnwrap(await receiptFetcher.receiptData(refreshPolicy: .always))
let receiptData = await self.receiptFetcher.receiptData(refreshPolicy: .always)
let data = try XCTUnwrap(receiptData)

let receipt = try self.parser.parse(from: data)

Expand Down
2 changes: 2 additions & 0 deletions Tests/StoreKitUnitTests/StorefrontTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import XCTest
@available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.2, macCatalyst 13.1, *)
class StorefrontTests: StoreKitConfigTestCase {

@MainActor
@available(iOS 15.0, tvOS 15.0, macOS 12.0, watchOS 8.0, *)
func testCurrentStorefrontSK2() async throws {
try AvailabilityChecks.iOS15APIAvailableOrSkipTest()
Expand All @@ -31,6 +32,7 @@ class StorefrontTests: StoreKitConfigTestCase {

}

@MainActor
func testCurrentStorefrontSK1() async throws {
try AvailabilityChecks.iOS13APIAvailableOrSkipTest()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ extension StoreKitConfigTestCase {
return product
}

@MainActor
func createTransactionWithPurchase() async throws -> Transaction {
let product = try await self.simulateAnyPurchase()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ class TrialOrIntroPriceEligibilityCheckerSK2Tests: StoreKitConfigTestCase {
)
}

@MainActor
@available(iOS 15.0, tvOS 15.0, macOS 12.0, watchOS 8.0, *)
func testSK2CheckEligibilityAsync() async throws {
try AvailabilityChecks.iOS15APIAvailableOrSkipTest()
Expand Down

0 comments on commit b03899a

Please sign in to comment.