mirror of
https://github.com/RevenueCat/purchases-ios
synced 2026-11-11 22:55:55 +05:45
When compiling with Xcode 16, we started throwing a bunch of new warnings. Here's a list and explanation of each: - The most common one was needing to explicitly restate the @unchecked Sendable conformance from a parent class. - There were a couple switches where a new entry was added in tvOS but only for iOS 18, and needed to add it to make it exhaustive. - There we a couple of places where we were adding a protocol conformance to a class from a different module e.g. extension DispatchTimeInterval: Comparable. This is considered unsafe now because the owners of the module could add the conformance later. Solved by removing the conformance which wasn't being used widely in the codebase, only in tests. - Finally there was a class where we were capturing SKRequest and SKProductsRequest instances in a sendable block, but only to either log something, or use them as dictionary key, so I just made the classes Sendable (with the new @retroactice attribute because they belong to a different module)
63 lines
1.8 KiB
Swift
63 lines
1.8 KiB
Swift
//
|
|
// Copyright RevenueCat Inc. All Rights Reserved.
|
|
//
|
|
// Licensed under the MIT License (the "License");
|
|
// you may not use this file except in compliance with the License.
|
|
// You may obtain a copy of the License at
|
|
//
|
|
// https://opensource.org/licenses/MIT
|
|
//
|
|
// MockBeginRefundRequestHelper.swift
|
|
//
|
|
// Created by Madeline Beyl on 10/15/21.
|
|
|
|
import Foundation
|
|
@testable import RevenueCat
|
|
|
|
class MockBeginRefundRequestHelper: BeginRefundRequestHelper {
|
|
|
|
var mockError: Error?
|
|
var mockRefundRequestStatus: RefundRequestStatus?
|
|
|
|
#if os(iOS) || VISION_OS
|
|
@available(iOS 15.0, *)
|
|
@available(macOS, unavailable)
|
|
@available(watchOS, unavailable)
|
|
@available(tvOS, unavailable)
|
|
override func beginRefundRequest(forProduct productID: String) async throws -> RefundRequestStatus {
|
|
if let error = mockError {
|
|
throw error
|
|
} else {
|
|
return mockRefundRequestStatus ?? RefundRequestStatus.success
|
|
}
|
|
}
|
|
|
|
@available(iOS 15.0, *)
|
|
@available(macOS, unavailable)
|
|
@available(watchOS, unavailable)
|
|
@available(tvOS, unavailable)
|
|
override func beginRefundRequest(forEntitlement entitlementID: String) async throws -> RefundRequestStatus {
|
|
if let error = mockError {
|
|
throw error
|
|
} else {
|
|
return mockRefundRequestStatus ?? RefundRequestStatus.success
|
|
}
|
|
}
|
|
|
|
@available(iOS 15.0, *)
|
|
@available(macOS, unavailable)
|
|
@available(watchOS, unavailable)
|
|
@available(tvOS, unavailable)
|
|
override func beginRefundRequestForActiveEntitlement() async throws -> RefundRequestStatus {
|
|
if let error = mockError {
|
|
throw error
|
|
} else {
|
|
return mockRefundRequestStatus ?? RefundRequestStatus.success
|
|
}
|
|
}
|
|
#endif
|
|
|
|
}
|
|
|
|
extension MockBeginRefundRequestHelper: @unchecked Sendable {}
|