mirror of
https://github.com/StikDebug/StikDebug.git
synced 2026-10-16 12:30:29 +00:00
Check if can read pairing file before mounting
This commit is contained in:
parent
e3de3d4ab3
commit
c5011654a2
1 changed files with 12 additions and 2 deletions
|
|
@ -162,7 +162,6 @@ class MountingProgress: ObservableObject {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
func pubMount() { mount() }
|
||||
|
||||
private func mount() {
|
||||
|
|
@ -171,7 +170,7 @@ class MountingProgress: ObservableObject {
|
|||
let fileManager = FileManager.default
|
||||
let pairingpath = URL.documentsDirectory.appendingPathComponent("pairingFile.plist").path
|
||||
|
||||
if fileManager.fileExists(atPath: pairingpath), !isMounted() {
|
||||
if isPairing(), !isMounted() {
|
||||
if let mountingThread {
|
||||
mountingThread.cancel()
|
||||
self.mountingThread = nil
|
||||
|
|
@ -200,6 +199,17 @@ class MountingProgress: ObservableObject {
|
|||
}
|
||||
}
|
||||
|
||||
func isPairing() -> Bool {
|
||||
let pairingpath = URL.documentsDirectory.appendingPathComponent("pairingFile.plist").path
|
||||
var pairingFile: IdevicePairingFile?
|
||||
let err = idevice_pairing_file_read(pairingpath, &pairingFile)
|
||||
if err != IdeviceSuccess {
|
||||
print("Failed to read pairing file: \(err)")
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
func startHeartbeatInBackground() {
|
||||
let heartBeat = Thread {
|
||||
let completionHandler: @convention(block) (Int32, String?) -> Void = { result, message in
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue