Retain in beta profiles created in production

Drop filter, ability to create profiles in the first place implies
eligibility.
This commit is contained in:
Davide De Rosa 2022-05-04 23:14:16 +02:00
parent c2676cbdf6
commit bafac12be4
2 changed files with 4 additions and 32 deletions

View File

@ -128,9 +128,6 @@ class AppContext {
// core
profileManager.availabilityFilter = {
self.isEligibleProfile(withHeader: $0)
}
providerManager.rateLimitMilliseconds = Constants.RateLimit.providerManager
vpnManager.isOnDemandRulesSupported = {
self.isEligibleForOnDemandRules()
@ -156,18 +153,6 @@ class AppContext {
}.store(in: &cancellables)
}
// eligibility: hide providers not found or not purchased
private func isEligibleProfile(withHeader header: Profile.Header) -> Bool {
guard let providerName = header.providerName else {
return true // always eligible for non-provider profiles
}
guard productManager.isEligible(forProvider: providerName) else {
// pp_log.debug("Not eligible for provider \(metadata.name)")
return false
}
return true
}
// eligibility: ignore network settings if ineligible
private func isEligibleForNetworkSettings() -> Bool {
guard productManager.isEligible(forFeature: .networkSettings) else {

View File

@ -45,8 +45,6 @@ public class ProfileManager: ObservableObject {
private let strategy: ProfileManagerStrategy
public var availabilityFilter: ((Profile.Header) -> Bool)?
// MARK: Observables
@Published public private(set) var activeProfileId: UUID? {
@ -118,19 +116,12 @@ extension ProfileManager {
strategy.allHeaders
}
private var availableHeaders: [Profile.Header] {
if let availabilityFilter = availabilityFilter {
return allHeaders.values.filter(availabilityFilter)
}
return Array(allHeaders.values)
}
public var headers: [Profile.Header] {
availableHeaders
Array(allHeaders.values)
}
public var hasProfiles: Bool {
!availableHeaders.isEmpty
!allHeaders.isEmpty
}
public var hasActiveProfile: Bool {
@ -141,12 +132,12 @@ extension ProfileManager {
id == activeProfileId
}
// existence in persistent storage (skips availability)
// existence in persistent storage
public func isExistingProfile(withId id: UUID) -> Bool {
allHeaders[id] != nil
}
// existence in persistent storage (skips availability)
// existence in persistent storage
public func isExistingProfile(withName name: String) -> Bool {
allHeaders.contains {
$0.value.name == name
@ -190,10 +181,6 @@ extension ProfileManager {
assertionFailure("Profile in headers yet not found in persistent store")
return nil
}
guard availabilityFilter?(profile.header) ?? true else {
pp_log.warning("Profile \(profile.logDescription) not available due to filter")
return nil
}
guard !profile.vpnProtocols.isEmpty else {
assertionFailure("Ditching profile, no OpenVPN/WireGuard settings found")
return nil