Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v2.0.7 #635

Merged
merged 5 commits into from
Aug 8, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Quit nudge when MDM profile is updated
erikng committed Aug 8, 2024
commit f13a697dd61400f7f0d73dc38226f7769ed8e4f4
2 changes: 1 addition & 1 deletion Nudge/UI/Defaults.swift
Original file line number Diff line number Diff line change
@@ -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
10 changes: 8 additions & 2 deletions Nudge/UI/Main.swift
Original file line number Diff line number Diff line change
@@ -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)
}
}
}

2 changes: 1 addition & 1 deletion Nudge/Utilities/Utils.swift
Original file line number Diff line number Diff line change
@@ -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)
}
}