mirror of
https://github.com/StikDebug/StikDebug.git
synced 2026-10-16 12:30:29 +00:00
fix version
This commit is contained in:
parent
e021a95add
commit
9b981ec299
1 changed files with 9 additions and 33 deletions
|
|
@ -27,8 +27,12 @@ struct SettingsView: View {
|
|||
|
||||
@State private var showingConsoleLogsView = false
|
||||
|
||||
@State private var remoteVersion: String = "-"
|
||||
|
||||
private var appVersion: String {
|
||||
let marketingVersion = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String ?? "1.0"
|
||||
let buildNumber = Bundle.main.infoDictionary?["CFBundleVersion"] as? String ?? "1"
|
||||
return "\(marketingVersion) (\(buildNumber))"
|
||||
}
|
||||
|
||||
// Developer profile image URLs
|
||||
private let developerProfiles: [String: String] = [
|
||||
"Stephen": "https://github.com/0-Blu.png",
|
||||
|
|
@ -438,18 +442,9 @@ struct SettingsView: View {
|
|||
HStack {
|
||||
Spacer()
|
||||
|
||||
if remoteVersion == "-" {
|
||||
Text("Checking version...")
|
||||
.font(.footnote)
|
||||
.foregroundColor(.secondary.opacity(0.8))
|
||||
.onAppear {
|
||||
fetchVersionFromGitHub()
|
||||
}
|
||||
} else {
|
||||
Text("Version \(remoteVersion) • iOS \(UIDevice.current.systemVersion)")
|
||||
.font(.footnote)
|
||||
.foregroundColor(.secondary.opacity(0.8))
|
||||
}
|
||||
Text("Version \(appVersion) • iOS \(UIDevice.current.systemVersion)")
|
||||
.font(.footnote)
|
||||
.foregroundColor(.secondary.opacity(0.8))
|
||||
|
||||
Spacer()
|
||||
}
|
||||
|
|
@ -576,25 +571,6 @@ struct SettingsView: View {
|
|||
}
|
||||
.padding(.horizontal)
|
||||
}
|
||||
|
||||
private func fetchVersionFromGitHub() {
|
||||
let versionURL = "https://raw.githubusercontent.com/0-Blu/StikJIT/refs/heads/main/version.txt"
|
||||
|
||||
guard let url = URL(string: versionURL) else { return }
|
||||
|
||||
URLSession.shared.dataTask(with: url) { data, response, error in
|
||||
guard let data = data, error == nil else {
|
||||
print("Failed to fetch version: \(error?.localizedDescription ?? "Unknown error")")
|
||||
return
|
||||
}
|
||||
|
||||
if let versionString = String(data: data, encoding: .utf8)?.trimmingCharacters(in: .whitespacesAndNewlines) {
|
||||
DispatchQueue.main.async {
|
||||
self.remoteVersion = versionString
|
||||
}
|
||||
}
|
||||
}.resume()
|
||||
}
|
||||
}
|
||||
|
||||
// Helper components
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue