Add check if 17.4+ is installed

This commit is contained in:
C4ndyF1sh 2025-04-14 23:14:48 +02:00 • committed by GitHub
parent 0107dc434d
commit 976169e858
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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...")