Skip to content

Commit

Permalink
Merge pull request #14 from alectrona/storepath-with-userdefaults
Browse files Browse the repository at this point in the history
Determine storepath with UserDefaults
  • Loading branch information
SMartorelli authored Oct 31, 2024
2 parents 078cbd1 + 11265b1 commit b60839c
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion migrator/AppContext.swift
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,15 @@ struct AppContext {
]

/// Path the Jamf Self Service .app
static let storePath: String = "/Applications/Company Self Service.app"
static let fallbackStorePath: String = "/Applications/Company Self Service.app"

/// Returns the path to the Jamf Self Service .app configured on the user's device OR the fallbackStorePath
/// Reads the plist at /Library/Preferences/com.jamfsoftware.jamf.plist to get the path.
static var storePath: String {
let jamfUserDefaults = UserDefaults(suiteName: "com.jamfsoftware.jamf")
let jamfSelfServicePath = jamfUserDefaults?.string(forKey: "self_service_app_path")
return jamfSelfServicePath ?? fallbackStorePath
}

/// A URL to redirect users to setup instructions if the app detects the device is not managed by MDM.
static let enrollmentRedirectionLink: String = "https://url.to.enrollment/support.website"
Expand Down

0 comments on commit b60839c

Please sign in to comment.