Skip to content

Commit f71f342

Browse files
committed
Fix return key behavior, remove revoke warning, and make frontmost app when necessary
1 parent ab254ee commit f71f342

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

AltServer/AppDelegate.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,6 @@ private extension AppDelegate
122122

123123
@objc func sideloadIPA(to device: ALTDevice)
124124
{
125-
NSRunningApplication.current.activate(options: .activateIgnoringOtherApps)
126125

127126
let openPanel = NSOpenPanel()
128127
openPanel.canChooseDirectories = false
@@ -132,6 +131,7 @@ private extension AppDelegate
132131
guard let fileURL = openPanel.url, response == .OK else { return }
133132
self.installApplication(at: fileURL, to: device)
134133
}
134+
NSRunningApplication.current.activate(options: .activateIgnoringOtherApps)
135135
}
136136

137137
func enableJIT(for app: InstalledApp, on device: ALTDevice)
@@ -329,7 +329,7 @@ private extension AppDelegate {
329329
logInMenuItem.action = #selector(logoutFromAppleID)
330330
} catch {
331331
print("Error getting stored AppleID credentials: \(error)")
332-
logInMenuItem.title = "Save Apple ID to Keychain..."
332+
logInMenuItem.title = "Save New Apple ID to Keychain..."
333333
logInMenuItem.action = #selector(loginToAppleID)
334334
}
335335
}
@@ -441,6 +441,7 @@ extension AppDelegate: NSMenuDelegate
441441

442442
func menuDidClose(_ menu: NSMenu)
443443
{
444+
NSRunningApplication.current.activate(options: .activateIgnoringOtherApps)
444445
guard menu == self.appMenu else { return }
445446

446447
// Clearing _jitAppListMenuControllers now prevents action handler from being called.

AltServer/Devices/ALTDeviceManager+Installation.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ private extension ALTDeviceManager
360360

361361
// Check if there is another AltStore certificate, which means AltStore has been installed with this Apple ID before.
362362
let altstoreCertificate = certificates.first { $0.machineName?.starts(with: "AltStore") == true }
363-
if let previousCertificate = altstoreCertificate
363+
/*if let previousCertificate = altstoreCertificate
364364
{
365365
if FileManager.default.fileExists(atPath: certificateFileURL.path),
366366
let data = try? Data(contentsOf: certificateFileURL),
@@ -389,7 +389,7 @@ private extension ALTDeviceManager
389389
}
390390

391391
guard !isCancelled else { return completionHandler(.failure(InstallError.cancelled)) }
392-
}
392+
}*/
393393

394394
func addCertificate()
395395
{

AltServer/Views/AppleIDAuthenticationAlert.swift

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,16 +53,17 @@ final class AppleIDAuthenticationAlert: NSAlert {
5353

5454
window.initialFirstResponder = appleIDTextField
5555

56-
addButton(withTitle: NSLocalizedString("Cancel", comment: ""))
5756
addButton(withTitle: NSLocalizedString("Continue", comment: ""))
57+
addButton(withTitle: NSLocalizedString("Cancel", comment: ""))
5858

5959
validateTextFields()
6060
}
6161

6262
/// Displays the alert modally, and returns a `Bool` saying whether the user did press "Continue".
6363
func display() -> Bool {
6464
let result = runModal()
65-
return result == .alertSecondButtonReturn
65+
NSRunningApplication.current.activate(options: .activateIgnoringOtherApps)
66+
return result == .alertFirstButtonReturn
6667
}
6768
}
6869

@@ -80,6 +81,6 @@ private extension AppleIDAuthenticationAlert {
8081
func validateTextFields() {
8182
let isAppleIDTextFieldValid = !appleIDValue.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty
8283
let isPasswordTextFieldValid = !passwordValue.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty
83-
buttons.last?.isEnabled = isAppleIDTextFieldValid && isPasswordTextFieldValid
84+
buttons.first?.isEnabled = isAppleIDTextFieldValid && isPasswordTextFieldValid
8485
}
8586
}

0 commit comments

Comments
 (0)