Skip to content

Commit

Permalink
Remove redundant @available annotations
Browse files Browse the repository at this point in the history
Follow up to #3615.
  • Loading branch information
NachoSoto committed Feb 7, 2024
1 parent 1f76bb7 commit f1a0bb1
Show file tree
Hide file tree
Showing 70 changed files with 6 additions and 194 deletions.
1 change: 0 additions & 1 deletion RevenueCatUI/Data/Strings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import RevenueCat

// swiftlint:disable identifier_name

@available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.2, *)
enum Strings {

case package_not_subscription(Package)
Expand Down
1 change: 0 additions & 1 deletion RevenueCatUI/Helpers/ImageLoader.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ protocol URLSessionType {
}

@MainActor
@available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.2, *)
final class ImageLoader: ObservableObject {

enum Error: Swift.Error, Equatable {
Expand Down
1 change: 0 additions & 1 deletion Sources/Attribution/AttributionPoster.swift
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@ final class AttributionPoster {
}
}

@available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.2, *)
var adServicesTokenToPostIfNeeded: String? {
get async {
#if os(tvOS) || os(watchOS)
Expand Down
5 changes: 0 additions & 5 deletions Sources/Diagnostics/FileHandler.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import Foundation

/// A wrapper that allows basic operations on a file, synchronized as an `actor`.
@available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.2, *)
protocol FileHandlerType: Sendable {

/// Returns an async sequence for every line in the file
Expand All @@ -32,7 +31,6 @@ protocol FileHandlerType: Sendable {

}

@available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.2, *)
actor FileHandler: FileHandlerType {

private var fileHandle: FileHandle
Expand Down Expand Up @@ -139,7 +137,6 @@ actor FileHandler: FileHandlerType {

// MARK: - Errors

@available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.2, *)
extension FileHandler {

enum Error: Swift.Error {
Expand All @@ -157,7 +154,6 @@ extension FileHandler {

// MARK: - Private

@available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.2, *)
private extension FileHandler {

func moveToBeginningOfFile() throws {
Expand Down Expand Up @@ -214,7 +210,6 @@ private extension FileHandler {

}

@available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.2, *)
private extension FileHandle {

convenience init(_ url: URL) throws {
Expand Down
4 changes: 0 additions & 4 deletions Sources/FoundationExtensions/AsyncExtensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

import Foundation

@available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.2, *)
internal enum Async {

/// Invokes an `async throws` method and calls `completion` with the result.
Expand Down Expand Up @@ -127,7 +126,6 @@ internal enum Async {
/// }
/// }
/// ```
@available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.2, *)
static func retry<T>(
maximumRetries: Int = 5,
pollInterval: DispatchTimeInterval = .milliseconds(300),
Expand All @@ -152,7 +150,6 @@ internal enum Async {

}

@available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.2, *)
internal extension AsyncSequence {

/// Returns the elements of the asynchronous sequence.
Expand All @@ -164,7 +161,6 @@ internal extension AsyncSequence {

}

@available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.2, *)
internal extension AsyncSequence {

func toAsyncStream() -> AsyncStream<Element> {
Expand Down
4 changes: 0 additions & 4 deletions Sources/FoundationExtensions/Data+Extensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ extension Data {

extension Data {

@available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.2, *)
static func randomNonce() -> Data {
return Data(ChaChaPoly.Nonce())
}
Expand All @@ -88,7 +87,6 @@ extension Data {

// MARK: - Hashing

@available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.2, *)
extension HashFunction {

func toString() -> String {
Expand All @@ -105,13 +103,11 @@ private extension Data {
_ md: UnsafeMutablePointer<UInt8>?
) -> UnsafeMutablePointer<UInt8>?

@available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.2, *)
func hashString<T: HashFunction>(with digest: inout T) -> String {
digest.update(data: self)
return digest.toString()
}

@available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.2, *)
func hash<T: HashFunction>(with digest: inout T) -> Data {
digest.update(data: self)

Expand Down
1 change: 0 additions & 1 deletion Sources/FoundationExtensions/Operators+Extensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ infix operator ???

/// Equivalent to `??` but allows an `async` default value.
/// See https://github.com/apple/swift-evolution/blob/main/proposals/0296-async-await.md#future-directions
@available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.2, *)
func ??? <T>(value: T?, defaultValue: @autoclosure () async throws -> T) async rethrows -> T {
if let value = value {
return value
Expand Down
1 change: 0 additions & 1 deletion Sources/FoundationExtensions/Result+Extensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ extension Result where Success: OptionalType {

}

@available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.2, *)
extension Result where Failure == Swift.Error {

/// Equivalent to `Result.init(catching:)` but with an `async` closure.
Expand Down
2 changes: 0 additions & 2 deletions Sources/Identity/CustomerInfoManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,6 @@ class CustomerInfoManager {
}
}

@available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.2, *)
var customerInfoStream: AsyncStream<CustomerInfo> {
return AsyncStream(bufferingPolicy: .bufferingNewest(1)) { continuation in
if let lastSentCustomerInfo = self.lastSentCustomerInfo {
Expand Down Expand Up @@ -287,7 +286,6 @@ class CustomerInfoManager {

// MARK: - async extensions

@available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.2, *)
extension CustomerInfoManager {

func fetchAndCacheCustomerInfo(appUserID: String, isAppBackgrounded: Bool) async throws -> CustomerInfo {
Expand Down
1 change: 0 additions & 1 deletion Sources/Misc/Concurrency/OperationDispatcher.swift
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ class OperationDispatcher {
}
}

@available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.2, *)
func dispatchOnWorkerThread(delay: Delay = .none, block: @escaping @Sendable () async -> Void) {
Task.detached(priority: .background) {
if delay.hasDelay {
Expand Down
1 change: 0 additions & 1 deletion Sources/Misc/Concurrency/Purchases+async.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import Foundation

/// This extension holds the biolerplate logic to convert methods with completion blocks into async / await syntax.
@available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.2, *)
extension Purchases {

#if !ENABLE_CUSTOM_ENTITLEMENT_COMPUTATION
Expand Down
1 change: 0 additions & 1 deletion Sources/Misc/DateAndTime/TimingUtil.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ internal enum TimingUtil {

// MARK: - async API

@available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.2, *)
extension TimingUtil {

/// Measures the time to execute `work` and returns the result and the duration.
Expand Down
1 change: 0 additions & 1 deletion Sources/Networking/Backend.swift
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@ class Backend {
extension Backend {

/// - Throws: `NetworkError`
@available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.2, *)
func healthRequest(signatureVerification: Bool) async throws {
try await Async.call { completion in
self.internalAPI.healthRequest(signatureVerification: signatureVerification) { error in
Expand Down
1 change: 0 additions & 1 deletion Sources/Networking/HTTPClient/HTTPClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,6 @@ extension HTTPRequest {
}

/// Add a nonce to the request
@available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.2, *)
private mutating func addRandomNonce() {
self.nonce = Data.randomNonce()
}
Expand Down
1 change: 0 additions & 1 deletion Sources/Purchasing/Configuration.swift
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,6 @@ import Foundation
/// ### Related Symbols
/// - ``Configuration/EntitlementVerificationMode``
/// - ``VerificationResult``
@available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.2, *)
@objc public func with(entitlementVerificationMode mode: EntitlementVerificationMode) -> Builder {
self.responseVerificationMode = Signing.verificationMode(with: mode)
return self
Expand Down
1 change: 0 additions & 1 deletion Sources/Purchasing/EntitlementInfo.swift
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,6 @@ extension PeriodType: DefaultValueProvider {
///
/// ### Related Symbols
/// - ``VerificationResult``
@available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.2, *)
@objc public var verification: VerificationResult { self.contents.verification }

// Docs inherited from protocol
Expand Down
1 change: 0 additions & 1 deletion Sources/Purchasing/EntitlementInfos.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ import Foundation
///
/// ### Related Symbols
/// - ``VerificationResult``
@available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.2, *)
@objc public var verification: VerificationResult { return self._verification }

public override var description: String {
Expand Down
1 change: 0 additions & 1 deletion Sources/Purchasing/Purchases/Attribution.swift
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,6 @@ extension Attribution {
self.subscriberAttributesManager.unsyncedAttributesByKey(appUserID: appUserID)
}

@available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.2, *)
var unsyncedAdServicesToken: String? {
get async {
return self.automaticAdServicesAttributionTokenCollection
Expand Down
19 changes: 0 additions & 19 deletions Sources/Purchasing/Purchases/Purchases.swift
Original file line number Diff line number Diff line change
Expand Up @@ -701,7 +701,6 @@ public extension Purchases {
}
}

@available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.2, *)
func offerings() async throws -> Offerings {
return try await self.offerings(fetchPolicy: .default)
}
Expand All @@ -710,7 +709,6 @@ public extension Purchases {
return self.offeringsManager.cachedOfferings
}

@available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.2, *)
internal func offerings(fetchPolicy: OfferingsManager.FetchPolicy) async throws -> Offerings {
return try await self.offeringsAsync(fetchPolicy: fetchPolicy)
}
Expand Down Expand Up @@ -748,7 +746,6 @@ public extension Purchases {
}
}

@available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.2, *)
func logIn(_ appUserID: StaticString) async throws -> (customerInfo: CustomerInfo, created: Bool) {
Logger.warn(Strings.identity.logging_in_with_static_string)

Expand All @@ -759,7 +756,6 @@ public extension Purchases {
// This allows us to provide a compile-time warning to developers who accidentally
// call logIn with hardcoded user ids in their app
@_disfavoredOverload
@available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.2, *)
func logIn(_ appUserID: String) async throws -> (customerInfo: CustomerInfo, created: Bool) {
return try await self.logInAsync(appUserID)
}
Expand All @@ -786,7 +782,6 @@ public extension Purchases {
}
}

@available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.2, *)
func logOut() async throws -> CustomerInfo {
return try await logOutAsync()
}
Expand Down Expand Up @@ -847,12 +842,10 @@ public extension Purchases {
}
}

@available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.2, *)
func customerInfo() async throws -> CustomerInfo {
return try await self.customerInfo(fetchPolicy: .default)
}

@available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.2, *)
func customerInfo(fetchPolicy: CacheFetchPolicy) async throws -> CustomerInfo {
return try await self.customerInfoAsync(fetchPolicy: fetchPolicy)
}
Expand All @@ -863,7 +856,6 @@ public extension Purchases {

#endif

@available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.2, *)
var customerInfoStream: AsyncStream<CustomerInfo> {
return self.customerInfoManager.customerInfoStream
}
Expand All @@ -873,7 +865,6 @@ public extension Purchases {
purchasesOrchestrator.products(withIdentifiers: productIdentifiers, completion: completion)
}

@available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.2, *)
func products(_ productIdentifiers: [String]) async -> [StoreProduct] {
return await productsAsync(productIdentifiers)
}
Expand All @@ -883,7 +874,6 @@ public extension Purchases {
purchasesOrchestrator.purchase(product: product, package: nil, completion: completion)
}

@available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.2, *)
func purchase(product: StoreProduct) async throws -> PurchaseResultData {
return try await purchaseAsync(product: product)
}
Expand All @@ -893,7 +883,6 @@ public extension Purchases {
purchasesOrchestrator.purchase(product: package.storeProduct, package: package, completion: completion)
}

@available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.2, *)
func purchase(package: Package) async throws -> PurchaseResultData {
return try await purchaseAsync(package: package)
}
Expand All @@ -904,7 +893,6 @@ public extension Purchases {
}
}

@available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.2, *)
func restorePurchases() async throws -> CustomerInfo {
return try await self.restorePurchasesAsync()
}
Expand All @@ -921,7 +909,6 @@ public extension Purchases {
}
}

@available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.2, *)
func syncPurchases() async throws -> CustomerInfo {
return try await syncPurchasesAsync()
}
Expand All @@ -937,7 +924,6 @@ public extension Purchases {
completion: completion)
}

@available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.2, *)
func purchase(product: StoreProduct, promotionalOffer: PromotionalOffer) async throws -> PurchaseResultData {
return try await purchaseAsync(product: product, promotionalOffer: promotionalOffer)
}
Expand All @@ -951,7 +937,6 @@ public extension Purchases {
completion: completion)
}

@available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.2, *)
func purchase(package: Package, promotionalOffer: PromotionalOffer) async throws -> PurchaseResultData {
return try await purchaseAsync(package: package, promotionalOffer: promotionalOffer)
}
Expand Down Expand Up @@ -1025,13 +1010,11 @@ public extension Purchases {
}
}

@available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.2, *)
func promotionalOffer(forProductDiscount discount: StoreProductDiscount,
product: StoreProduct) async throws -> PromotionalOffer {
return try await promotionalOfferAsync(forProductDiscount: discount, product: product)
}

@available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.2, *)
func eligiblePromotionalOffers(forProduct product: StoreProduct) async -> [PromotionalOffer] {
return await eligiblePromotionalOffersAsync(forProduct: product)
}
Expand Down Expand Up @@ -1502,7 +1485,6 @@ extension Purchases {

extension Purchases: InternalPurchasesType {

@available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.2, *)
internal func healthRequest(signatureVerification: Bool) async throws {
do {
try await self.backend.healthRequest(signatureVerification: signatureVerification)
Expand Down Expand Up @@ -1546,7 +1528,6 @@ internal extension Purchases {
/// - Returns: the parsed `AppleReceipt`
///
/// - Warning: this is only meant for integration tests, as a way to debug purchase failures.
@available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.2, *)
func fetchReceipt(_ policy: ReceiptRefreshPolicy) async throws -> AppleReceipt? {
let receipt = await self.receiptFetcher.receiptData(refreshPolicy: policy)

Expand Down
1 change: 0 additions & 1 deletion Sources/Purchasing/Purchases/PurchasesOrchestrator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1425,7 +1425,6 @@ private extension PurchasesOrchestrator {

// MARK: - Async extensions

@available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.2, *)
extension PurchasesOrchestrator {

private func handlePurchasedTransaction(
Expand Down
Loading

0 comments on commit f1a0bb1

Please sign in to comment.