Skip to content

Commit

Permalink
fixed background image url
Browse files Browse the repository at this point in the history
  • Loading branch information
twocanoes committed Aug 10, 2022
1 parent 6f6f2b9 commit 8164b12
Show file tree
Hide file tree
Showing 8 changed files with 46 additions and 46 deletions.
8 changes: 4 additions & 4 deletions Profile Manifest/com.twocanoes.xcreds.plist
Original file line number Diff line number Diff line change
Expand Up @@ -537,15 +537,15 @@ A profile can consist of payloads with different version numbers. For example, c
</dict>
<dict>
<key>pfm_name</key>
<string>loginWindowBackgroundImagePath</string>
<string>loginWindowBackgroundImageURL</string>
<key>pfm_type</key>
<string>string</string>
<key>pfm_title</key>
<string>Login Window Background Image Path</string>
<string>Login Window Background Image URL</string>
<key>pfm_description</key>
<string>Path to an image to show in the background while logging in </string>
<string>url to an image to show in the background while logging in </string>
<key>pfm_default</key>
<string>/System/Library/Desktop Pictures/Monterey Graphic.heic</string>
<string>file:///System/Library/Desktop Pictures/Monterey Graphic.heic</string>

</dict>

Expand Down
1 change: 1 addition & 0 deletions XCreds/MainController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class MainController: NSObject {
let defaultsDict = NSDictionary(contentsOfFile: defaultsPath)
UserDefaults.standard.register(defaults: defaultsDict as! [String : Any])
}


// make sure we have the local password, else prompt. we don't need to save it
// just make sure we prompt if not in the keychain. if the user cancels, then it will
Expand Down
2 changes: 1 addition & 1 deletion XCreds/PrefKeys.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import Foundation

enum PrefKeys: String {
case clientID, clientSecret, password="local password",discoveryURL, redirectURI, scopes, accessToken, idToken, refreshToken, tokenEndpoint, expirationDate, invalidToken, refreshRateHours, showDebug, verifyPassword, shouldShowQuitMenu, shouldShowPreferencesOnStart, shouldSetGoogleAccessTypeToOffline, passwordChangeURL, shouldShowAboutMenu, username, customURL, customPasswordElementID, shouldShowVersionInfo, shouldShowSupportStatus,shouldShowConfigureWifiButton,shouldShowMacLoginButton, loginWindowBackgroundImagePath
case clientID, clientSecret, password="local password",discoveryURL, redirectURI, scopes, accessToken, idToken, refreshToken, tokenEndpoint, expirationDate, invalidToken, refreshRateHours, showDebug, verifyPassword, shouldShowQuitMenu, shouldShowPreferencesOnStart, shouldSetGoogleAccessTypeToOffline, passwordChangeURL, shouldShowAboutMenu, username, customURL, customPasswordElementID, shouldShowVersionInfo, shouldShowSupportStatus,shouldShowConfigureWifiButton,shouldShowMacLoginButton, loginWindowBackgroundImageURL
}
func getManagedPreference(key: Preferences) -> Any? {

Expand Down
4 changes: 2 additions & 2 deletions XCreds/defaults.plist
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
<string>1</string>
<key>KeychainCreate</key>
<true/>
<key>loginWindowBackgroundImagePath</key>
<string>/System/Library/Desktop Pictures/Monterey Graphic.heic</string>
<key>loginWindowBackgroundImageURL</key>
<string>file:///System/Library/Desktop Pictures/Monterey Graphic.heic</string>
</dict>
</plist>
23 changes: 19 additions & 4 deletions XCredsLoginPlugIn/LoginProgressWindowController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,29 @@ class LoginProgressWindowController: NSWindowController {
let screenRect = NSScreen.screens[0].frame
self.window?.setFrame(screenRect, display: true, animate: false)

if let path = UserDefaults.standard.string(forKey: PrefKeys.loginWindowBackgroundImagePath.rawValue) {
let image = NSImage.init(contentsOfFile: path)
image?.size=screenRect.size
backgroundImageView.image = image
let pathURLString = UserDefaults.standard.string(forKey: PrefKeys.loginWindowBackgroundImageURL.rawValue)

var pathURL:URL?

if pathURLString?.hasPrefix("file://") == true, let
pathURLString = pathURLString {
let pathOnly = pathURLString.dropFirst(7)
pathURL = URL(fileURLWithPath: String(pathOnly))
}
else {
if let pathURLString = pathURLString {
pathURL = URL(string: pathURLString)

}
}
if let pathURL = pathURL {
let image = NSImage.init(contentsOf: pathURL)

if let image = image {
image.size=screenRect.size
backgroundImageView.image = image
}
}

}

Expand Down
12 changes: 6 additions & 6 deletions xCreds.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -885,7 +885,7 @@
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 3249;
CURRENT_PROJECT_VERSION = 3253;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = UXP6YEHSPW;
GENERATE_INFOPLIST_FILE = YES;
Expand Down Expand Up @@ -916,7 +916,7 @@
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 3249;
CURRENT_PROJECT_VERSION = 3253;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = UXP6YEHSPW;
GENERATE_INFOPLIST_FILE = YES;
Expand Down Expand Up @@ -975,7 +975,7 @@
CODE_SIGN_ENTITLEMENTS = "XCreds Login Overlay/XCreds_Login_Overlay.entitlements";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 3249;
CURRENT_PROJECT_VERSION = 3253;
DEVELOPMENT_TEAM = UXP6YEHSPW;
ENABLE_HARDENED_RUNTIME = YES;
GENERATE_INFOPLIST_FILE = YES;
Expand Down Expand Up @@ -1005,7 +1005,7 @@
CODE_SIGN_ENTITLEMENTS = "XCreds Login Overlay/XCreds_Login_Overlay.entitlements";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 3249;
CURRENT_PROJECT_VERSION = 3253;
DEVELOPMENT_TEAM = UXP6YEHSPW;
ENABLE_HARDENED_RUNTIME = YES;
GENERATE_INFOPLIST_FILE = YES;
Expand Down Expand Up @@ -1148,7 +1148,7 @@
CODE_SIGN_ENTITLEMENTS = XCreds/xCreds.entitlements;
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 3249;
CURRENT_PROJECT_VERSION = 3253;
DEVELOPMENT_TEAM = UXP6YEHSPW;
ENABLE_HARDENED_RUNTIME = YES;
GENERATE_INFOPLIST_FILE = YES;
Expand Down Expand Up @@ -1177,7 +1177,7 @@
CODE_SIGN_ENTITLEMENTS = XCreds/xCreds.entitlements;
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 3249;
CURRENT_PROJECT_VERSION = 3253;
DEVELOPMENT_TEAM = UXP6YEHSPW;
ENABLE_HARDENED_RUNTIME = YES;
GENERATE_INFOPLIST_FILE = YES;
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -71,64 +71,48 @@
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "A5B1BD89-5A2D-4249-AE6F-DC505B6EB99D"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "XCreds/ScheduleManager.swift"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "44"
endingLineNumber = "44"
landmarkName = "checkToken()"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "B8E8F269-39EB-4275-AE55-48FF342F65A9"
uuid = "BAC957B8-27DC-4959-B755-4DB9B66EA02D"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "XCreds/ScheduleManager.swift"
filePath = "XCreds/TokenManager.swift"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "46"
endingLineNumber = "46"
landmarkName = "checkToken()"
startingLineNumber = "199"
endingLineNumber = "199"
landmarkName = "getNewAccessToken(completion:)"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "BAC957B8-27DC-4959-B755-4DB9B66EA02D"
uuid = "565CAA44-2CC6-4AE4-A157-CED1B23F622E"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "XCreds/TokenManager.swift"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "199"
endingLineNumber = "199"
startingLineNumber = "143"
endingLineNumber = "143"
landmarkName = "getNewAccessToken(completion:)"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "565CAA44-2CC6-4AE4-A157-CED1B23F622E"
uuid = "4F2F4120-9B82-4BEE-83F1-B36DB47CA867"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "XCreds/TokenManager.swift"
filePath = "XCreds/MainController.swift"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "143"
endingLineNumber = "143"
landmarkName = "getNewAccessToken(completion:)"
startingLineNumber = "20"
endingLineNumber = "20"
landmarkName = "run()"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
Expand Down

0 comments on commit 8164b12

Please sign in to comment.