mirror of
https://github.com/RevenueCat/purchases-ios
synced 2026-11-11 22:55:55 +05:45
Alpha of the Customer Center. In this branch, it's been disabled behind a compilation flag. --------- Co-authored-by: Will Taylor <wtaylor151@gmail.com> Co-authored-by: James Borthwick <109382862+jamesrb1@users.noreply.github.com> Co-authored-by: RevenueCat Git Bot <72824662+RCGitBot@users.noreply.github.com> Co-authored-by: JayShortway <29483617+JayShortway@users.noreply.github.com> Co-authored-by: Toni Rico <toni.rico.diez@revenuecat.com> Co-authored-by: Toni Rico <antonio.rico.diez@revenuecat.com> Co-authored-by: Cody Kerns <44073103+codykerns@users.noreply.github.com> Co-authored-by: Andy Boedo <andresboedo@gmail.com>
36 lines
956 B
Swift
36 lines
956 B
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
|
|
//
|
|
// StorefrontProvider.swift
|
|
//
|
|
// Created by Nacho Soto on 11/17/23.
|
|
|
|
import Foundation
|
|
|
|
/// A type that can determine the current `Storefront`.
|
|
protocol StorefrontProviderType {
|
|
|
|
var currentStorefront: StorefrontType? { get }
|
|
|
|
}
|
|
|
|
/// Main ``StorefrontProviderType`` implementation.
|
|
/// Relies on StoreKit 1 because StoreKit 2's implementation would be `async`.
|
|
final class DefaultStorefrontProvider: StorefrontProviderType {
|
|
|
|
var currentStorefront: StorefrontType? {
|
|
if #available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.2, macCatalyst 13.1, *) {
|
|
return Storefront.sk1CurrentStorefrontType
|
|
} else {
|
|
return nil
|
|
}
|
|
}
|
|
|
|
}
|