Better observe updates explicitly after init
This commit is contained in:
parent
5cafd9794d
commit
f5c87d43c2
|
@ -139,6 +139,9 @@ class AppContext {
|
||||||
self.isEligibleForOnDemandRules()
|
self.isEligibleForOnDemandRules()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
profileManager.observeUpdates()
|
||||||
|
vpnManager.observeUpdates()
|
||||||
|
|
||||||
// app
|
// app
|
||||||
|
|
||||||
reviewer.eventCountBeforeRating = Constants.Rating.eventCount
|
reviewer.eventCountBeforeRating = Constants.Rating.eventCount
|
||||||
|
|
|
@ -78,8 +78,6 @@ public class VPNManager: ObservableObject, RateLimited {
|
||||||
isOnDemandRulesSupported = { true }
|
isOnDemandRulesSupported = { true }
|
||||||
|
|
||||||
currentState = ObservableState()
|
currentState = ObservableState()
|
||||||
observeStrategy()
|
|
||||||
observeProfileManager()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public func toggle() -> Bool {
|
public func toggle() -> Bool {
|
||||||
|
@ -156,6 +154,11 @@ public class VPNManager: ObservableObject, RateLimited {
|
||||||
// MARK: Observation
|
// MARK: Observation
|
||||||
|
|
||||||
extension VPNManager {
|
extension VPNManager {
|
||||||
|
public func observeUpdates() {
|
||||||
|
observeStrategy()
|
||||||
|
observeProfileManager()
|
||||||
|
}
|
||||||
|
|
||||||
private func observeStrategy() {
|
private func observeStrategy() {
|
||||||
strategy.observe(into: currentState)
|
strategy.observe(into: currentState)
|
||||||
}
|
}
|
||||||
|
|
|
@ -85,7 +85,6 @@ public class ProfileManager: ObservableObject {
|
||||||
self.strategy = strategy
|
self.strategy = strategy
|
||||||
|
|
||||||
currentProfile = ObservableProfile()
|
currentProfile = ObservableProfile()
|
||||||
observeUpdates()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -275,7 +274,7 @@ extension ProfileManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
extension ProfileManager {
|
extension ProfileManager {
|
||||||
private func observeUpdates() {
|
public func observeUpdates() {
|
||||||
strategy.willUpdateProfiles()
|
strategy.willUpdateProfiles()
|
||||||
.dropFirst()
|
.dropFirst()
|
||||||
.sink {
|
.sink {
|
||||||
|
|
Loading…
Reference in New Issue