Skip to content

Commit

Permalink
fixed issue with initial focus
Browse files Browse the repository at this point in the history
  • Loading branch information
twocanoes committed Dec 17, 2023
1 parent 19260d3 commit f40cf39
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 9 deletions.
1 change: 1 addition & 0 deletions XCredsLoginPlugIn/LoginWindow/SignInWindowController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ let checkADLog = OSLog(subsystem: "menu.nomad.login.ad", category: "CheckADMech"
self.localOnlyView.isHidden = self.domainName.isEmpty

}

}

fileprivate func showResetUI() -> Bool {
Expand Down
23 changes: 22 additions & 1 deletion XCredsLoginPlugIn/Mechanisms/XCredsLoginMechanism.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import Network
case cloud
case usernamePassword
}
var timer:Timer?
let checkADLog = "checkADLog"
var loginWindowType = LoginWindowType.cloud
var mainLoginWindowController:MainLoginWindowController
Expand Down Expand Up @@ -210,7 +211,11 @@ import Network
}
TCSLogWithMark("Showing XCreds Login Window")

NSApp.activate(ignoringOtherApps: true)
//for some reason, software update activates and gets in the way. so we delay for 3 seconds before coming back to front
timer = Timer.scheduledTimer(withTimeInterval: 3, repeats: false) { timer in
NSApp.activate(ignoringOtherApps: true)
}


if let runDict = runDict() {

Expand Down Expand Up @@ -391,8 +396,24 @@ import Network
if signInViewController.localOnlyCheckBox != nil {
signInViewController.localOnlyCheckBox.isEnabled = true
}
TCSLogWithMark("forcing front")
mainLoginWindowController.window?.forceToFrontAndFocus(self)
mainLoginWindowController.window?.makeFirstResponder(signInViewController.usernameTextField)

}
// var app = NSWorkspace.shared.frontmostApplication
//
// TCSLogWithMark("frontmost: \(app.debugDescription)")
//
// sleep(1)
// app = NSWorkspace.shared.frontmostApplication
// TCSLogWithMark("frontmost: \(app.debugDescription)")
// sleep(1)
// app = NSWorkspace.shared.frontmostApplication
// TCSLogWithMark("frontmost: \(app.debugDescription)")
// app = NSWorkspace.shared.frontmostApplication
// TCSLogWithMark("frontmost: \(app.debugDescription)")



}
Expand Down
14 changes: 8 additions & 6 deletions xCreds.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
7632E3A2287357CC00E37923 /* TokenManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 76EE06AB27FD1D92009E0F3A /* TokenManager.swift */; };
7632E3A32873581100E37923 /* KeychainUtil.swift in Sources */ = {isa = PBXBuildFile; fileRef = 767116B2284B045800CCD6FF /* KeychainUtil.swift */; };
76342E5A2B282653007D4F29 /* DesktopLoginWindowController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 76342E592B282653007D4F29 /* DesktopLoginWindowController.swift */; };
764859F22B2FA2E800507C16 /* Window+ForceToFront.swift in Sources */ = {isa = PBXBuildFile; fileRef = 76EE06AF27FD1DD8009E0F3A /* Window+ForceToFront.swift */; };
764D8126284BC1C300B3EE54 /* PromptForLocalPasswordWindowController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 764D8124284BC1C300B3EE54 /* PromptForLocalPasswordWindowController.swift */; };
764D8127284BC1C300B3EE54 /* LoginPasswordWindowController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 764D8125284BC1C300B3EE54 /* LoginPasswordWindowController.xib */; };
764D8129284BCAB100B3EE54 /* Window+Shake.swift in Sources */ = {isa = PBXBuildFile; fileRef = 764D8128284BCAB100B3EE54 /* Window+Shake.swift */; };
Expand Down Expand Up @@ -1109,6 +1110,7 @@
767B939D2A28289E0038935E /* View+Shake.swift in Sources */,
760418D22A1332210051411B /* SignInWindowController.swift in Sources */,
7611CEC0288B75140063A644 /* XCredsCreateUser.swift in Sources */,
764859F22B2FA2E800507C16 /* Window+ForceToFront.swift in Sources */,
766355D42870F29A002E3867 /* TestWindowController.swift in Sources */,
766355C32870CB6F002E3867 /* XCredsLoginPlugin.m in Sources */,
766355CB2870E5E9002E3867 /* NSFileManager+TCSRealHomeFolder.m in Sources */,
Expand Down Expand Up @@ -1299,7 +1301,7 @@
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 6059;
CURRENT_PROJECT_VERSION = 6092;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = UXP6YEHSPW;
FRAMEWORK_SEARCH_PATHS = (
Expand Down Expand Up @@ -1337,7 +1339,7 @@
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 6059;
CURRENT_PROJECT_VERSION = 6092;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = UXP6YEHSPW;
FRAMEWORK_SEARCH_PATHS = (
Expand Down Expand Up @@ -1457,7 +1459,7 @@
CODE_SIGN_ENTITLEMENTS = "XCreds Login Overlay/XCreds_Login_Overlay.entitlements";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 6059;
CURRENT_PROJECT_VERSION = 6092;
DEVELOPMENT_TEAM = UXP6YEHSPW;
ENABLE_HARDENED_RUNTIME = YES;
FRAMEWORK_SEARCH_PATHS = (
Expand Down Expand Up @@ -1494,7 +1496,7 @@
CODE_SIGN_ENTITLEMENTS = "XCreds Login Overlay/XCreds_Login_Overlay.entitlements";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 6059;
CURRENT_PROJECT_VERSION = 6092;
DEVELOPMENT_TEAM = UXP6YEHSPW;
ENABLE_HARDENED_RUNTIME = YES;
FRAMEWORK_SEARCH_PATHS = (
Expand Down Expand Up @@ -1644,7 +1646,7 @@
CODE_SIGN_ENTITLEMENTS = XCreds/xCreds.entitlements;
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 6059;
CURRENT_PROJECT_VERSION = 6092;
DEVELOPMENT_TEAM = UXP6YEHSPW;
ENABLE_HARDENED_RUNTIME = YES;
FRAMEWORK_SEARCH_PATHS = (
Expand Down Expand Up @@ -1685,7 +1687,7 @@
CODE_SIGN_ENTITLEMENTS = XCreds/xCreds.entitlements;
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 6059;
CURRENT_PROJECT_VERSION = 6092;
DEVELOPMENT_TEAM = UXP6YEHSPW;
ENABLE_HARDENED_RUNTIME = YES;
FRAMEWORK_SEARCH_PATHS = (
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
<key>auth_mech_fixup.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>7</integer>
<integer>8</integer>
</dict>
<key>authrights.xcscheme_^#shared#^_</key>
<dict>
Expand All @@ -42,7 +42,7 @@
<key>test.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>8</integer>
<integer>7</integer>
</dict>
</dict>
<key>SuppressBuildableAutocreation</key>
Expand Down

0 comments on commit f40cf39

Please sign in to comment.