From 3550688545129587e6ec85859f7a186fd16d1d6c Mon Sep 17 00:00:00 2001 From: Stossy11 <69031796+stossy11@users.noreply.github.com> Date: Fri, 28 Mar 2025 08:13:54 +1100 Subject: [PATCH] Check for Pairing File --- StikJIT/StikJITApp.swift | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/StikJIT/StikJITApp.swift b/StikJIT/StikJITApp.swift index 2f5460a..8c99d9e 100644 --- a/StikJIT/StikJITApp.swift +++ b/StikJIT/StikJITApp.swift @@ -21,24 +21,27 @@ struct HeartbeatApp: App { if isLoading { LoadingView() .onAppear { - Timer.scheduledTimer(withTimeInterval: 0.5, repeats: true) { timer in - if heartBeat { - isLoading = false - timer.invalidate() - } else { - if let error { - if error == InvalidHostID.rawValue { - isPairing = true - } else { - startHeartbeatInBackground() - } - self.error = nil - } - } - } startProxy() if FileManager.default.fileExists(atPath: URL.documentsDirectory.appendingPathComponent("pairingFile.plist").path) { + Timer.scheduledTimer(withTimeInterval: 0.5, repeats: true) { timer in + if heartBeat { + isLoading = false + timer.invalidate() + } else { + if let error { + if error == InvalidHostID.rawValue { + isPairing = true + } else { + startHeartbeatInBackground() + } + self.error = nil + } + } + } + startHeartbeatInBackground() + } else { + isLoading = false } } .fileImporter(isPresented: $isPairing, allowedContentTypes: [UTType(filenameExtension: "mobiledevicepairing", conformingTo: .data)!, .propertyList]) {result in