mirror of
https://github.com/SideStore/SideStore.git
synced 2026-02-20 04:03:26 +01:00
[AltServer] Fixes duplicate "Revoke Development Certificate" alerts
This commit is contained in:
@@ -377,47 +377,7 @@ private extension ALTDeviceManager
|
|||||||
guard !isCancelled else { return completionHandler(.failure(InstallError.cancelled)) }
|
guard !isCancelled else { return completionHandler(.failure(InstallError.cancelled)) }
|
||||||
}
|
}
|
||||||
|
|
||||||
if team.type != .free
|
func addCertificate()
|
||||||
{
|
|
||||||
DispatchQueue.main.sync {
|
|
||||||
let alert = NSAlert()
|
|
||||||
alert.messageText = NSLocalizedString("Installing this app will revoke your iOS development certificate.", comment: "")
|
|
||||||
alert.informativeText = NSLocalizedString("""
|
|
||||||
This will not affect apps you've submitted to the App Store, but may cause apps you've installed to your devices with Xcode to stop working until you reinstall them.
|
|
||||||
|
|
||||||
To prevent this from happening, feel free to try again with another Apple ID.
|
|
||||||
""", comment: "")
|
|
||||||
|
|
||||||
alert.addButton(withTitle: NSLocalizedString("Continue", comment: ""))
|
|
||||||
alert.addButton(withTitle: NSLocalizedString("Cancel", comment: ""))
|
|
||||||
|
|
||||||
NSRunningApplication.current.activate(options: .activateIgnoringOtherApps)
|
|
||||||
|
|
||||||
let buttonIndex = alert.runModal()
|
|
||||||
if buttonIndex == NSApplication.ModalResponse.alertSecondButtonReturn
|
|
||||||
{
|
|
||||||
isCancelled = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
guard !isCancelled else { return completionHandler(.failure(InstallError.cancelled)) }
|
|
||||||
}
|
|
||||||
|
|
||||||
if let certificate = certificates.first
|
|
||||||
{
|
|
||||||
ALTAppleAPI.shared.revoke(certificate, for: team, session: session) { (success, error) in
|
|
||||||
do
|
|
||||||
{
|
|
||||||
try Result(success, error).get()
|
|
||||||
self.fetchCertificate(for: team, session: session, completionHandler: completionHandler)
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
completionHandler(.failure(error))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
ALTAppleAPI.shared.addCertificate(machineName: "AltStore", to: team, session: session) { (certificate, error) in
|
ALTAppleAPI.shared.addCertificate(machineName: "AltStore", to: team, session: session) { (certificate, error) in
|
||||||
do
|
do
|
||||||
@@ -458,6 +418,51 @@ To prevent this from happening, feel free to try again with another Apple ID.
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if let certificate = certificates.first
|
||||||
|
{
|
||||||
|
if team.type != .free
|
||||||
|
{
|
||||||
|
DispatchQueue.main.sync {
|
||||||
|
let alert = NSAlert()
|
||||||
|
alert.messageText = NSLocalizedString("Installing this app will revoke your iOS development certificate.", comment: "")
|
||||||
|
alert.informativeText = NSLocalizedString("""
|
||||||
|
This will not affect apps you've submitted to the App Store, but may cause apps you've installed to your devices with Xcode to stop working until you reinstall them.
|
||||||
|
|
||||||
|
To prevent this from happening, feel free to try again with another Apple ID.
|
||||||
|
""", comment: "")
|
||||||
|
|
||||||
|
alert.addButton(withTitle: NSLocalizedString("Continue", comment: ""))
|
||||||
|
alert.addButton(withTitle: NSLocalizedString("Cancel", comment: ""))
|
||||||
|
|
||||||
|
NSRunningApplication.current.activate(options: .activateIgnoringOtherApps)
|
||||||
|
|
||||||
|
let buttonIndex = alert.runModal()
|
||||||
|
if buttonIndex == NSApplication.ModalResponse.alertSecondButtonReturn
|
||||||
|
{
|
||||||
|
isCancelled = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
guard !isCancelled else { return completionHandler(.failure(InstallError.cancelled)) }
|
||||||
|
}
|
||||||
|
|
||||||
|
ALTAppleAPI.shared.revoke(certificate, for: team, session: session) { (success, error) in
|
||||||
|
do
|
||||||
|
{
|
||||||
|
try Result(success, error).get()
|
||||||
|
addCertificate()
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
completionHandler(.failure(error))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
addCertificate()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user