Files
VirtualBuddy/VirtualInstallation/Source/Backend/DeviceRestoreBackend.swift
Guilherme Rambo b405b1aaf6 Surface MobileDevice installation errors for VirtualInstallation-backed installs (#719)
* Display MobileDevice installation errors in the UI when installation fails, add export logs button for VirtualInstallation-backed restores

* Add debug flag to simulate MobileDevice install error end-to-end
2026-07-24 13:05:35 -03:00

33 lines
990 B
Swift

import Foundation
struct DeviceRestoreLoggers: @unchecked Sendable {
var global: RestoreLog? = nil
var device: RestoreLog? = nil
var host: RestoreLog? = nil
var serial: RestoreLog? = nil
var fileURLs: [URL] {
[global, device, host, serial].compactMap { log in
guard let fileURL = log?.fileURL,
FileManager.default.fileExists(atPath: fileURL.path) else { return nil }
return fileURL
}
}
var mostRecentRestoreError: NSError? {
[global, host, device, serial]
.lazy
.compactMap { $0?.mostRecentRestoreError() }
.first
}
}
typealias DeviceRestoreProgressClosure = @Sendable (_ info: CFDictionary) -> Void
protocol DeviceRestoreBackend: AnyObject {
func restore(deviceECID: ECID,
options: [String: AnyHashable],
loggers: DeviceRestoreLoggers,
progress: @escaping DeviceRestoreProgressClosure) throws
}