Pickers gray out mismatched descriptors with a tooltip and disable the Add action. Sidebars badge instruments skipped at restore time. Custom defs grow a Compatibility… popover with canonical Frida values (macOS, x86_64, MIPS, …).
30 lines
847 B
Swift
30 lines
847 B
Swift
import Foundation
|
|
import Frida
|
|
|
|
public actor SystemParametersCache {
|
|
private var entries: [String: Task<SystemParameters?, Never>] = [:]
|
|
|
|
public init() {}
|
|
|
|
public func parameters(for device: Device) async -> SystemParameters? {
|
|
let deviceID = device.id
|
|
if let inflight = entries[deviceID] {
|
|
return await inflight.value
|
|
}
|
|
let task = Task { () -> SystemParameters? in
|
|
guard let raw = try? await device.querySystemParameters() else { return nil }
|
|
return SystemParameters(raw: raw)
|
|
}
|
|
entries[deviceID] = task
|
|
return await task.value
|
|
}
|
|
|
|
public func invalidate(deviceID: String) {
|
|
entries[deviceID] = nil
|
|
}
|
|
|
|
public func retain(deviceIDs: Set<String>) {
|
|
entries = entries.filter { deviceIDs.contains($0.key) }
|
|
}
|
|
}
|