Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions .github/workflows/flare-ui.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -109,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
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/flare.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
8 changes: 4 additions & 4 deletions Package@swift-5.10.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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/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/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.3.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"
Expand Down
8 changes: 4 additions & 4 deletions Package@swift-6.0.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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/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/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.3.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"
Expand Down
8 changes: 4 additions & 4 deletions Package@swift-6.1.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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/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/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.3.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"
Expand Down
2 changes: 1 addition & 1 deletion Sources/Flare/Classes/Common/Logger.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 4 additions & 2 deletions Sources/Flare/Classes/Flare.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,17 @@ 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
private static let flare: Flare = .init()
#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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
protocol IScenesHolder: Sendable {
#if os(iOS) || VISION_OS
/// The scenes that are connected to the app.
var connectedScenes: Set<UIScene> { get }
var connectedScenes: Set<UIScene> {
get
}
#endif
}
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
6 changes: 0 additions & 6 deletions Sources/Flare/Classes/Models/Internal/SK2RenewalInfo.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 0 additions & 6 deletions Sources/Flare/Classes/Models/RenewalInfo.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,6 @@ public struct RenewalInfo {
// MARK: Properties

let underlyingRenewalInfo: IRenewalInfo

// MARK: Initialization

init(underlyingRenewalInfo: IRenewalInfo) {
self.underlyingRenewalInfo = underlyingRenewalInfo
}
}

// MARK: - Initialization
Expand Down
4 changes: 3 additions & 1 deletion Sources/Flare/Classes/Models/StoreProduct.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 0 additions & 6 deletions Sources/Flare/Classes/Models/SubscriptionInfo.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,6 @@ public struct SubscriptionInfo {
// MARK: Properties

let underlyingSubscriptionInfo: ISubscriptionInfo

// MARK: Initialization

init(underlyingSubscriptionInfo: ISubscriptionInfo) {
self.underlyingSubscriptionInfo = underlyingSubscriptionInfo
}
}

// MARK: - Initializators
Expand Down
6 changes: 0 additions & 6 deletions Sources/Flare/Classes/Models/SubscriptionInfoStatus.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,6 @@ public struct SubscriptionInfoStatus {
// MARK: Properties

let underlyingStatus: ISubscriptionInfoStatus

// MARK: Initialization

init(underlyingStatus: ISubscriptionInfoStatus) {
self.underlyingStatus = underlyingStatus
}
}

// MARK: ISubscriptionInfoStatus
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@ final class CachingProductsProviderDecorator {
///
/// - Returns: A dictionary containing cached products for the specified IDs.
private func cachedProducts(ids: some Collection<String>) -> [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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ extension PurchaseProvider: IPurchaseProvider {
)
} else {
Task {
await completion(.failure(.unknown))
completion(.failure(.unknown))
self.log(error: IAPError.unknown, productID: product.productIdentifier)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ import SwiftUI
// MARK: - StoreButtonsAssemblyKey

private struct StoreButtonsAssemblyKey: EnvironmentKey {
static var defaultValue: IStoreButtonsAssembly? { nil }
static var defaultValue: IStoreButtonsAssembly? {
nil
}
}

extension EnvironmentValues {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ import SwiftUI
// MARK: - StoreButtonKey

private struct StoreButtonKey: EnvironmentKey {
static var defaultValue: [StoreButtonType] { [] }
static var defaultValue: [StoreButtonType] {
[]
}
}

extension EnvironmentValues {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ import SwiftUI
// MARK: - SubscriptionMarketingContentKey

private struct SubscriptionMarketingContentKey: EnvironmentKey {
static var defaultValue: AnyView? { nil }
static var defaultValue: AnyView? {
nil
}
}

extension EnvironmentValues {
Expand Down
Loading
Loading