[AltServer] Fixes not ignoring InstallationError.cancelled when installing app

Allows InstallationError to be bridged back from NSError, which lets us match InstallationError against NSError's via pattern matching.
This commit is contained in:
Riley Testut
2021-10-04 15:36:16 -07:00
parent 44b0092b44
commit a4d7d94301

View File

@@ -14,7 +14,7 @@ private let appGroupsLock = NSLock()
private let developerDiskManager = DeveloperDiskManager()
enum InstallError: LocalizedError
enum InstallError: Int, LocalizedError, _ObjectiveCBridgeableError
{
case cancelled
case noTeam
@@ -30,6 +30,20 @@ enum InstallError: LocalizedError
case .missingCertificate: return "The developer certificate could not be found."
}
}
init?(_bridgedNSError error: NSError)
{
guard error.domain == InstallError.cancelled._domain else { return nil }
if let installError = InstallError(rawValue: error.code)
{
self = installError
}
else
{
return nil
}
}
}
extension ALTDeviceManager