diff --git a/Passepartout/Library/Sources/CommonLibrary/Business/ProfileManager.swift b/Passepartout/Library/Sources/CommonLibrary/Business/ProfileManager.swift index 5433d5de..36a1a6fa 100644 --- a/Passepartout/Library/Sources/CommonLibrary/Business/ProfileManager.swift +++ b/Passepartout/Library/Sources/CommonLibrary/Business/ProfileManager.swift @@ -60,11 +60,7 @@ public final class ProfileManager: ObservableObject { private var allProfiles: [Profile.ID: Profile] { didSet { reloadFilteredProfiles(with: searchSubject.value) - if let processor { - requiredFeatures = allProfiles.reduce(into: [:]) { - $0[$1.key] = processor.verify($1.value) - } - } + reloadRequiredFeatures() } } @@ -185,6 +181,19 @@ extension ProfileManager { public func search(byName name: String) { searchSubject.send(name) } + + public func reloadRequiredFeatures() { + guard let processor else { + return + } + requiredFeatures = allProfiles.reduce(into: [:]) { + guard let ineligible = processor.verify($1.value), !ineligible.isEmpty else { + return + } + $0[$1.key] = ineligible + } + pp_log(.App.profiles, .info, "Required features: \(requiredFeatures)") + } } // MARK: - CRUD diff --git a/Passepartout/Library/Sources/UILibrary/Business/AppContext.swift b/Passepartout/Library/Sources/UILibrary/Business/AppContext.swift index 6b2d8b49..47b0c5d8 100644 --- a/Passepartout/Library/Sources/UILibrary/Business/AppContext.swift +++ b/Passepartout/Library/Sources/UILibrary/Business/AppContext.swift @@ -176,6 +176,10 @@ private extension AppContext { } catch { pp_log(.App.profiles, .error, "\tUnable to re-observe remote profiles: \(error)") } + + // refresh required profile features + pp_log(.App.profiles, .info, "\tReload profiles required features...") + profileManager.reloadRequiredFeatures() } await pendingTask?.value pendingTask = nil