diff --git a/CHANGELOG.md b/CHANGELOG.md
index a7303015..4c698516 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,9 +4,9 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
-## [1.1.13] - 2023-10-05
-### Fixed
-- [SMAppService preventing legacy LaunchAgent from loading](https://github.com/macadmins/nudge/pull/516)
+## [1.1.13] - 2023-10-06
+### Removed
+- Removed support for SMAppService method of registering LaunchAgents. This version will only use "legacy" LaunchAgents until this new service method works well.
## [1.1.12] - 2023-09-25
### Added
diff --git a/Example Assets/com.github.macadmins.Nudge.json b/Example Assets/com.github.macadmins.Nudge.json
index e024af9b..f0c06185 100644
--- a/Example Assets/com.github.macadmins.Nudge.json
+++ b/Example Assets/com.github.macadmins.Nudge.json
@@ -58,7 +58,6 @@
"imminentWindowTime": 24,
"initialRefreshCycle": 18000,
"launchAgentIdentifier": "com.github.macadmins.Nudge",
- "loadLaunchAgent": false,
"maxRandomDelayInSeconds": 1200,
"noTimers": false,
"nudgeRefreshCycle": 60,
diff --git a/Example Assets/com.github.macadmins.Nudge.mobileconfig b/Example Assets/com.github.macadmins.Nudge.mobileconfig
index 7093a67f..571e4b92 100644
--- a/Example Assets/com.github.macadmins.Nudge.mobileconfig
+++ b/Example Assets/com.github.macadmins.Nudge.mobileconfig
@@ -126,8 +126,6 @@
18000
launchAgentIdentifier
com.github.macadmins.Nudge
- loadLaunchAgent
-
maxRandomDelayInSeconds
1200
noTimers
diff --git a/Example Assets/com.github.macadmins.Nudge.tester.json b/Example Assets/com.github.macadmins.Nudge.tester.json
index a98d2b06..f6dac5d1 100644
--- a/Example Assets/com.github.macadmins.Nudge.tester.json
+++ b/Example Assets/com.github.macadmins.Nudge.tester.json
@@ -27,7 +27,6 @@
"userExperience": {
"elapsedRefreshCycle": 10,
"initialRefreshCycle": 10,
- "loadLaunchAgent": false,
"nudgeRefreshCycle": 5,
"randomDelay": false
},
diff --git a/Nudge.xcodeproj/project.pbxproj b/Nudge.xcodeproj/project.pbxproj
index aa78725d..5ee148f1 100644
--- a/Nudge.xcodeproj/project.pbxproj
+++ b/Nudge.xcodeproj/project.pbxproj
@@ -40,8 +40,6 @@
63D7D0F625C9E9A500236281 /* NudgeTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63D7D0F525C9E9A500236281 /* NudgeTests.swift */; };
63D7D10125C9E9A500236281 /* NudgeUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63D7D10025C9E9A500236281 /* NudgeUITests.swift */; };
63D7D12725C9F1EE00236281 /* StandardMode.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63D7D12625C9F1EE00236281 /* StandardMode.swift */; };
- 73CC1D7829B81EE500FBF8E2 /* com.github.macadmins.Nudge.SMAppService.plist in Resources */ = {isa = PBXBuildFile; fileRef = 73CC1D7729B81EE500FBF8E2 /* com.github.macadmins.Nudge.SMAppService.plist */; };
- 73CC1D7A29B81F0600FBF8E2 /* com.github.macadmins.Nudge.SMAppService.plist in CopyFiles */ = {isa = PBXBuildFile; fileRef = 73CC1D7729B81EE500FBF8E2 /* com.github.macadmins.Nudge.SMAppService.plist */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
@@ -68,7 +66,6 @@
dstPath = Nudge.app/Contents/Library/LaunchAgents;
dstSubfolderSpec = 16;
files = (
- 73CC1D7A29B81F0600FBF8E2 /* com.github.macadmins.Nudge.SMAppService.plist in CopyFiles */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -116,7 +113,6 @@
63D7D10025C9E9A500236281 /* NudgeUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NudgeUITests.swift; sourceTree = ""; };
63D7D10225C9E9A500236281 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
63D7D12625C9F1EE00236281 /* StandardMode.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StandardMode.swift; sourceTree = ""; };
- 73CC1D7729B81EE500FBF8E2 /* com.github.macadmins.Nudge.SMAppService.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = com.github.macadmins.Nudge.SMAppService.plist; sourceTree = ""; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@ -248,7 +244,6 @@
63D7D0E125C9E9A400236281 /* Nudge */ = {
isa = PBXGroup;
children = (
- 73CC1D7729B81EE500FBF8E2 /* com.github.macadmins.Nudge.SMAppService.plist */,
639B6B5425DF374600E38EC1 /* UI */,
639B6B3925DF1FEB00E38EC1 /* Preferences */,
639B6B4725DF218900E38EC1 /* Utilities */,
@@ -412,7 +407,6 @@
63D7D0EA25C9E9A500236281 /* Preview Assets.xcassets in Resources */,
63D7D0E725C9E9A500236281 /* Assets.xcassets in Resources */,
639B6B0F25DC9ED300E38EC1 /* com.github.macadmins.Nudge.mobileconfig in Resources */,
- 73CC1D7829B81EE500FBF8E2 /* com.github.macadmins.Nudge.SMAppService.plist in Resources */,
63C6A08E2833FB6500D5264A /* com.github.macadmins.Nudge.tester.json in Resources */,
035C2AEC25D8ABC400429458 /* com.github.macadmins.Nudge.json in Resources */,
6316F0E72832CA0700E1354D /* Schema in Resources */,
diff --git a/Nudge/Preferences/DefaultPreferencesNudge.swift b/Nudge/Preferences/DefaultPreferencesNudge.swift
index a9252239..59cbf091 100644
--- a/Nudge/Preferences/DefaultPreferencesNudge.swift
+++ b/Nudge/Preferences/DefaultPreferencesNudge.swift
@@ -77,7 +77,6 @@ let imminentRefreshCycle = userExperienceProfile?["imminentRefreshCycle"] as? In
let imminentWindowTime = userExperienceProfile?["imminentWindowTime"] as? Int ?? userExperienceJSON?.imminentWindowTime ?? 24
let initialRefreshCycle = userExperienceProfile?["initialRefreshCycle"] as? Int ?? userExperienceJSON?.initialRefreshCycle ?? 18000
let launchAgentIdentifier = userExperienceProfile?["launchAgentIdentifier"] as? String ?? userExperienceJSON?.launchAgentIdentifier ?? "com.github.macadmins.Nudge"
-let loadLaunchAgent = userExperienceProfile?["loadLaunchAgent"] as? Bool ?? userExperienceJSON?.loadLaunchAgent ?? false
let maxRandomDelayInSeconds = userExperienceProfile?["maxRandomDelayInSeconds"] as? Int ?? userExperienceJSON?.maxRandomDelayInSeconds ?? 1200
let noTimers = userExperienceProfile?["noTimers"] as? Bool ?? userExperienceJSON?.noTimers ?? false
let nudgeRefreshCycle = userExperienceProfile?["nudgeRefreshCycle"] as? Int ?? userExperienceJSON?.nudgeRefreshCycle ?? 60
diff --git a/Nudge/Preferences/PreferencesStructure.swift b/Nudge/Preferences/PreferencesStructure.swift
index 78ebc8b5..9fe1f768 100644
--- a/Nudge/Preferences/PreferencesStructure.swift
+++ b/Nudge/Preferences/PreferencesStructure.swift
@@ -271,7 +271,6 @@ struct UserExperience: Codable {
var gracePeriodPath: String?
var imminentRefreshCycle, imminentWindowTime, initialRefreshCycle: Int?
var launchAgentIdentifier: String?
- var loadLaunchAgent: Bool?
var maxRandomDelayInSeconds: Int?
var noTimers: Bool?
var nudgeRefreshCycle: Int?
@@ -312,7 +311,6 @@ extension UserExperience {
imminentWindowTime: Int?? = nil,
initialRefreshCycle: Int?? = nil,
launchAgentIdentifier: String?? = nil,
- loadLaunchAgent: Bool?? = nil,
maxRandomDelayInSeconds: Int?? = nil,
noTimers: Bool?? = nil,
nudgeRefreshCycle: Int?? = nil,
@@ -335,7 +333,6 @@ extension UserExperience {
imminentWindowTime: imminentWindowTime ?? self.imminentWindowTime,
initialRefreshCycle: initialRefreshCycle ?? self.initialRefreshCycle,
launchAgentIdentifier: launchAgentIdentifier ?? self.launchAgentIdentifier,
- loadLaunchAgent: loadLaunchAgent ?? self.loadLaunchAgent,
maxRandomDelayInSeconds: maxRandomDelayInSeconds ?? self.maxRandomDelayInSeconds,
noTimers: noTimers ?? self.noTimers,
nudgeRefreshCycle: nudgeRefreshCycle ?? self.nudgeRefreshCycle,
diff --git a/Nudge/UI/Main.swift b/Nudge/UI/Main.swift
index 6d5ae438..42826787 100644
--- a/Nudge/UI/Main.swift
+++ b/Nudge/UI/Main.swift
@@ -386,16 +386,6 @@ class AppDelegate: NSObject, NSApplicationDelegate {
// Pre-Launch Logic
func applicationWillFinishLaunching(_ notification: Notification) {
// print("applicationWillFinishLaunching")
- if #available(macOS 13, *) {
- let appService = SMAppService.agent(plistName: "com.github.macadmins.Nudge.SMAppService.plist")
- let appServiceStatus = appService.status
- if CommandLine.arguments.contains("--register") || loadLaunchAgent {
- Utils().loadSMAppLaunchAgent(appService: appService, appServiceStatus: appServiceStatus)
- } else if CommandLine.arguments.contains("--unregister") || !loadLaunchAgent {
- Utils().unloadSMAppLaunchAgent(appService: appService, appServiceStatus: appServiceStatus)
- }
- }
-
if FileManager.default.fileExists(atPath: "/Library/Managed Preferences/com.github.macadmins.Nudge.json.plist") {
prefsProfileLog.warning("\("Found bad profile path at /Library/Managed Preferences/com.github.macadmins.Nudge.json.plist", privacy: .public)")
exit(1)
diff --git a/Nudge/Utilities/Utils.swift b/Nudge/Utilities/Utils.swift
index 083c1951..e2ca0a4a 100644
--- a/Nudge/Utilities/Utils.swift
+++ b/Nudge/Utilities/Utils.swift
@@ -8,9 +8,6 @@
import AppKit
import CoreMediaIO
import Foundation
-#if canImport(ServiceManagement)
-import ServiceManagement
-#endif
import SwiftUI
import SystemConfiguration
@@ -147,96 +144,6 @@ struct Utils {
return allow1HourDeferralButton
}
- @available(macOS 13.0, *)
- func loadSMAppLaunchAgent(appService: SMAppService, appServiceStatus: SMAppService.Status) {
- let url = URL(string: "/Library/LaunchAgents/\(launchAgentIdentifier).plist")!
- let legacyStatus = SMAppService.statusForLegacyPlist(at: url)
- let passedThroughCLI = CommandLine.arguments.contains("--register")
- if legacyStatus == .enabled {
- if passedThroughCLI {
- print("Legacy Nudge LaunchAgent currently loaded. Please disable this agent before attempting to register modern agent.")
- exit(1)
- } else {
- osLog.info("Legacy Nudge LaunchAgent currently loaded. Please disable this agent before attempting to register modern agent.")
- }
- } else {
- if appServiceStatus == .enabled {
- if passedThroughCLI {
- print("Nudge LaunchAgent is currently registered and enabled")
- exit(0)
- } else {
- osLog.info("Nudge LaunchAgent is currently registered and enabled")
- }
- } else {
- do {
- if passedThroughCLI {
- print("Registering Nudge LaunchAgent")
- } else {
- osLog.info("Registering Nudge LaunchAgent")
- }
- try appService.register()
- } catch {
- if passedThroughCLI {
- print("Failed to register Nudge LaunchAgent")
- exit(1)
- } else {
- osLog.info("Failed to register Nudge LaunchAgent")
- return
- }
- }
- if passedThroughCLI {
- print("Successfully registered Nudge LaunchAgent")
- exit(0)
- } else {
- osLog.info("Successfully registered Nudge LaunchAgent")
- }
- }
- }
- }
-
- @available(macOS 13.0, *)
- func unloadSMAppLaunchAgent(appService: SMAppService, appServiceStatus: SMAppService.Status) {
- let passedThroughCLI = CommandLine.arguments.contains("--unregister")
- if appServiceStatus == .notFound {
- if passedThroughCLI {
- print("Nudge LaunchAgent has never been registered")
- exit(0)
- } else {
- osLog.info("Nudge LaunchAgent has never been registered")
- }
- } else if appServiceStatus == .notRegistered {
- if passedThroughCLI {
- print("Nudge LaunchAgent is not currently registered")
- exit(0)
- } else {
- osLog.info("Nudge LaunchAgent is not currently registered")
- }
- } else {
- do {
- if passedThroughCLI {
- print("Unregistering Nudge LaunchAgent")
- } else {
- osLog.info("Unregistering Nudge LaunchAgent")
- }
- try appService.unregister()
- } catch {
- if passedThroughCLI {
- print("Failed to unregister Nudge LaunchAgent")
- exit(1)
- } else {
- osLog.info("Failed to unregister Nudge LaunchAgent")
- return
- }
- }
- if passedThroughCLI {
- print("Successfully unregistered Nudge LaunchAgent")
- exit(0)
- } else {
- osLog.info("Successfully unregistered Nudge LaunchAgent")
- }
- }
- }
-
func allow24HourDeferral() -> Bool {
if demoModeEnabled() {
return true
diff --git a/Nudge/com.github.macadmins.Nudge.SMAppService.plist b/Nudge/com.github.macadmins.Nudge.SMAppService.plist
deleted file mode 100755
index 2fc70944..00000000
--- a/Nudge/com.github.macadmins.Nudge.SMAppService.plist
+++ /dev/null
@@ -1,33 +0,0 @@
-
-
-
-
- AssociatedBundleIdentifiers
-
- com.github.macadmins.Nudge
-
- Label
- com.github.macadmins.Nudge.SMAppService
- LimitLoadToSessionType
-
- Aqua
-
- ProgramArguments
-
- /Applications/Utilities/Nudge.app/Contents/MacOS/Nudge
-
- RunAtLoad
-
- StartCalendarInterval
-
-
- Minute
- 0
-
-
- Minute
- 30
-
-
-
-
diff --git a/Schema/jamf/com.github.macadmins.Nudge.json b/Schema/jamf/com.github.macadmins.Nudge.json
index 18cb2e0b..ecdfa744 100644
--- a/Schema/jamf/com.github.macadmins.Nudge.json
+++ b/Schema/jamf/com.github.macadmins.Nudge.json
@@ -744,20 +744,6 @@
}
]
},
- "loadLaunchAgent": {
- "description": "Loads the Nudge LaunchAgent using macOS Ventura's SMAppService API (macOS 13+ required).",
- "anyOf": [
- {
- "title": "Not Configured",
- "type": "null"
- },
- {
- "title": "Configured",
- "default": false,
- "type": "boolean"
- }
- ]
- },
"maxRandomDelayInSeconds": {
"description": "The maximum amount of delay Nudge will utilize before launching the UI. This is useful if you do not want your users to all receive the Nudge prompt at the exact time of the LaunchAgent. Note: This functionality only applies when also enabling `randomDelay`.",
"anyOf": [