Fix SideJITServer Support for iOS 17+ (#674)

* FIx SideJITServer Support

* Fix SideJITServer Address

* Add Warning when Overwriting SideJITServer Address

* Fix Optional Value for SideJITServer URL

* Update SideJITServer Address Overwriting

* Fix Enabling JIT and Fix IP Address Loop

* Fix No WiFi or VPN! error when using SideJITServer
This commit is contained in:
stossy11
2024-08-15 09:58:26 +10:00
committed by GitHub
parent 1f5cc8f283
commit feace61eb4
4 changed files with 94 additions and 48 deletions

View File

@@ -641,10 +641,48 @@ extension SettingsViewController
case .refreshSideJITServer:
if #available(iOS 17, *) {
let alertController = UIAlertController(
title: NSLocalizedString("Are you sure to Refresh SideJITServer?", comment: ""),
message: NSLocalizedString("if you do not have SideJITServer setup this will do nothing", comment: ""),
title: NSLocalizedString("SideJITServer", comment: ""),
message: NSLocalizedString("Settings for SideJITServer", comment: ""),
preferredStyle: UIAlertController.Style.actionSheet)
if UserDefaults.standard.sidejitenable {
alertController.addAction(UIAlertAction(title: NSLocalizedString("Disable", comment: ""), style: .default){ _ in
UserDefaults.standard.sidejitenable = false
})
} else {
alertController.addAction(UIAlertAction(title: NSLocalizedString("Enable", comment: ""), style: .default){ _ in
UserDefaults.standard.sidejitenable = true
})
}
alertController.addAction(UIAlertAction(title: NSLocalizedString("Server Address", comment: ""), style: .default){ _ in
let alertController1 = UIAlertController(title: "SideJITServer Address", message: "Please Enter the SideJITServer Address Below. (this is not needed if SideJITServer has already been detected)", preferredStyle: .alert)
alertController1.addTextField { textField in
textField.placeholder = "SideJITServer Address"
}
let cancelAction = UIAlertAction(title: "Cancel", style: .cancel, handler: nil)
alertController1.addAction(cancelAction)
let okAction = UIAlertAction(title: "OK", style: .default) { _ in
if let text = alertController1.textFields?.first?.text {
UserDefaults.standard.textInputSideJITServerurl = text
}
}
alertController1.addAction(okAction)
// Present the alert controller
self.present(alertController1, animated: true)
})
alertController.addAction(UIAlertAction(title: NSLocalizedString("Refresh", comment: ""), style: .destructive){ _ in
if UserDefaults.standard.sidejitenable {
@@ -653,7 +691,7 @@ extension SettingsViewController
SJSURL = "http://sidejitserver._http._tcp.local:8080"
} else {
SJSURL = UserDefaults.standard.textInputSideJITServerurl ?? ""
} // replace with your URL
}
let url = URL(string: SJSURL + "/re/")!
@@ -669,8 +707,10 @@ extension SettingsViewController
task.resume()
}
})
alertController.addAction(.cancel)
let cancelAction = UIAlertAction(title: "Cancel", style: .cancel, handler: nil)
alertController.addAction(cancelAction)
//Fix crash on iPad
alertController.popoverPresentationController?.sourceView = self.tableView
alertController.popoverPresentationController?.sourceRect = self.tableView.rectForRow(at: indexPath)
@@ -682,10 +722,6 @@ extension SettingsViewController
message: NSLocalizedString("This is meant for 'SideJITServer' and it only works on iOS 17+ ", comment: ""),
preferredStyle: UIAlertController.Style.actionSheet)
alertController.addAction(UIAlertAction(title: NSLocalizedString("OK", comment: ""), style: .destructive){ _ in
print("Not on iOS 17")
})
alertController.addAction(.cancel)
//Fix crash on iPad
alertController.popoverPresentationController?.sourceView = self.tableView
@@ -698,8 +734,11 @@ extension SettingsViewController
case .clearCache: self.clearCache()
case .resetPairingFile:
let filename = "ALTPairingFile.mobiledevicepairing"
let fm = FileManager.default
let documentsPath = fm.documentsDirectory.appendingPathComponent("/\(filename)")
let alertController = UIAlertController(
title: NSLocalizedString("Are you sure to reset the pairing file?", comment: ""),
@@ -722,6 +761,7 @@ extension SettingsViewController
alertController.popoverPresentationController?.sourceRect = self.tableView.rectForRow(at: indexPath)
self.present(alertController, animated: true)
self.tableView.deselectRow(at: indexPath, animated: true)
case .anisetteServers:
self.prepare(for: UIStoryboardSegue(identifier: "anisetteServers", source: self, destination: UIHostingController(rootView: AnisetteServers(selected: "", errorCallback: {
ToastView(text: "Reset adi.pb", detailText: "Buh").show(in: self)