From 976169e85810274c3742a152de67f7f8d71a9e0c Mon Sep 17 00:00:00 2001 From: C4ndyF1sh <128715345+C4ndyF1sh@users.noreply.github.com> Date: Mon, 14 Apr 2025 23:14:48 +0200 Subject: [PATCH 1/3] Add check if 17.4+ is installed --- StikJIT/StikJITApp.swift | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/StikJIT/StikJITApp.swift b/StikJIT/StikJITApp.swift index e55f2222..cb190b05 100644 --- a/StikJIT/StikJITApp.swift +++ b/StikJIT/StikJITApp.swift @@ -34,7 +34,6 @@ func httpGet(_ urlString: String, result: @escaping (String?) -> Void) { if let data = data, let httpResponse = response as? HTTPURLResponse { if httpResponse.statusCode == 200 { print("Response: \(httpResponse.statusCode)") - if let dataString = String(data: data, encoding: .utf8) { result(dataString) } @@ -214,6 +213,8 @@ struct HeartbeatApp: App { window.overrideUserInterfaceStyle = .unspecified } } + + // Removed the version check from here since it now runs inside LoadingView.onAppear. } func newVerCheck() { @@ -251,7 +252,8 @@ struct HeartbeatApp: App { var body: some Scene { WindowGroup { if isLoading2 { - LoadingView() + // Pass bindings to LoadingView for alert handling and version check. + LoadingView(showAlert: $show_alert, alertTitle: $alert_title, alertMessage: $alert_string) .onAppear { dnsChecker.checkDNS() @@ -589,6 +591,10 @@ func startHeartbeatInBackground() { } struct LoadingView: View { + @Binding var showAlert: Bool + @Binding var alertTitle: String + @Binding var alertMessage: String + @State private var animate = false @Environment(\.colorScheme) private var colorScheme @AppStorage("customAccentColor") private var customAccentColorHex: String = "" @@ -641,6 +647,14 @@ struct LoadingView: View { .shadow(color: accentColor.opacity(0.4), radius: 10, x: 0, y: 0) .onAppear { animate = true + + // iOS Version Check: if the device is running iOS lower than 17.4, + // set the alert bindings so that the alert is shown. + if #unavailable(iOS 17.4) { + alertTitle = "Unsupported OS Version" + alertMessage = "StikJIT only supports iOS/iPadOS 17.4 and above.\nYou're running an older version." + showAlert = true + } } Text("Loading...") From 7285e41654bf21ab8c3de3350c1a7b3604add917 Mon Sep 17 00:00:00 2001 From: C4ndyF1sh <128715345+C4ndyF1sh@users.noreply.github.com> Date: Mon, 14 Apr 2025 23:28:33 +0200 Subject: [PATCH 2/3] forgot to delete a note --- StikJIT/StikJITApp.swift | 2 -- 1 file changed, 2 deletions(-) diff --git a/StikJIT/StikJITApp.swift b/StikJIT/StikJITApp.swift index cb190b05..2e42f5ee 100644 --- a/StikJIT/StikJITApp.swift +++ b/StikJIT/StikJITApp.swift @@ -213,8 +213,6 @@ struct HeartbeatApp: App { window.overrideUserInterfaceStyle = .unspecified } } - - // Removed the version check from here since it now runs inside LoadingView.onAppear. } func newVerCheck() { From 696ad4cef7873be7a5b9f497597f10b821e6fc77 Mon Sep 17 00:00:00 2001 From: C4ndyF1sh <128715345+C4ndyF1sh@users.noreply.github.com> Date: Tue, 15 Apr 2025 00:08:14 +0200 Subject: [PATCH 3/3] actually check the installed os version now --- StikJIT/StikJITApp.swift | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/StikJIT/StikJITApp.swift b/StikJIT/StikJITApp.swift index 2e42f5ee..ea5bff97 100644 --- a/StikJIT/StikJITApp.swift +++ b/StikJIT/StikJITApp.swift @@ -646,15 +646,15 @@ struct LoadingView: View { .onAppear { animate = true - // iOS Version Check: if the device is running iOS lower than 17.4, - // set the alert bindings so that the alert is shown. - if #unavailable(iOS 17.4) { - alertTitle = "Unsupported OS Version" - alertMessage = "StikJIT only supports iOS/iPadOS 17.4 and above.\nYou're running an older version." - showAlert = true - } - } - + let os = ProcessInfo.processInfo.operatingSystemVersion + if os.majorVersion < 17 || (os.majorVersion == 17 && os.minorVersion < 4) { + // Show alert for unsupported host iOS version + alertTitle = "Unsupported OS Version" + alertMessage = "StikJIT only supports 17.4 and above. Your device is running iOS/iPadOS \(os.majorVersion).\(os.minorVersion).\(os.patchVersion)" + showAlert = true + } + } + Text("Loading...") .font(.system(size: 20, weight: .medium, design: .rounded)) .foregroundColor(isDarkMode ? .white.opacity(0.8) : .black.opacity(0.8))