mirror of
https://github.com/insidegui/VirtualBuddy.git
synced 2026-12-02 00:29:56 +08:00
* 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
33 lines
990 B
Swift
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
|
|
}
|