Skip to content

Commit 06a4476

Browse files
committed
allow banned keys when simulating versions
1 parent 8294e9d commit 06a4476

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ Requires macOS 12.0 and higher.
4444
- Addresses [610](https://github.com/macadmins/nudge/issues/610) and [613](https://github.com/macadmins/nudge/issues/613)
4545
- When `showRequiredDate` is set to `True` and the admin is using the default values for `requiredInstallationDisplayFormat`, Nudge will attempt to understand the current locale and display the menu item appropriately.
4646
- Addresses [615](https://github.com/macadmins/nudge/issues/615)
47+
- Banned shortcut keys - including the ability to quit the application - are now allowed when passing `-simulate-os-version` or `-simulate-hardware-id`
4748

4849
### Fixed
4950
- Several components in the Github Actions were triggering deprecation warnings. These have been addressed by updating to the latest version of these components

Nudge/UI/Main.swift

+5
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,10 @@ class AppDelegate: NSObject, NSApplicationDelegate {
155155
if nudgePrimaryState.shouldExit {
156156
return .terminateNow
157157
} else {
158+
if (CommandLineUtilities().simulateOSVersion() != nil) || (CommandLineUtilities().simulateHardwareID() != nil) {
159+
LogManager.warning("Attempt to exit Nudge was allow due to simulation arguments.", logger: uiLog)
160+
return .terminateNow
161+
}
158162
// Log the attempt to exit the application if it should not exit yet
159163
LogManager.warning("Attempt to exit Nudge was prevented.", logger: uiLog)
160164
return .terminateCancel
@@ -534,6 +538,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {
534538
}
535539

536540
private func detectBannedShortcutKeys(with event: NSEvent) -> Bool {
541+
if (CommandLineUtilities().simulateOSVersion() != nil) || (CommandLineUtilities().simulateHardwareID() != nil) { return false }
537542
guard NSApplication.shared.isActive else { return false }
538543
switch event.modifierFlags.intersection(.deviceIndependentFlagsMask) {
539544
// Disable CMD + H - Hides Nudge

0 commit comments

Comments
 (0)