Rename activeProfileId publisher for consistency

This commit is contained in:
Davide De Rosa 2022-07-14 17:05:35 +02:00
parent cbf00cef73
commit 9d9dc2b2f6
3 changed files with 10 additions and 7 deletions

View File

@ -31,10 +31,10 @@ public protocol ProfileManager {
var activeProfileId: UUID? { get }
var activeProfileIdPublisher: Published<UUID?>.Publisher { get }
var currentProfileId: UUID? { get set }
var didUpdateActiveProfile: PassthroughSubject<UUID?, Never> { get }
var didCreateProfile: PassthroughSubject<Profile, Never> { get }
var headers: [Profile.Header] { get }

View File

@ -60,10 +60,6 @@ public class DefaultProfileManager: ProfileManagerWithCurrentProfile, Observable
}
}
public var activeProfileIdPublisher: Published<UUID?>.Publisher {
$internalActiveProfileId
}
public var currentProfileId: UUID? {
get {
internalCurrentProfileId
@ -83,6 +79,8 @@ public class DefaultProfileManager: ProfileManagerWithCurrentProfile, Observable
public let currentProfile: ObservableProfile
public let didUpdateActiveProfile = PassthroughSubject<UUID?, Never>()
public let didCreateProfile = PassthroughSubject<Profile, Never>()
private var cancellables: Set<AnyCancellable> = []
@ -293,6 +291,11 @@ extension DefaultProfileManager {
extension DefaultProfileManager {
public func observeUpdates() {
$internalActiveProfileId
.sink {
self.didUpdateActiveProfile.send($0)
}.store(in: &cancellables)
strategy.willUpdateProfiles()
.dropFirst()
.sink {

View File

@ -159,7 +159,7 @@ extension DefaultVPNManager {
}
private func observeProfileManager() {
profileManager.activeProfileIdPublisher
profileManager.didUpdateActiveProfile
.dropFirst()
.removeDuplicates()
.sink { newId in