Merge pull request #48 from neoarz/main

fix stuff
This commit is contained in:
Stephen 2025-03-31 15:20:04 -04:00 • committed by GitHub
commit a79e759e44
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -27,6 +27,8 @@ struct SettingsView: View {
@State private var showingConsoleLogsView = false @State private var showingConsoleLogsView = false
@State private var remoteVersion: String = "-"
// Developer profile image URLs // Developer profile image URLs
private let developerProfiles: [String: String] = [ private let developerProfiles: [String: String] = [
"Stephen": "https://github.com/0-Blu.png", "Stephen": "https://github.com/0-Blu.png",
@ -47,17 +49,19 @@ struct SettingsView: View {
VStack(spacing: 12) { VStack(spacing: 12) {
// App Logo and Username Section // App Logo and Username Section
VStack(spacing: 16) { VStack(spacing: 16) {
// App Logo // bruh why how did i forget to add this lol
Image("StikJIT") VStack {
.resizable() Image("StikJIT")
.aspectRatio(contentMode: .fit) .resizable()
.frame(width: 80, height: 80) .aspectRatio(contentMode: .fit)
.clipShape(RoundedRectangle(cornerRadius: 16)) .frame(width: 80, height: 80)
.padding(.top, 16) .clipShape(RoundedRectangle(cornerRadius: 16))
.overlay( .overlay(
RoundedRectangle(cornerRadius: 16) RoundedRectangle(cornerRadius: 16)
.stroke(Color.gray.opacity(0.2), lineWidth: 1) .stroke(Color.gray.opacity(0.2), lineWidth: 1)
) )
}
.padding(.top, 16)
Text("StikJIT") Text("StikJIT")
.font(.title2) .font(.title2)
@ -433,11 +437,20 @@ struct SettingsView: View {
// Version info should now come after System Logs // Version info should now come after System Logs
HStack { HStack {
Spacer() Spacer()
let fileURL = URL.documentsDirectory.appendingPathComponent("version.txt")
let ver = (try? String(contentsOfFile: fileURL.path)) ?? "-" if remoteVersion == "-" {
Text("Version \(ver) • iOS \(UIDevice.current.systemVersion)") Text("Checking version...")
.font(.footnote) .font(.footnote)
.foregroundColor(.secondary.opacity(0.8)) .foregroundColor(.secondary.opacity(0.8))
.onAppear {
fetchVersionFromGitHub()
}
} else {
Text("Version \(remoteVersion) • iOS \(UIDevice.current.systemVersion)")
.font(.footnote)
.foregroundColor(.secondary.opacity(0.8))
}
Spacer() Spacer()
} }
.padding(.top, 8) .padding(.top, 8)
@ -563,6 +576,25 @@ struct SettingsView: View {
} }
.padding(.horizontal) .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 // Helper components