diff --git a/Passepartout/Library/Sources/AppUI/IAP/AppFeature.swift b/Passepartout/Library/Sources/AppUI/IAP/AppFeature.swift index ad100403..25745b8a 100644 --- a/Passepartout/Library/Sources/AppUI/IAP/AppFeature.swift +++ b/Passepartout/Library/Sources/AppUI/IAP/AppFeature.swift @@ -60,7 +60,3 @@ extension AppFeature: Identifiable { rawValue } } - -protocol AppFeatureProviding { - var features: [AppFeature] { get } -} diff --git a/Passepartout/Library/Sources/AppUI/IAP/AppUserLevel+Features.swift b/Passepartout/Library/Sources/AppUI/IAP/AppFeatureProviding.swift similarity index 55% rename from Passepartout/Library/Sources/AppUI/IAP/AppUserLevel+Features.swift rename to Passepartout/Library/Sources/AppUI/IAP/AppFeatureProviding.swift index 540183a8..4733883d 100644 --- a/Passepartout/Library/Sources/AppUI/IAP/AppUserLevel+Features.swift +++ b/Passepartout/Library/Sources/AppUI/IAP/AppFeatureProviding.swift @@ -1,8 +1,8 @@ // -// AppUserLevel+Features.swift +// AppFeatureProviding.swift // Passepartout // -// Created by Davide De Rosa on 9/10/24. +// Created by Davide De Rosa on 10/11/24. // Copyright (c) 2024 Davide De Rosa. All rights reserved. // // https://github.com/passepartoutvpn @@ -25,6 +25,10 @@ import Foundation +protocol AppFeatureProviding { + var features: [AppFeature] { get } +} + extension AppUserLevel: AppFeatureProviding { var features: [AppFeature] { switch self { @@ -41,3 +45,44 @@ extension AppUserLevel: AppFeatureProviding { } } } + +extension AppProduct: AppFeatureProviding { + var features: [AppFeature] { + switch self { + case .Features.allProviders: + return [.providers] + + case .Features.appleTV: + return [.appleTV] + + case .Features.networkSettings: + return [.dns, .httpProxy, .routing] + + case .Features.siriShortcuts: + return [.siri] + + case .Features.trustedNetworks: + return [.onDemand] + + case .Full.allPlatforms: + return AppFeature.fullVersionFeaturesV2 + + case .Full.iOS: +#if os(iOS) + return AppFeature.fullVersionFeaturesV2 +#else + return [] +#endif + + case .Full.macOS: +#if os(macOS) + return AppFeature.fullVersionFeaturesV2 +#else + return [] +#endif + + default: + return [] + } + } +} diff --git a/Passepartout/Library/Sources/AppUI/IAP/AppProduct+Features.swift b/Passepartout/Library/Sources/AppUI/IAP/AppProduct+Features.swift index e2709154..6383bc34 100644 --- a/Passepartout/Library/Sources/AppUI/IAP/AppProduct+Features.swift +++ b/Passepartout/Library/Sources/AppUI/IAP/AppProduct+Features.swift @@ -70,44 +70,3 @@ extension AppProduct { rawValue.hasPrefix(Self.featurePrefix) } } - -extension AppProduct: AppFeatureProviding { - var features: [AppFeature] { - switch self { - case .Features.allProviders: - return [.providers] - - case .Features.appleTV: - return [.appleTV] - - case .Features.networkSettings: - return [.dns, .httpProxy, .routing] - - case .Features.siriShortcuts: - return [.siri] - - case .Features.trustedNetworks: - return [.onDemand] - - case .Full.allPlatforms: - return AppFeature.fullVersionFeaturesV2 - - case .Full.iOS: -#if os(iOS) - return AppFeature.fullVersionFeaturesV2 -#else - return [] -#endif - - case .Full.macOS: -#if os(macOS) - return AppFeature.fullVersionFeaturesV2 -#else - return [] -#endif - - default: - return [] - } - } -}