From a7c3bb9032c332b05f8eb37b50bfec0f8147b46c Mon Sep 17 00:00:00 2001 From: Nikita Vasilev Date: Mon, 22 Dec 2025 22:33:04 +0400 Subject: [PATCH 1/6] chore: bumpd dependencies --- Package.swift | 2 +- Package@swift-5.10.swift | 6 +++--- Package@swift-6.0.swift | 6 +++--- Package@swift-6.1.swift | 6 +++--- Sources/Flare/Classes/Common/Logger.swift | 2 +- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Package.swift b/Package.swift index d1a972338..e7061d19e 100644 --- a/Package.swift +++ b/Package.swift @@ -23,7 +23,7 @@ let package = Package( dependencies: [ .package(url: "https://github.com/space-code/concurrency.git", exact: "0.3.1"), .package(url: "https://github.com/apple/swift-docc-plugin", exact: "1.4.5"), - .package(url: "https://github.com/space-code/log.git", exact: "1.2.0"), + .package(url: "https://github.com/space-code/log.git", exact: "1.3.0"), .package(url: "https://github.com/space-code/atomic.git", exact: "1.1.1"), .package( url: "https://github.com/pointfreeco/swift-snapshot-testing", diff --git a/Package@swift-5.10.swift b/Package@swift-5.10.swift index 9842c79a8..3f0106b5b 100644 --- a/Package@swift-5.10.swift +++ b/Package@swift-5.10.swift @@ -21,10 +21,10 @@ let package = Package( .library(name: "FlareUI", targets: ["FlareUI"]), ], dependencies: [ - .package(url: "https://github.com/space-code/concurrency.git", exact: "0.1.0"), - .package(url: "https://github.com/apple/swift-docc-plugin", exact: "1.3.0"), + .package(url: "https://github.com/space-code/concurrency.git", exact: "0.3.1"), + .package(url: "https://github.com/apple/swift-docc-plugin", exact: "1.4.5"), .package(url: "https://github.com/space-code/log.git", exact: "1.2.0"), - .package(url: "https://github.com/space-code/atomic.git", exact: "1.1.0"), + .package(url: "https://github.com/space-code/atomic.git", exact: "1.1.1"), .package( url: "https://github.com/pointfreeco/swift-snapshot-testing", exact: "1.15.3" diff --git a/Package@swift-6.0.swift b/Package@swift-6.0.swift index 68f0ba44e..5cf4fa1a5 100644 --- a/Package@swift-6.0.swift +++ b/Package@swift-6.0.swift @@ -21,10 +21,10 @@ let package = Package( .library(name: "FlareUI", targets: ["FlareUI"]), ], dependencies: [ - .package(url: "https://github.com/space-code/concurrency.git", exact: "0.2.0"), - .package(url: "https://github.com/apple/swift-docc-plugin", exact: "1.4.3"), + .package(url: "https://github.com/space-code/concurrency.git", exact: "0.3.1"), + .package(url: "https://github.com/apple/swift-docc-plugin", exact: "1.4.5"), .package(url: "https://github.com/space-code/log.git", exact: "1.2.0"), - .package(url: "https://github.com/space-code/atomic.git", exact: "1.1.0"), + .package(url: "https://github.com/space-code/atomic.git", exact: "1.1.1"), .package( url: "https://github.com/pointfreeco/swift-snapshot-testing", exact: "1.18.4" diff --git a/Package@swift-6.1.swift b/Package@swift-6.1.swift index c6e53268c..6d1c0d3ea 100644 --- a/Package@swift-6.1.swift +++ b/Package@swift-6.1.swift @@ -21,10 +21,10 @@ let package = Package( .library(name: "FlareUI", targets: ["FlareUI"]), ], dependencies: [ - .package(url: "https://github.com/space-code/concurrency.git", exact: "0.2.0"), - .package(url: "https://github.com/apple/swift-docc-plugin", exact: "1.4.3"), + .package(url: "https://github.com/space-code/concurrency.git", exact: "0.3.1"), + .package(url: "https://github.com/apple/swift-docc-plugin", exact: "1.4.5"), .package(url: "https://github.com/space-code/log.git", exact: "1.2.0"), - .package(url: "https://github.com/space-code/atomic.git", exact: "1.1.0"), + .package(url: "https://github.com/space-code/atomic.git", exact: "1.1.1"), .package( url: "https://github.com/pointfreeco/swift-snapshot-testing", exact: "1.18.4" diff --git a/Sources/Flare/Classes/Common/Logger.swift b/Sources/Flare/Classes/Common/Logger.swift index 63c315e56..c0f437e43 100644 --- a/Sources/Flare/Classes/Common/Logger.swift +++ b/Sources/Flare/Classes/Common/Logger.swift @@ -46,7 +46,7 @@ enum Logger { static var logLevel: LogLevel { get { Self.default.logLevel } - set { Self.default.logLevel = newValue } + set { Self.default.updateLogLevel { _ in newValue } } } // MARK: Static Public Methods From 5d6f6773671114c87df5195d94cc885964cc177b Mon Sep 17 00:00:00 2001 From: Nikita Vasilev Date: Fri, 13 Feb 2026 21:40:27 +0400 Subject: [PATCH 2/6] chore: update ci configuration --- .github/workflows/flare-ui.yml | 6 ++---- .github/workflows/flare.yml | 5 ++--- Package@swift-5.10.swift | 2 +- Package@swift-6.0.swift | 2 +- Package@swift-6.1.swift | 2 +- Sources/Flare/Classes/Flare.swift | 6 ++++-- .../Helpers/PaymentQueue/PaymentQueue.swift | 2 +- .../Helpers/ScenesHolder/IScenesHolder.swift | 4 +++- .../Classes/Models/Internal/ProductsRequest.swift | 4 +++- .../Models/Internal/SK1StoreProductDiscount.swift | 2 +- .../Classes/Models/Internal/SK2RenewalInfo.swift | 6 ------ .../Internal/SK2SubscriptionInfoStatus.swift | 6 ------ Sources/Flare/Classes/Models/RenewalInfo.swift | 6 ------ Sources/Flare/Classes/Models/StoreProduct.swift | 4 +++- .../Flare/Classes/Models/SubscriptionInfo.swift | 6 ------ .../Classes/Models/SubscriptionInfoStatus.swift | 6 ------ .../CachingProductsProviderDecorator.swift | 3 +-- .../ProductProvider/ProductProvider.swift | 4 ++-- .../ReceiptRefreshProvider.swift | 3 +-- .../IRefundRequestProvider.swift | 14 +++++++------- .../SystemInfoProvider/ISystemInfoProvider.swift | 4 +++- .../Assemblies/StoreButtonsAssemblyKey.swift | 4 +++- .../EnvironmentKey/PoliciesButtonStyleKey.swift | 4 +++- .../Core/EnvironmentKey/ProductStyleKey.swift | 4 +++- .../Core/EnvironmentKey/StoreButtonKey.swift | 4 +++- .../SubscriptionControlStyleKey.swift | 4 +++- .../SubscriptionMarketingContentKey.swift | 4 +++- .../SubscriptionPrivacyPolicyDestinationKey.swift | 4 +++- .../SubscriptionStoreButtonLabelKey.swift | 4 +++- .../SubscriptionTermsOfServiceDestinationKey.swift | 4 +++- .../Classes/Core/EnvironmentKey/TintColorKey.swift | 4 +++- Sources/FlareUI/Classes/FlareUI.swift | 6 ++++-- Sources/FlareUI/Classes/Generated/Colors.swift | 2 +- Sources/FlareUI/Classes/Generated/Media.swift | 2 +- .../SubscriptionPriceViewModelFactory.swift | 4 +--- .../Views/ProductView/ProductPurchaseService.swift | 2 +- .../Views/StoreButtonView/StoreButtonView.swift | 1 - Tests/FlareTests/UnitTests/FlareTests.swift | 2 +- .../UnitTests/Providers/IAPProviderTests.swift | 4 ++-- .../UnitTests/Providers/RefundProviderTests.swift | 10 +++++----- .../Providers/SystemInfoProviderTests.swift | 2 +- .../TestHelpers/Extensions/XCTestCase+.swift | 3 +-- .../UnitTests/Helpers/XCTestCase+.swift | 3 +-- .../Product/ProductPresenterTests.swift | 4 ++-- .../Helpers/Extensions/XCTestCase+.swift | 3 +-- .../Tests/EligibilityProviderTests.swift | 4 ++-- Tests/IntegrationTests/Tests/FlareTests.swift | 2 +- 47 files changed, 91 insertions(+), 100 deletions(-) diff --git a/.github/workflows/flare-ui.yml b/.github/workflows/flare-ui.yml index b6c6a4d23..1efd4ab1d 100644 --- a/.github/workflows/flare-ui.yml +++ b/.github/workflows/flare-ui.yml @@ -41,23 +41,21 @@ jobs: - { platform: macOS, name: "macOS 26, Xcode 26.0, Swift 6.2.0", xcode: "Xcode_26.0", runsOn: macOS-26, destination: "platform=macOS", testPlan: "FlareUIUnitTests" } - { platform: macOS, name: "macOS 14, Xcode 16.0, Swift 6.0.2", xcode: "Xcode_16.1", runsOn: macOS-14, destination: "platform=macOS", testPlan: "FlareUIUnitTests"} - { platform: macOS, name: "macOS 14, Xcode 15.4, Swift 5.10", xcode: "Xcode_15.4", runsOn: macOS-14, destination: "platform=macOS", testPlan: "FlareUIUnitTests" } - - { platform: macOS, name: "macOS 14, Xcode 15.2, Swift 5.9.2", xcode: "Xcode_15.2", runsOn: macOS-14, destination: "platform=macOS", testPlan: "FlareUIUnitTests" } # iOS - { platform: iOS, name: "iOS 26.0", xcode: "Xcode_26.0.1", runsOn: macOS-26, destination: "OS=26.0.1,name=iPhone 17 Pro", testPlan: "FlareUIUnitTests" } - { platform: iOS, name: "iOS 18.1", xcode: "Xcode_16.1", runsOn: macOS-14, destination: "OS=18.1,name=iPhone 16 Pro", testPlan: "FlareUIUnitTests" } - - { platform: iOS, name: "iOS 17.2", xcode: "Xcode_15.2", runsOn: macOS-14, destination: "OS=17.2,name=iPhone 15 Pro", testPlan: "FlareUIUnitTests" } + - { platform: iOS, name: "iOS 17.4", xcode: "Xcode_15.4", runsOn: macOS-14, destination: "OS=17.4,name=iPhone 15 Pro", testPlan: "FlareUIUnitTests" } # tvOS - { platform: tvOS, name: "tvOS 26.0", xcode: "Xcode_26.0.1", runsOn: macOS-26, destination: "OS=26.0,name=Apple TV", testPlan: "FlareUIUnitTests" } - { platform: tvOS, name: "tvOS 18.1", xcode: "Xcode_16.1", runsOn: macOS-14, destination: "OS=18.1,name=Apple TV", testPlan: "FlareUIUnitTests" } - - { platform: tvOS, name: "tvOS 17.2", xcode: "Xcode_15.2", runsOn: macOS-14, destination: "OS=17.2,name=Apple TV", testPlan: "FlareUIUnitTests" } + - { platform: tvOS, name: "tvOS 17.4", xcode: "Xcode_15.4", runsOn: macOS-14, destination: "OS=17.4,name=Apple TV", testPlan: "FlareUIUnitTests" } # watchOS - { platform: watchOS, name: "watchOS 26.0", xcode: "Xcode_26.0.1", runsOn: macOS-26, destination: "OS=26.0,name=Apple Watch Ultra 3 (49mm)", testPlan: "FlareUIUnitTests" } - { platform: watchOS, name: "watchOS 11.1", xcode: "Xcode_16.1", runsOn: macOS-14, destination: "OS=11.1,name=Apple Watch Series 10 (46mm)", testPlan: "FlareUIUnitTests" } - { platform: watchOS, name: "watchOS 10.5", xcode: "Xcode_15.3", runsOn: macOS-14, destination: "OS=10.5,name=Apple Watch Series 9 (45mm)", testPlan: "FlareUIUnitTests" } - - { platform: watchOS, name: "watchOS 10.2", xcode: "Xcode_15.2", runsOn: macOS-14, destination: "OS=10.2,name=Apple Watch Series 9 (45mm)", testPlan: "FlareUIUnitTests" } steps: - name: Checkout code uses: actions/checkout@v6 diff --git a/.github/workflows/flare.yml b/.github/workflows/flare.yml index 2a6487a9c..779db4c4f 100644 --- a/.github/workflows/flare.yml +++ b/.github/workflows/flare.yml @@ -44,18 +44,17 @@ jobs: # iOS - { platform: iOS, name: "iOS 26.0, Xcode 26.0, Swift 6.2.0", xcode: "Xcode_26.0.1", runsOn: macOS-26, destination: "OS=26.0.1,name=iPhone 17 Pro", testPlan: "AllTests" } - { platform: iOS, name: "iOS 18.1", xcode: "Xcode_16.1", runsOn: macOS-14, destination: "OS=18.1,name=iPhone 16 Pro", testPlan: "AllTests" } - - { platform: iOS, name: "iOS 17.2", xcode: "Xcode_15.2", runsOn: macOS-14, destination: "OS=17.2,name=iPhone 15 Pro", testPlan: "AllTests" } + - { platform: iOS, name: "iOS 17.4", xcode: "Xcode_15.4", runsOn: macOS-14, destination: "OS=17.4,name=iPhone 15 Pro", testPlan: "AllTests" } # tvOS - { platform: tvOS, name: "tvOS 26.0", xcode: "Xcode_26.0.1", runsOn: macOS-26, destination: "OS=26.0,name=Apple TV", testPlan: "AllTests" } - { platform: tvOS, name: "tvOS 18.1", xcode: "Xcode_16.1", runsOn: macOS-14, destination: "OS=18.1,name=Apple TV", testPlan: "AllTests" } - - { platform: tvOS, name: "tvOS 17.2", xcode: "Xcode_15.2", runsOn: macOS-14, destination: "OS=17.2,name=Apple TV", testPlan: "AllTests" } + - { platform: tvOS, name: "tvOS 17.4", xcode: "Xcode_15.4", runsOn: macOS-14, destination: "OS=17.4,name=Apple TV", testPlan: "AllTests" } # watchOS - { platform: watchOS, name: "watchOS 26.0", xcode: "Xcode_26.0.1", runsOn: macOS-26, destination: "OS=26.0,name=Apple Watch Ultra 3 (49mm)", testPlan: "UnitTests" } - { platform: watchOS, name: "watchOS 11.1", xcode: "Xcode_16.1", runsOn: macOS-14, destination: "OS=11.1,name=Apple Watch Series 10 (46mm)", testPlan: "UnitTests" } - { platform: watchOS, name: "watchOS 10.5", xcode: "Xcode_15.3", runsOn: macOS-14, destination: "OS=10.5,name=Apple Watch Series 9 (45mm)", testPlan: "UnitTests" } - - { platform: watchOS, name: "watchOS 10.2", xcode: "Xcode_15.2", runsOn: macOS-14, destination: "OS=10.2,name=Apple Watch Series 9 (45mm)", testPlan: "UnitTests" } steps: - name: Checkout code uses: actions/checkout@v6 diff --git a/Package@swift-5.10.swift b/Package@swift-5.10.swift index 3f0106b5b..923ea928d 100644 --- a/Package@swift-5.10.swift +++ b/Package@swift-5.10.swift @@ -23,7 +23,7 @@ let package = Package( dependencies: [ .package(url: "https://github.com/space-code/concurrency.git", exact: "0.3.1"), .package(url: "https://github.com/apple/swift-docc-plugin", exact: "1.4.5"), - .package(url: "https://github.com/space-code/log.git", exact: "1.2.0"), + .package(url: "https://github.com/space-code/log.git", exact: "1.3.0"), .package(url: "https://github.com/space-code/atomic.git", exact: "1.1.1"), .package( url: "https://github.com/pointfreeco/swift-snapshot-testing", diff --git a/Package@swift-6.0.swift b/Package@swift-6.0.swift index 5cf4fa1a5..04c762551 100644 --- a/Package@swift-6.0.swift +++ b/Package@swift-6.0.swift @@ -23,7 +23,7 @@ let package = Package( dependencies: [ .package(url: "https://github.com/space-code/concurrency.git", exact: "0.3.1"), .package(url: "https://github.com/apple/swift-docc-plugin", exact: "1.4.5"), - .package(url: "https://github.com/space-code/log.git", exact: "1.2.0"), + .package(url: "https://github.com/space-code/log.git", exact: "1.3.0"), .package(url: "https://github.com/space-code/atomic.git", exact: "1.1.1"), .package( url: "https://github.com/pointfreeco/swift-snapshot-testing", diff --git a/Package@swift-6.1.swift b/Package@swift-6.1.swift index 6d1c0d3ea..f8172071b 100644 --- a/Package@swift-6.1.swift +++ b/Package@swift-6.1.swift @@ -23,7 +23,7 @@ let package = Package( dependencies: [ .package(url: "https://github.com/space-code/concurrency.git", exact: "0.3.1"), .package(url: "https://github.com/apple/swift-docc-plugin", exact: "1.4.5"), - .package(url: "https://github.com/space-code/log.git", exact: "1.2.0"), + .package(url: "https://github.com/space-code/log.git", exact: "1.3.0"), .package(url: "https://github.com/space-code/atomic.git", exact: "1.1.1"), .package( url: "https://github.com/pointfreeco/swift-snapshot-testing", diff --git a/Sources/Flare/Classes/Flare.swift b/Sources/Flare/Classes/Flare.swift index c766018f6..12fba348b 100644 --- a/Sources/Flare/Classes/Flare.swift +++ b/Sources/Flare/Classes/Flare.swift @@ -22,7 +22,7 @@ public final class Flare { /// The configuration provider. private let configurationProvider: IConfigurationProvider - /// The singleton instance. + // The singleton instance. #if swift(>=6.0) private nonisolated(unsafe) static let flare: Flare = .init() #else @@ -30,7 +30,9 @@ public final class Flare { #endif /// Returns a shared `Flare` object. - public static var shared: IFlare { flare } + public static var shared: IFlare { + flare + } /// The log level. public var logLevel: LogLevel { diff --git a/Sources/Flare/Classes/Helpers/PaymentQueue/PaymentQueue.swift b/Sources/Flare/Classes/Helpers/PaymentQueue/PaymentQueue.swift index 06ed0e847..723d0845f 100644 --- a/Sources/Flare/Classes/Helpers/PaymentQueue/PaymentQueue.swift +++ b/Sources/Flare/Classes/Helpers/PaymentQueue/PaymentQueue.swift @@ -39,7 +39,7 @@ public protocol PaymentQueue: AnyObject, Sendable { func finishTransaction(_ transaction: SKPaymentTransaction) #if os(iOS) || VISION_OS - // Call this method to have StoreKit present a sheet enabling the user to redeem codes provided by your app. + /// Call this method to have StoreKit present a sheet enabling the user to redeem codes provided by your app. @available(iOS 14.0, *) func presentCodeRedemptionSheet() #endif diff --git a/Sources/Flare/Classes/Helpers/ScenesHolder/IScenesHolder.swift b/Sources/Flare/Classes/Helpers/ScenesHolder/IScenesHolder.swift index 2df88d73a..101fad332 100644 --- a/Sources/Flare/Classes/Helpers/ScenesHolder/IScenesHolder.swift +++ b/Sources/Flare/Classes/Helpers/ScenesHolder/IScenesHolder.swift @@ -14,6 +14,8 @@ protocol IScenesHolder: Sendable { #if os(iOS) || VISION_OS /// The scenes that are connected to the app. - var connectedScenes: Set { get } + var connectedScenes: Set { + get + } #endif } diff --git a/Sources/Flare/Classes/Models/Internal/ProductsRequest.swift b/Sources/Flare/Classes/Models/Internal/ProductsRequest.swift index 21be0b315..b2e791061 100644 --- a/Sources/Flare/Classes/Models/Internal/ProductsRequest.swift +++ b/Sources/Flare/Classes/Models/Internal/ProductsRequest.swift @@ -14,7 +14,9 @@ final class ProductsRequest: ISKRequest { private let request: SKRequest /// The request’s identifier. - var id: String { request.id } + var id: String { + request.id + } // MARK: Initialization diff --git a/Sources/Flare/Classes/Models/Internal/SK1StoreProductDiscount.swift b/Sources/Flare/Classes/Models/Internal/SK1StoreProductDiscount.swift index 952c25188..effe197a5 100644 --- a/Sources/Flare/Classes/Models/Internal/SK1StoreProductDiscount.swift +++ b/Sources/Flare/Classes/Models/Internal/SK1StoreProductDiscount.swift @@ -60,7 +60,7 @@ struct SK1StoreProductDiscount: IStoreProductDiscount { numberOfPeriods = productDiscount.numberOfPeriods type = discountType - /// The price formatter. + // The price formatter. let numberFormatter: NumberFormatter = .numberFormatter(with: self.productDiscount.priceLocale) localizedPriceString = numberFormatter.string(from: self.productDiscount.price) } diff --git a/Sources/Flare/Classes/Models/Internal/SK2RenewalInfo.swift b/Sources/Flare/Classes/Models/Internal/SK2RenewalInfo.swift index 6074fc233..197c1dc86 100644 --- a/Sources/Flare/Classes/Models/Internal/SK2RenewalInfo.swift +++ b/Sources/Flare/Classes/Models/Internal/SK2RenewalInfo.swift @@ -12,12 +12,6 @@ struct SK2RenewalInfo { // MARK: Properties let underlyingRenewalInfo: Product.SubscriptionInfo.RenewalInfo - - // MARK: Initialization - - init(underlyingRenewalInfo: Product.SubscriptionInfo.RenewalInfo) { - self.underlyingRenewalInfo = underlyingRenewalInfo - } } // MARK: IRenewalInfo diff --git a/Sources/Flare/Classes/Models/Internal/SK2SubscriptionInfoStatus.swift b/Sources/Flare/Classes/Models/Internal/SK2SubscriptionInfoStatus.swift index b438ba9c6..9e8a8bd42 100644 --- a/Sources/Flare/Classes/Models/Internal/SK2SubscriptionInfoStatus.swift +++ b/Sources/Flare/Classes/Models/Internal/SK2SubscriptionInfoStatus.swift @@ -12,12 +12,6 @@ struct SK2SubscriptionInfoStatus { // MARK: Properties let underlyingStatus: Product.SubscriptionInfo.Status - - // MARK: Initialization - - init(underlyingStatus: Product.SubscriptionInfo.Status) { - self.underlyingStatus = underlyingStatus - } } // MARK: ISubscriptionInfoStatus diff --git a/Sources/Flare/Classes/Models/RenewalInfo.swift b/Sources/Flare/Classes/Models/RenewalInfo.swift index ea0596aba..698d200e7 100644 --- a/Sources/Flare/Classes/Models/RenewalInfo.swift +++ b/Sources/Flare/Classes/Models/RenewalInfo.swift @@ -11,12 +11,6 @@ public struct RenewalInfo { // MARK: Properties let underlyingRenewalInfo: IRenewalInfo - - // MARK: Initialization - - init(underlyingRenewalInfo: IRenewalInfo) { - self.underlyingRenewalInfo = underlyingRenewalInfo - } } // MARK: - Initialization diff --git a/Sources/Flare/Classes/Models/StoreProduct.swift b/Sources/Flare/Classes/Models/StoreProduct.swift index fb3a59da4..1c98fda46 100644 --- a/Sources/Flare/Classes/Models/StoreProduct.swift +++ b/Sources/Flare/Classes/Models/StoreProduct.swift @@ -16,7 +16,9 @@ public final class StoreProduct: NSObject { let product: ISKProduct /// The store kit product. - var underlyingProduct: ISKProduct { product } + var underlyingProduct: ISKProduct { + product + } // MARK: Initialization diff --git a/Sources/Flare/Classes/Models/SubscriptionInfo.swift b/Sources/Flare/Classes/Models/SubscriptionInfo.swift index 8feb456f1..b4b6fdf06 100644 --- a/Sources/Flare/Classes/Models/SubscriptionInfo.swift +++ b/Sources/Flare/Classes/Models/SubscriptionInfo.swift @@ -11,12 +11,6 @@ public struct SubscriptionInfo { // MARK: Properties let underlyingSubscriptionInfo: ISubscriptionInfo - - // MARK: Initialization - - init(underlyingSubscriptionInfo: ISubscriptionInfo) { - self.underlyingSubscriptionInfo = underlyingSubscriptionInfo - } } // MARK: - Initializators diff --git a/Sources/Flare/Classes/Models/SubscriptionInfoStatus.swift b/Sources/Flare/Classes/Models/SubscriptionInfoStatus.swift index 4e8650def..e43fa605e 100644 --- a/Sources/Flare/Classes/Models/SubscriptionInfoStatus.swift +++ b/Sources/Flare/Classes/Models/SubscriptionInfoStatus.swift @@ -11,12 +11,6 @@ public struct SubscriptionInfoStatus { // MARK: Properties let underlyingStatus: ISubscriptionInfoStatus - - // MARK: Initialization - - init(underlyingStatus: ISubscriptionInfoStatus) { - self.underlyingStatus = underlyingStatus - } } // MARK: ISubscriptionInfoStatus diff --git a/Sources/Flare/Classes/Providers/ProductProvider/Decorators/CachingProductsProviderDecorator/CachingProductsProviderDecorator.swift b/Sources/Flare/Classes/Providers/ProductProvider/Decorators/CachingProductsProviderDecorator/CachingProductsProviderDecorator.swift index 03225eb60..e5e5c9d50 100644 --- a/Sources/Flare/Classes/Providers/ProductProvider/Decorators/CachingProductsProviderDecorator/CachingProductsProviderDecorator.swift +++ b/Sources/Flare/Classes/Providers/ProductProvider/Decorators/CachingProductsProviderDecorator/CachingProductsProviderDecorator.swift @@ -47,8 +47,7 @@ final class CachingProductsProviderDecorator { /// /// - Returns: A dictionary containing cached products for the specified IDs. private func cachedProducts(ids: some Collection) -> [String: StoreProduct] { - let cachedProducts = _cache.wrappedValue.filter { ids.contains($0.key) } - return cachedProducts + _cache.wrappedValue.filter { ids.contains($0.key) } } /// Checks the cache for specified product IDs and fetches missing products from the product provider. diff --git a/Sources/Flare/Classes/Providers/ProductProvider/ProductProvider.swift b/Sources/Flare/Classes/Providers/ProductProvider/ProductProvider.swift index 306cf0580..0d738b988 100644 --- a/Sources/Flare/Classes/Providers/ProductProvider/ProductProvider.swift +++ b/Sources/Flare/Classes/Providers/ProductProvider/ProductProvider.swift @@ -138,8 +138,8 @@ extension ProductProvider: SKProductsRequestDelegate { // MARK: @unchecked Sendable -// @unchecked because: -// - It has mutable state, but it's made thread-safe through `queue`. +/// @unchecked because: +/// - It has mutable state, but it's made thread-safe through `queue`. extension ProductProvider: @unchecked Sendable {} // MARK: - Helpers diff --git a/Sources/Flare/Classes/Providers/ReceiptRefreshProvider/ReceiptRefreshProvider.swift b/Sources/Flare/Classes/Providers/ReceiptRefreshProvider/ReceiptRefreshProvider.swift index 93b60b522..36d6f36d8 100644 --- a/Sources/Flare/Classes/Providers/ReceiptRefreshProvider/ReceiptRefreshProvider.swift +++ b/Sources/Flare/Classes/Providers/ReceiptRefreshProvider/ReceiptRefreshProvider.swift @@ -57,8 +57,7 @@ final class ReceiptRefreshProvider: NSObject, @unchecked Sendable { fileManager.fileExists(atPath: appStoreReceiptURL.path) { let receiptData = try? Data(contentsOf: appStoreReceiptURL, options: .alwaysMapped) - let receiptString = receiptData?.base64EncodedString(options: []) - return receiptString + return receiptData?.base64EncodedString(options: []) } return nil } diff --git a/Sources/Flare/Classes/Providers/RefundRequestProvider/IRefundRequestProvider.swift b/Sources/Flare/Classes/Providers/RefundRequestProvider/IRefundRequestProvider.swift index 87b84c2d2..e23059a1c 100644 --- a/Sources/Flare/Classes/Providers/RefundRequestProvider/IRefundRequestProvider.swift +++ b/Sources/Flare/Classes/Providers/RefundRequestProvider/IRefundRequestProvider.swift @@ -14,13 +14,13 @@ import StoreKit /// A type can create a refund request. protocol IRefundRequestProvider { - /// Present the refund request sheet for the specified transaction in a window scene. - /// - /// - Parameters: - /// - transactionID: The identifier of the transaction the user is requesting a refund for. - /// - windowScene: The UIWindowScene that the system displays the sheet on. - /// - /// - Returns: The result of the refund request. + // Present the refund request sheet for the specified transaction in a window scene. + // + // - Parameters: + // - transactionID: The identifier of the transaction the user is requesting a refund for. + // - windowScene: The UIWindowScene that the system displays the sheet on. + // + // - Returns: The result of the refund request. #if os(iOS) || VISION_OS @available(iOS 15.0, *) @available(macOS, unavailable) diff --git a/Sources/Flare/Classes/Providers/SystemInfoProvider/ISystemInfoProvider.swift b/Sources/Flare/Classes/Providers/SystemInfoProvider/ISystemInfoProvider.swift index 85a588e59..5615bf4c3 100644 --- a/Sources/Flare/Classes/Providers/SystemInfoProvider/ISystemInfoProvider.swift +++ b/Sources/Flare/Classes/Providers/SystemInfoProvider/ISystemInfoProvider.swift @@ -14,6 +14,8 @@ protocol ISystemInfoProvider: Sendable { #if os(iOS) || VISION_OS /// The current window scene. @MainActor - var currentScene: UIWindowScene { get async throws } + var currentScene: UIWindowScene { + get async throws + } #endif } diff --git a/Sources/FlareUI/Classes/Core/EnvironmentKey/Assemblies/StoreButtonsAssemblyKey.swift b/Sources/FlareUI/Classes/Core/EnvironmentKey/Assemblies/StoreButtonsAssemblyKey.swift index 0aab8641d..a3a237eda 100644 --- a/Sources/FlareUI/Classes/Core/EnvironmentKey/Assemblies/StoreButtonsAssemblyKey.swift +++ b/Sources/FlareUI/Classes/Core/EnvironmentKey/Assemblies/StoreButtonsAssemblyKey.swift @@ -8,7 +8,9 @@ import SwiftUI // MARK: - StoreButtonsAssemblyKey private struct StoreButtonsAssemblyKey: EnvironmentKey { - static var defaultValue: IStoreButtonsAssembly? { nil } + static var defaultValue: IStoreButtonsAssembly? { + nil + } } extension EnvironmentValues { diff --git a/Sources/FlareUI/Classes/Core/EnvironmentKey/PoliciesButtonStyleKey.swift b/Sources/FlareUI/Classes/Core/EnvironmentKey/PoliciesButtonStyleKey.swift index 49763b778..f1facd3b7 100644 --- a/Sources/FlareUI/Classes/Core/EnvironmentKey/PoliciesButtonStyleKey.swift +++ b/Sources/FlareUI/Classes/Core/EnvironmentKey/PoliciesButtonStyleKey.swift @@ -9,7 +9,9 @@ import SwiftUI @available(watchOS, unavailable) private struct PoliciesButtonStyleKey: EnvironmentKey { - static var defaultValue: AnyPoliciesButtonStyle { .init(style: AutomaticPoliciesButtonStyle()) } + static var defaultValue: AnyPoliciesButtonStyle { + .init(style: AutomaticPoliciesButtonStyle()) + } } @available(watchOS, unavailable) diff --git a/Sources/FlareUI/Classes/Core/EnvironmentKey/ProductStyleKey.swift b/Sources/FlareUI/Classes/Core/EnvironmentKey/ProductStyleKey.swift index 4b5637923..655faa852 100644 --- a/Sources/FlareUI/Classes/Core/EnvironmentKey/ProductStyleKey.swift +++ b/Sources/FlareUI/Classes/Core/EnvironmentKey/ProductStyleKey.swift @@ -8,7 +8,9 @@ import SwiftUI // MARK: - ProductStyleKey private struct ProductStyleKey: EnvironmentKey { - static var defaultValue: AnyProductStyle { AnyProductStyle(style: CompactProductStyle()) } + static var defaultValue: AnyProductStyle { + AnyProductStyle(style: CompactProductStyle()) + } } extension EnvironmentValues { diff --git a/Sources/FlareUI/Classes/Core/EnvironmentKey/StoreButtonKey.swift b/Sources/FlareUI/Classes/Core/EnvironmentKey/StoreButtonKey.swift index aa904940f..dfb24027b 100644 --- a/Sources/FlareUI/Classes/Core/EnvironmentKey/StoreButtonKey.swift +++ b/Sources/FlareUI/Classes/Core/EnvironmentKey/StoreButtonKey.swift @@ -8,7 +8,9 @@ import SwiftUI // MARK: - StoreButtonKey private struct StoreButtonKey: EnvironmentKey { - static var defaultValue: [StoreButtonType] { [] } + static var defaultValue: [StoreButtonType] { + [] + } } extension EnvironmentValues { diff --git a/Sources/FlareUI/Classes/Core/EnvironmentKey/SubscriptionControlStyleKey.swift b/Sources/FlareUI/Classes/Core/EnvironmentKey/SubscriptionControlStyleKey.swift index 483009e55..f271fdeb0 100644 --- a/Sources/FlareUI/Classes/Core/EnvironmentKey/SubscriptionControlStyleKey.swift +++ b/Sources/FlareUI/Classes/Core/EnvironmentKey/SubscriptionControlStyleKey.swift @@ -9,7 +9,9 @@ import SwiftUI @available(watchOS, unavailable) private struct SubscriptionControlStyleKey: EnvironmentKey { - static var defaultValue: AnySubscriptionControlStyle { .init(style: .automatic) } + static var defaultValue: AnySubscriptionControlStyle { + .init(style: .automatic) + } } @available(watchOS, unavailable) diff --git a/Sources/FlareUI/Classes/Core/EnvironmentKey/SubscriptionMarketingContentKey.swift b/Sources/FlareUI/Classes/Core/EnvironmentKey/SubscriptionMarketingContentKey.swift index 3035b1426..3218f33da 100644 --- a/Sources/FlareUI/Classes/Core/EnvironmentKey/SubscriptionMarketingContentKey.swift +++ b/Sources/FlareUI/Classes/Core/EnvironmentKey/SubscriptionMarketingContentKey.swift @@ -8,7 +8,9 @@ import SwiftUI // MARK: - SubscriptionMarketingContentKey private struct SubscriptionMarketingContentKey: EnvironmentKey { - static var defaultValue: AnyView? { nil } + static var defaultValue: AnyView? { + nil + } } extension EnvironmentValues { diff --git a/Sources/FlareUI/Classes/Core/EnvironmentKey/SubscriptionPrivacyPolicyDestinationKey.swift b/Sources/FlareUI/Classes/Core/EnvironmentKey/SubscriptionPrivacyPolicyDestinationKey.swift index 724a0892c..7826706b1 100644 --- a/Sources/FlareUI/Classes/Core/EnvironmentKey/SubscriptionPrivacyPolicyDestinationKey.swift +++ b/Sources/FlareUI/Classes/Core/EnvironmentKey/SubscriptionPrivacyPolicyDestinationKey.swift @@ -8,7 +8,9 @@ import SwiftUI // MARK: - SubscriptionPrivacyPolicyDestinationKey private struct SubscriptionPrivacyPolicyDestinationKey: EnvironmentKey { - static var defaultValue: AnyView? { nil } + static var defaultValue: AnyView? { + nil + } } extension EnvironmentValues { diff --git a/Sources/FlareUI/Classes/Core/EnvironmentKey/SubscriptionStoreButtonLabelKey.swift b/Sources/FlareUI/Classes/Core/EnvironmentKey/SubscriptionStoreButtonLabelKey.swift index b34fd6d32..4b7f98f97 100644 --- a/Sources/FlareUI/Classes/Core/EnvironmentKey/SubscriptionStoreButtonLabelKey.swift +++ b/Sources/FlareUI/Classes/Core/EnvironmentKey/SubscriptionStoreButtonLabelKey.swift @@ -8,7 +8,9 @@ import SwiftUI // MARK: - SubscriptionStoreButtonLabelKey private struct SubscriptionStoreButtonLabelKey: EnvironmentKey { - static var defaultValue: SubscriptionStoreButtonLabel { .action } + static var defaultValue: SubscriptionStoreButtonLabel { + .action + } } extension EnvironmentValues { diff --git a/Sources/FlareUI/Classes/Core/EnvironmentKey/SubscriptionTermsOfServiceDestinationKey.swift b/Sources/FlareUI/Classes/Core/EnvironmentKey/SubscriptionTermsOfServiceDestinationKey.swift index 06b09ea58..50f1f3ad4 100644 --- a/Sources/FlareUI/Classes/Core/EnvironmentKey/SubscriptionTermsOfServiceDestinationKey.swift +++ b/Sources/FlareUI/Classes/Core/EnvironmentKey/SubscriptionTermsOfServiceDestinationKey.swift @@ -8,7 +8,9 @@ import SwiftUI // MARK: - SubscriptionTermsOfServiceDestinationKey private struct SubscriptionTermsOfServiceDestinationKey: EnvironmentKey { - static var defaultValue: AnyView? { nil } + static var defaultValue: AnyView? { + nil + } } extension EnvironmentValues { diff --git a/Sources/FlareUI/Classes/Core/EnvironmentKey/TintColorKey.swift b/Sources/FlareUI/Classes/Core/EnvironmentKey/TintColorKey.swift index 78ea7a444..0760098b4 100644 --- a/Sources/FlareUI/Classes/Core/EnvironmentKey/TintColorKey.swift +++ b/Sources/FlareUI/Classes/Core/EnvironmentKey/TintColorKey.swift @@ -8,7 +8,9 @@ import SwiftUI // MARK: - TintColorKey private struct TintColorKey: EnvironmentKey { - static var defaultValue: Color { .blue } + static var defaultValue: Color { + .blue + } } extension EnvironmentValues { diff --git a/Sources/FlareUI/Classes/FlareUI.swift b/Sources/FlareUI/Classes/FlareUI.swift index a1bd238d1..af8bad962 100644 --- a/Sources/FlareUI/Classes/FlareUI.swift +++ b/Sources/FlareUI/Classes/FlareUI.swift @@ -15,14 +15,16 @@ public final class FlareUI: IFlareUI { /// The configuration provider for FlareUI. private let configurationProvider: IConfigurationProvider - /// The singleton instance. + // The singleton instance. #if swift(>=6.0) private nonisolated(unsafe) static let flareUI: FlareUI = .init() #else private static let flareUI: FlareUI = .init() #endif /// Returns a shared `Flare` object. - public static var shared: IFlareUI { flareUI } + public static var shared: IFlareUI { + flareUI + } // MARK: Initialization diff --git a/Sources/FlareUI/Classes/Generated/Colors.swift b/Sources/FlareUI/Classes/Generated/Colors.swift index 838299b94..ec4ca5737 100644 --- a/Sources/FlareUI/Classes/Generated/Colors.swift +++ b/Sources/FlareUI/Classes/Generated/Colors.swift @@ -17,7 +17,7 @@ import SwiftUI #endif -// Deprecated typealiases +/// Deprecated typealiases @available(*, deprecated, renamed: "ColorAsset.Color", message: "This typealias will be removed in SwiftGen 7.0") typealias AssetColorTypeAlias = ColorAsset.Color diff --git a/Sources/FlareUI/Classes/Generated/Media.swift b/Sources/FlareUI/Classes/Generated/Media.swift index 7601b42b9..138d72475 100644 --- a/Sources/FlareUI/Classes/Generated/Media.swift +++ b/Sources/FlareUI/Classes/Generated/Media.swift @@ -17,7 +17,7 @@ import SwiftUI #endif -// Deprecated typealiases +/// Deprecated typealiases @available(*, deprecated, renamed: "ImageAsset.Image", message: "This typealias will be removed in SwiftGen 7.0") typealias AssetImageTypeAlias = ImageAsset.Image diff --git a/Sources/FlareUI/Classes/Presentation/Components/Factories/SubscriptionPriceViewModelFactory.swift b/Sources/FlareUI/Classes/Presentation/Components/Factories/SubscriptionPriceViewModelFactory.swift index 314ba3060..0eaeafac5 100644 --- a/Sources/FlareUI/Classes/Presentation/Components/Factories/SubscriptionPriceViewModelFactory.swift +++ b/Sources/FlareUI/Classes/Presentation/Components/Factories/SubscriptionPriceViewModelFactory.swift @@ -45,9 +45,7 @@ final class SubscriptionPriceViewModelFactory: ISubscriptionPriceViewModelFactor dateFormatter.allowedUnits = [unit] let dateComponents = subscriptionDateComponentsFactory.dateComponents(for: period) - let localizedPeriod = dateFormatter.string(from: dateComponents) - - return localizedPeriod + return dateFormatter.string(from: dateComponents) } // MARK: Private diff --git a/Sources/FlareUI/Classes/Presentation/Views/ProductView/ProductPurchaseService.swift b/Sources/FlareUI/Classes/Presentation/Views/ProductView/ProductPurchaseService.swift index 49a70c248..8a433cafa 100644 --- a/Sources/FlareUI/Classes/Presentation/Views/ProductView/ProductPurchaseService.swift +++ b/Sources/FlareUI/Classes/Presentation/Views/ProductView/ProductPurchaseService.swift @@ -31,7 +31,7 @@ actor ProductPurchaseService: IProductPurchaseService { // MARK: Properties - /// The in-app purchase service. + // The in-app purchase service. #if swift(>=6.0) private nonisolated(unsafe) var iap: IFlare #else diff --git a/Sources/FlareUI/Classes/Presentation/Views/StoreButtonView/StoreButtonView.swift b/Sources/FlareUI/Classes/Presentation/Views/StoreButtonView/StoreButtonView.swift index 6e06319b7..9268d033d 100644 --- a/Sources/FlareUI/Classes/Presentation/Views/StoreButtonView/StoreButtonView.swift +++ b/Sources/FlareUI/Classes/Presentation/Views/StoreButtonView/StoreButtonView.swift @@ -30,7 +30,6 @@ struct StoreButtonView: View, IViewWrapper { // MARK: Private - @ViewBuilder private var contentView: some View { Button(action: { Task { diff --git a/Tests/FlareTests/UnitTests/FlareTests.swift b/Tests/FlareTests/UnitTests/FlareTests.swift index d7352c629..e5a391f89 100644 --- a/Tests/FlareTests/UnitTests/FlareTests.swift +++ b/Tests/FlareTests/UnitTests/FlareTests.swift @@ -205,7 +205,7 @@ class FlareTests: XCTestCase { XCTAssertEqual(receipt, .receipt) } - func test_thatFlareDoesNotFetchReceiptAsync_whenRequestFailed() async throws { + func test_thatFlareDoesNotFetchReceiptAsync_whenRequestFailed() async { // given iapProviderMock.stubbedRefreshReceiptAsyncResult = .failure(.paymentNotAllowed) diff --git a/Tests/FlareTests/UnitTests/Providers/IAPProviderTests.swift b/Tests/FlareTests/UnitTests/Providers/IAPProviderTests.swift index 2d2bad682..164a976c6 100644 --- a/Tests/FlareTests/UnitTests/Providers/IAPProviderTests.swift +++ b/Tests/FlareTests/UnitTests/Providers/IAPProviderTests.swift @@ -73,7 +73,7 @@ class IAPProviderTests: XCTestCase { XCTAssertTrue(!parameters.requestID.isEmpty) } - func test_thatIAPProviderPurchasesProduct() throws { + func test_thatIAPProviderPurchasesProduct() { // when sut.purchase(product: .fake(productIdentifier: .productID), completion: { _ in }) @@ -246,7 +246,7 @@ class IAPProviderTests: XCTestCase { XCTAssertEqual(receipt, .receipt) } - func test_thatIAPProviderDoesNotRefreshReceipt_whenReceiptIsNil() async throws { + func test_thatIAPProviderDoesNotRefreshReceipt_whenReceiptIsNil() async { // given receiptRefreshProviderMock.stubbedReceipt = nil receiptRefreshProviderMock.stubbedRefreshResult = .success(()) diff --git a/Tests/FlareTests/UnitTests/Providers/RefundProviderTests.swift b/Tests/FlareTests/UnitTests/Providers/RefundProviderTests.swift index 542537c29..6abc4cc6b 100644 --- a/Tests/FlareTests/UnitTests/Providers/RefundProviderTests.swift +++ b/Tests/FlareTests/UnitTests/Providers/RefundProviderTests.swift @@ -101,11 +101,11 @@ // MARK: - Constants -// -// private extension UInt64 { -// static let transactionID: UInt64 = 5 -// } -// + /// + /// private extension UInt64 { + /// static let transactionID: UInt64 = 5 + /// } + /// private extension String { static let productID: String = "product_id" } diff --git a/Tests/FlareTests/UnitTests/Providers/SystemInfoProviderTests.swift b/Tests/FlareTests/UnitTests/Providers/SystemInfoProviderTests.swift index cd9e670f1..b04cd85b7 100644 --- a/Tests/FlareTests/UnitTests/Providers/SystemInfoProviderTests.swift +++ b/Tests/FlareTests/UnitTests/Providers/SystemInfoProviderTests.swift @@ -52,7 +52,7 @@ // XCTAssertEqual(windowScene, scene) // } - func test_thatScenesHolderThrowsAnErrorWhenThereIsNoActiveWindowScene() async throws { + func test_thatScenesHolderThrowsAnErrorWhenThereIsNoActiveWindowScene() async { // when let error: Error? = await self.error(for: { try await sut.currentScene }) diff --git a/Tests/FlareTests/UnitTests/TestHelpers/Extensions/XCTestCase+.swift b/Tests/FlareTests/UnitTests/TestHelpers/Extensions/XCTestCase+.swift index 31004f60d..5e8a16537 100644 --- a/Tests/FlareTests/UnitTests/TestHelpers/Extensions/XCTestCase+.swift +++ b/Tests/FlareTests/UnitTests/TestHelpers/Extensions/XCTestCase+.swift @@ -8,8 +8,7 @@ import XCTest extension XCTestCase { func value(for closure: () async throws -> U) async -> U? { do { - let value = try await closure() - return value + return try await closure() } catch { return nil } diff --git a/Tests/FlareUITests/UnitTests/Helpers/XCTestCase+.swift b/Tests/FlareUITests/UnitTests/Helpers/XCTestCase+.swift index 31004f60d..5e8a16537 100644 --- a/Tests/FlareUITests/UnitTests/Helpers/XCTestCase+.swift +++ b/Tests/FlareUITests/UnitTests/Helpers/XCTestCase+.swift @@ -8,8 +8,7 @@ import XCTest extension XCTestCase { func value(for closure: () async throws -> U) async -> U? { do { - let value = try await closure() - return value + return try await closure() } catch { return nil } diff --git a/Tests/FlareUITests/UnitTests/Presentation/Product/ProductPresenterTests.swift b/Tests/FlareUITests/UnitTests/Presentation/Product/ProductPresenterTests.swift index 3cf6091b1..55f750086 100644 --- a/Tests/FlareUITests/UnitTests/Presentation/Product/ProductPresenterTests.swift +++ b/Tests/FlareUITests/UnitTests/Presentation/Product/ProductPresenterTests.swift @@ -42,7 +42,7 @@ final class ProductPresenterTests: XCTestCase { // MARK: Tests - func test_thatPresenterFetchesProduct_whenViewDidLoad() async { + func test_thatPresenterFetchesProduct_whenViewDidLoad() { // given let productFake = StoreProduct.fake() productFetcherMock.stubbedProduct = productFake @@ -54,7 +54,7 @@ final class ProductPresenterTests: XCTestCase { wait(self.viewModelMock.model.state == .product(productFake)) } - func test_thatPresenterDisplaysAnError_whenViewDidLoad() async { + func test_thatPresenterDisplaysAnError_whenViewDidLoad() { // given productFetcherMock.stubbedThrowProduct = IAPError.unknown diff --git a/Tests/IntegrationTests/Helpers/Extensions/XCTestCase+.swift b/Tests/IntegrationTests/Helpers/Extensions/XCTestCase+.swift index 31004f60d..5e8a16537 100644 --- a/Tests/IntegrationTests/Helpers/Extensions/XCTestCase+.swift +++ b/Tests/IntegrationTests/Helpers/Extensions/XCTestCase+.swift @@ -8,8 +8,7 @@ import XCTest extension XCTestCase { func value(for closure: () async throws -> U) async -> U? { do { - let value = try await closure() - return value + return try await closure() } catch { return nil } diff --git a/Tests/IntegrationTests/Tests/EligibilityProviderTests.swift b/Tests/IntegrationTests/Tests/EligibilityProviderTests.swift index ec7e48152..dffb47b9d 100644 --- a/Tests/IntegrationTests/Tests/EligibilityProviderTests.swift +++ b/Tests/IntegrationTests/Tests/EligibilityProviderTests.swift @@ -28,7 +28,7 @@ final class EligibilityProviderTests: StoreSessionTestCase { func test_thatProviderReturnsNoOffer_whenProductDoesNotHaveIntroductoryOffer() async throws { // given - let product = try await ProductProviderHelper.subscriptionsWithoutOffers.randomElement()! + let product = try try await XCTUnwrap(ProductProviderHelper.subscriptionsWithoutOffers.randomElement()) // when let result = try await sut.checkEligibility(products: [StoreProduct(product: product)]) @@ -39,7 +39,7 @@ final class EligibilityProviderTests: StoreSessionTestCase { func test_thatProviderReturnsEligible_whenProductHasIntroductoryOffer() async throws { // given - let product = try await ProductProviderHelper.subscriptionsWithIntroductoryOffer.randomElement()! + let product = try try await XCTUnwrap(ProductProviderHelper.subscriptionsWithIntroductoryOffer.randomElement()) // when let result = try await sut.checkEligibility(products: [StoreProduct(product: product)]) diff --git a/Tests/IntegrationTests/Tests/FlareTests.swift b/Tests/IntegrationTests/Tests/FlareTests.swift index 1fc5b9b87..b6258f671 100644 --- a/Tests/IntegrationTests/Tests/FlareTests.swift +++ b/Tests/IntegrationTests/Tests/FlareTests.swift @@ -85,7 +85,7 @@ final class FlareTests: StoreSessionTestCase { @available(iOS 15.2, tvOS 15.2, macOS 12.1, watchOS 8.3, *) func test_thatPurchaseIntorudctoryOffer() async throws { // 1. Fetch a product - let product = try await ProductProviderHelper.subscriptionsWithIntroductoryOffer.randomElement()! + let product = try try await XCTUnwrap(ProductProviderHelper.subscriptionsWithIntroductoryOffer.randomElement()) let storeProduct = StoreProduct(product: product) // 2. Checking eligibility for a product From 48f8ea131d144915462e1b5bf5083c8ace0e8c08 Mon Sep 17 00:00:00 2001 From: Nikita Vasilev Date: Fri, 13 Feb 2026 21:48:07 +0400 Subject: [PATCH 3/6] chore: fix tests --- Tests/IntegrationTests/Tests/EligibilityProviderTests.swift | 4 ++-- Tests/IntegrationTests/Tests/FlareTests.swift | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Tests/IntegrationTests/Tests/EligibilityProviderTests.swift b/Tests/IntegrationTests/Tests/EligibilityProviderTests.swift index dffb47b9d..65d105277 100644 --- a/Tests/IntegrationTests/Tests/EligibilityProviderTests.swift +++ b/Tests/IntegrationTests/Tests/EligibilityProviderTests.swift @@ -28,7 +28,7 @@ final class EligibilityProviderTests: StoreSessionTestCase { func test_thatProviderReturnsNoOffer_whenProductDoesNotHaveIntroductoryOffer() async throws { // given - let product = try try await XCTUnwrap(ProductProviderHelper.subscriptionsWithoutOffers.randomElement()) + let product = try await XCTUnwrap(ProductProviderHelper.subscriptionsWithoutOffers.randomElement()) // when let result = try await sut.checkEligibility(products: [StoreProduct(product: product)]) @@ -39,7 +39,7 @@ final class EligibilityProviderTests: StoreSessionTestCase { func test_thatProviderReturnsEligible_whenProductHasIntroductoryOffer() async throws { // given - let product = try try await XCTUnwrap(ProductProviderHelper.subscriptionsWithIntroductoryOffer.randomElement()) + let product = try await XCTUnwrap(ProductProviderHelper.subscriptionsWithIntroductoryOffer.randomElement()) // when let result = try await sut.checkEligibility(products: [StoreProduct(product: product)]) diff --git a/Tests/IntegrationTests/Tests/FlareTests.swift b/Tests/IntegrationTests/Tests/FlareTests.swift index b6258f671..d0910d973 100644 --- a/Tests/IntegrationTests/Tests/FlareTests.swift +++ b/Tests/IntegrationTests/Tests/FlareTests.swift @@ -85,7 +85,7 @@ final class FlareTests: StoreSessionTestCase { @available(iOS 15.2, tvOS 15.2, macOS 12.1, watchOS 8.3, *) func test_thatPurchaseIntorudctoryOffer() async throws { // 1. Fetch a product - let product = try try await XCTUnwrap(ProductProviderHelper.subscriptionsWithIntroductoryOffer.randomElement()) + let product = try await XCTUnwrap(ProductProviderHelper.subscriptionsWithIntroductoryOffer.randomElement()) let storeProduct = StoreProduct(product: product) // 2. Checking eligibility for a product From ebb782630d91184b731951a37594f6b484ed9305 Mon Sep 17 00:00:00 2001 From: Nikita Vasilev Date: Fri, 13 Feb 2026 21:52:01 +0400 Subject: [PATCH 4/6] chore: fix unit tests --- Tests/IntegrationTests/Tests/EligibilityProviderTests.swift | 4 ++-- Tests/IntegrationTests/Tests/FlareTests.swift | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Tests/IntegrationTests/Tests/EligibilityProviderTests.swift b/Tests/IntegrationTests/Tests/EligibilityProviderTests.swift index 65d105277..2d38a6a05 100644 --- a/Tests/IntegrationTests/Tests/EligibilityProviderTests.swift +++ b/Tests/IntegrationTests/Tests/EligibilityProviderTests.swift @@ -28,7 +28,7 @@ final class EligibilityProviderTests: StoreSessionTestCase { func test_thatProviderReturnsNoOffer_whenProductDoesNotHaveIntroductoryOffer() async throws { // given - let product = try await XCTUnwrap(ProductProviderHelper.subscriptionsWithoutOffers.randomElement()) + let product = try XCTUnwrap(ProductProviderHelper.subscriptionsWithoutOffers.randomElement()) // when let result = try await sut.checkEligibility(products: [StoreProduct(product: product)]) @@ -39,7 +39,7 @@ final class EligibilityProviderTests: StoreSessionTestCase { func test_thatProviderReturnsEligible_whenProductHasIntroductoryOffer() async throws { // given - let product = try await XCTUnwrap(ProductProviderHelper.subscriptionsWithIntroductoryOffer.randomElement()) + let product = try XCTUnwrap(ProductProviderHelper.subscriptionsWithIntroductoryOffer.randomElement()) // when let result = try await sut.checkEligibility(products: [StoreProduct(product: product)]) diff --git a/Tests/IntegrationTests/Tests/FlareTests.swift b/Tests/IntegrationTests/Tests/FlareTests.swift index d0910d973..ce9b7e1f9 100644 --- a/Tests/IntegrationTests/Tests/FlareTests.swift +++ b/Tests/IntegrationTests/Tests/FlareTests.swift @@ -85,7 +85,7 @@ final class FlareTests: StoreSessionTestCase { @available(iOS 15.2, tvOS 15.2, macOS 12.1, watchOS 8.3, *) func test_thatPurchaseIntorudctoryOffer() async throws { // 1. Fetch a product - let product = try await XCTUnwrap(ProductProviderHelper.subscriptionsWithIntroductoryOffer.randomElement()) + let product = try XCTUnwrap(ProductProviderHelper.subscriptionsWithIntroductoryOffer.randomElement()) let storeProduct = StoreProduct(product: product) // 2. Checking eligibility for a product From a8bc0fda65265ea30eae2380a89c04fb1dd42bc6 Mon Sep 17 00:00:00 2001 From: Nikita Vasilev Date: Fri, 13 Feb 2026 22:06:20 +0400 Subject: [PATCH 5/6] chore: fix unit tests --- .../Providers/PurchaseProvider/PurchaseProvider.swift | 2 +- Tests/IntegrationTests/Tests/EligibilityProviderTests.swift | 6 ++++-- Tests/IntegrationTests/Tests/FlareTests.swift | 3 ++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Sources/Flare/Classes/Providers/PurchaseProvider/PurchaseProvider.swift b/Sources/Flare/Classes/Providers/PurchaseProvider/PurchaseProvider.swift index 5c47ea540..c1cd279d2 100644 --- a/Sources/Flare/Classes/Providers/PurchaseProvider/PurchaseProvider.swift +++ b/Sources/Flare/Classes/Providers/PurchaseProvider/PurchaseProvider.swift @@ -181,7 +181,7 @@ extension PurchaseProvider: IPurchaseProvider { ) } else { Task { - await completion(.failure(.unknown)) + completion(.failure(.unknown)) self.log(error: IAPError.unknown, productID: product.productIdentifier) } } diff --git a/Tests/IntegrationTests/Tests/EligibilityProviderTests.swift b/Tests/IntegrationTests/Tests/EligibilityProviderTests.swift index 2d38a6a05..994785109 100644 --- a/Tests/IntegrationTests/Tests/EligibilityProviderTests.swift +++ b/Tests/IntegrationTests/Tests/EligibilityProviderTests.swift @@ -28,7 +28,8 @@ final class EligibilityProviderTests: StoreSessionTestCase { func test_thatProviderReturnsNoOffer_whenProductDoesNotHaveIntroductoryOffer() async throws { // given - let product = try XCTUnwrap(ProductProviderHelper.subscriptionsWithoutOffers.randomElement()) + let randomProduct = try await ProductProviderHelper.subscriptionsWithoutOffers.randomElement() + let product = try XCTUnwrap(randomProduct) // when let result = try await sut.checkEligibility(products: [StoreProduct(product: product)]) @@ -39,7 +40,8 @@ final class EligibilityProviderTests: StoreSessionTestCase { func test_thatProviderReturnsEligible_whenProductHasIntroductoryOffer() async throws { // given - let product = try XCTUnwrap(ProductProviderHelper.subscriptionsWithIntroductoryOffer.randomElement()) + let randomProduct = try await ProductProviderHelper.subscriptionsWithIntroductoryOffer.randomElement() + let product = try XCTUnwrap(randomProduct) // when let result = try await sut.checkEligibility(products: [StoreProduct(product: product)]) diff --git a/Tests/IntegrationTests/Tests/FlareTests.swift b/Tests/IntegrationTests/Tests/FlareTests.swift index ce9b7e1f9..c4fa2f449 100644 --- a/Tests/IntegrationTests/Tests/FlareTests.swift +++ b/Tests/IntegrationTests/Tests/FlareTests.swift @@ -85,7 +85,8 @@ final class FlareTests: StoreSessionTestCase { @available(iOS 15.2, tvOS 15.2, macOS 12.1, watchOS 8.3, *) func test_thatPurchaseIntorudctoryOffer() async throws { // 1. Fetch a product - let product = try XCTUnwrap(ProductProviderHelper.subscriptionsWithIntroductoryOffer.randomElement()) + let randomProduct = try await ProductProviderHelper.subscriptionsWithIntroductoryOffer.randomElement() + let product = try XCTUnwrap(randomProduct) let storeProduct = StoreProduct(product: product) // 2. Checking eligibility for a product From bb6d770b8089636e5571bd190728c1f575135c27 Mon Sep 17 00:00:00 2001 From: Nikita Vasilev Date: Fri, 13 Feb 2026 22:47:09 +0400 Subject: [PATCH 6/6] chore: fix snapshot tests --- .github/workflows/flare-ui.yml | 4 ++-- .../StoreSessionTestCase.swift | 4 ++-- Tests/IntegrationTests/Tests/FlareTests.swift | 16 +++++++++------- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/.github/workflows/flare-ui.yml b/.github/workflows/flare-ui.yml index 1efd4ab1d..d81c4cfe1 100644 --- a/.github/workflows/flare-ui.yml +++ b/.github/workflows/flare-ui.yml @@ -107,8 +107,8 @@ jobs: fail-fast: false matrix: include: - - { platform: iOS, name: "iOS 18.4", xcode: "Xcode_16.3", runsOn: macOS-15, destination: "OS=18.4,name=iPhone 16", testPlan: "SnapshotTests" } - - { platform: tvOS, name: "tvOS 18.4", xcode: "Xcode_16.3", runsOn: macOS-15, destination: "OS=18.4,name=Apple TV", testPlan: "SnapshotTests" } + - { platform: iOS, name: "iOS 18.5", xcode: "Xcode_16.4", runsOn: macOS-15, destination: "OS=18.5,name=iPhone 16", testPlan: "SnapshotTests" } + - { platform: tvOS, name: "tvOS 18.5", xcode: "Xcode_16.4", runsOn: macOS-15, destination: "OS=18.5,name=Apple TV", testPlan: "SnapshotTests" } steps: - name: Checkout code uses: actions/checkout@v6 diff --git a/Tests/IntegrationTests/Helpers/StoreSessionTestCase/StoreSessionTestCase.swift b/Tests/IntegrationTests/Helpers/StoreSessionTestCase/StoreSessionTestCase.swift index 81e124283..5d7e6f576 100644 --- a/Tests/IntegrationTests/Helpers/StoreSessionTestCase/StoreSessionTestCase.swift +++ b/Tests/IntegrationTests/Helpers/StoreSessionTestCase/StoreSessionTestCase.swift @@ -17,10 +17,10 @@ class StoreSessionTestCase: XCTestCase { // MARK: XCTestCase - override func setUp() { + override func setUpWithError() throws { super.setUp() - session = try? SKTestSession(configurationFileNamed: "Flare") + session = try SKTestSession(configurationFileNamed: "Flare") session?.resetToDefaultState() session?.askToBuyEnabled = false session?.disableDialogs = true diff --git a/Tests/IntegrationTests/Tests/FlareTests.swift b/Tests/IntegrationTests/Tests/FlareTests.swift index c4fa2f449..c7b39d329 100644 --- a/Tests/IntegrationTests/Tests/FlareTests.swift +++ b/Tests/IntegrationTests/Tests/FlareTests.swift @@ -137,12 +137,13 @@ final class FlareTests: StoreSessionTestCase { expectedResult: Result ) async throws { // given - let product = try await ProductProviderHelper.purchases.randomElement() + let randomElement = try await ProductProviderHelper.purchases.randomElement() + let product = try XCTUnwrap(randomElement, "ProductProviderHelper.purchases.randomElement() returned nil") // when let result: Result = await result(for: { try await sut.purchase( - product: StoreProduct(product: product!), + product: StoreProduct(product: product), options: [.simulatesAskToBuyInSandbox(false)] ) }) @@ -150,7 +151,7 @@ final class FlareTests: StoreSessionTestCase { // then switch expectedResult { case .success: - XCTAssertEqual(result.success?.productIdentifier, product?.id) + XCTAssertEqual(result.success?.productIdentifier, product.id) case let .failure(error): XCTAssertEqual(error, result.error) } @@ -163,13 +164,14 @@ final class FlareTests: StoreSessionTestCase { // given let expectation = XCTestExpectation(description: "Purchase a product") - let product = try await ProductProviderHelper.purchases.randomElement() + let randomElement = try await ProductProviderHelper.purchases.randomElement() + let product = try XCTUnwrap(randomElement, "ProductProviderHelper.purchases.randomElement() returned nil") // when let handler: Closure> = { result in switch expectedResult { case .success: - XCTAssertEqual(result.success?.productIdentifier, product?.id) + XCTAssertEqual(result.success?.productIdentifier, product.id) case let .failure(error): XCTAssertEqual(error, result.error) } @@ -177,10 +179,10 @@ final class FlareTests: StoreSessionTestCase { } if options.isEmpty { - sut.purchase(product: StoreProduct(product: product!)) { handler($0) } + sut.purchase(product: StoreProduct(product: product)) { handler($0) } } else { sut.purchase( - product: StoreProduct(product: product!), + product: StoreProduct(product: product), options: options ) { [handler] result in Task { handler(result) }