diff --git a/Nudge/UI/Defaults.swift b/Nudge/UI/Defaults.swift index b06e221d..e54a35aa 100644 --- a/Nudge/UI/Defaults.swift +++ b/Nudge/UI/Defaults.swift @@ -23,7 +23,7 @@ struct Globals { static let snc = NSWorkspace.shared.notificationCenter // Preferences static let configJSON = ConfigurationManager().getConfigurationAsJSON() - static var configProfile = ConfigurationManager().getConfigurationAsProfile() + static let configProfile = ConfigurationManager().getConfigurationAsProfile() static let nudgeDefaults = UserDefaults.standard static let nudgeJSONPreferences = NetworkFileManager().getNudgeJSONPreferences() // Device Properties diff --git a/Nudge/UI/Main.swift b/Nudge/UI/Main.swift index edd9c63d..29dc78cd 100644 --- a/Nudge/UI/Main.swift +++ b/Nudge/UI/Main.swift @@ -739,8 +739,14 @@ class AppDelegate: NSObject, NSApplicationDelegate { Globals.nc.addObserver( forName: UserDefaults.didChangeNotification, object: nil, - queue: .main) { [weak self] _ in - Globals.configProfile = ConfigurationManager().getConfigurationAsProfile() + queue: .main) { _ in + if ConfigurationManager().getConfigurationAsProfile() == Globals.configProfile { + LogManager.debug("MDM Profile has been re-installed or updated but configuration is identical, no need to quit Nudge.", logger: sofaLog) + } else { + LogManager.info("MDM Profile has been re-installed or updated. Quitting Nudge to allow LaunchAgent to re-initalize with new settings.", logger: sofaLog) + nudgePrimaryState.shouldExit = true + exit(2) + } } } diff --git a/Nudge/Utilities/Utils.swift b/Nudge/Utilities/Utils.swift index d0892d00..789ff05f 100644 --- a/Nudge/Utilities/Utils.swift +++ b/Nudge/Utilities/Utils.swift @@ -1310,7 +1310,7 @@ struct SMAppManager { print(message) if let code = exitCode { exit(Int32(code)) } } else { - LogManager.info("\(message)", logger: uiLog) + LogManager.notice("\(message)", logger: uiLog) } }