mirror of
https://github.com/outbackdingo/firezone.git
synced 2026-01-28 02:18:50 +00:00
refactor(apple): Only apply MDM config when changed (#9173)
In #9169 we applied MDM configuration from MDM upon _any_ change to UserDefaults. This is unnecessary. Instead, we can compare new vs old and only apply the new dict if there's changes. In this PR we also log the old and new dicts for debugging reasons.
This commit is contained in:
@@ -81,7 +81,15 @@ class ConfigurationManager {
|
||||
}
|
||||
|
||||
@objc private func handleUserDefaultsChanged(_ notification: Notification) {
|
||||
self.managedDict = userDefaults.dictionary(forKey: managedDictKey) ?? [:]
|
||||
let newManagedDict = (userDefaults.dictionary(forKey: managedDictKey) ?? [:]) as [String: Any?]
|
||||
|
||||
// NSDictionary conforms to Equatable
|
||||
if (managedDict as NSDictionary) == (newManagedDict as NSDictionary) {
|
||||
return
|
||||
}
|
||||
|
||||
Log.log("Applying MDM configuration. Old: \(managedDict) New: \(newManagedDict)")
|
||||
self.managedDict = newManagedDict
|
||||
}
|
||||
|
||||
private func saveUserDict() {
|
||||
|
||||
Reference in New Issue
Block a user