mirror of
https://github.com/StikDebug/StikDebug.git
synced 2026-10-16 12:30:29 +00:00
version + revert LC + show ver in settings
This commit is contained in:
parent
8518b28bce
commit
1fefbc4fc6
2 changed files with 25 additions and 7 deletions
|
|
@ -11,7 +11,8 @@ import em_proxy
|
|||
import UniformTypeIdentifiers
|
||||
|
||||
let fileManager = FileManager.default
|
||||
let one_time_hardcoded_version = "1.0.0"
|
||||
|
||||
|
||||
|
||||
func httpGet(_ urlString: String, result: @escaping (String?) -> Void){
|
||||
if let url = URL(string: urlString) {
|
||||
|
|
@ -50,11 +51,26 @@ func httpGet(_ urlString: String, result: @escaping (String?) -> Void){
|
|||
func UpdateRetrieval() -> Bool{
|
||||
let fileURL = URL.documentsDirectory.appendingPathComponent("version.txt")
|
||||
if !fileManager.fileExists(atPath: fileURL.path) {
|
||||
do {
|
||||
try one_time_hardcoded_version.write(to: fileURL, atomically: true, encoding: .utf8)
|
||||
print("Wrote to file successfully")
|
||||
} catch {
|
||||
print("Error writing to file: \(error)")
|
||||
|
||||
let urlString = "https://raw.githubusercontent.com/0-Blu/StikJIT/refs/heads/main/version.txt"
|
||||
var FileContent: String = "";
|
||||
|
||||
httpGet(urlString) { result in
|
||||
if let fc = result {
|
||||
FileContent = fc
|
||||
}
|
||||
|
||||
}
|
||||
if (FileContent == ""){
|
||||
do {
|
||||
try FileContent.write(to: fileURL, atomically: true, encoding: .utf8)
|
||||
|
||||
print("Wrote to file successfully")
|
||||
} catch {
|
||||
print("Error writing to file: \(error)")
|
||||
}
|
||||
} else {
|
||||
print("Failed to get version.txt, will try again later.")
|
||||
}
|
||||
}
|
||||
let ver = try! String(contentsOfFile: fileURL.path)
|
||||
|
|
|
|||
|
|
@ -412,7 +412,9 @@ struct SettingsView: View {
|
|||
// Version info should now come after System Logs
|
||||
HStack {
|
||||
Spacer()
|
||||
Text("Version 1.1 • iOS \(UIDevice.current.systemVersion)")
|
||||
let fileURL = URL.documentsDirectory.appendingPathComponent("version.txt")
|
||||
let ver = try! String(contentsOfFile: fileURL.path)
|
||||
Text("Version \(ver) • iOS \(UIDevice.current.systemVersion)")
|
||||
.font(.footnote)
|
||||
.foregroundColor(.secondary.opacity(0.8))
|
||||
Spacer()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue