mirror of
https://github.com/StikDebug/StikDebug.git
synced 2026-10-15 20:10:30 +00:00
Fix my mistake
This commit is contained in:
parent
1bb753086f
commit
c5b23e2282
4 changed files with 17 additions and 9 deletions
|
|
@ -11,6 +11,12 @@ enum DeviceConnectionContext {
|
|||
static let defaultTargetIPAddress = "10.7.0.1"
|
||||
|
||||
static var targetIPAddress: String {
|
||||
defaultTargetIPAddress
|
||||
let stored = UserDefaults.standard
|
||||
.string(forKey: UserDefaults.Keys.targetDeviceIP)?
|
||||
.trimmingCharacters(in: .whitespacesAndNewlines)
|
||||
guard let stored, !stored.isEmpty else {
|
||||
return defaultTargetIPAddress
|
||||
}
|
||||
return stored
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -103,16 +103,11 @@ final class TunnelManager: ObservableObject {
|
|||
}
|
||||
|
||||
private func handleInvalidPairingFile() {
|
||||
do {
|
||||
try PairingFileStore.remove()
|
||||
LogManager.shared.addInfoLog("Removed invalid pairing file")
|
||||
} catch {
|
||||
LogManager.shared.addErrorLog("Failed to remove invalid pairing file: \(error.localizedDescription)")
|
||||
}
|
||||
LogManager.shared.addInfoLog("Pairing file reported invalid; keeping existing file")
|
||||
|
||||
showAlert(
|
||||
title: "Invalid Pairing File",
|
||||
message: "The pairing file is invalid or expired. Please select a new pairing file.",
|
||||
message: "The pairing file may be invalid or expired. You can import a new pairing file to replace it.",
|
||||
showOk: true,
|
||||
showTryAgain: false,
|
||||
primaryButtonText: "Select New File"
|
||||
|
|
|
|||
|
|
@ -14,5 +14,6 @@ extension UserDefaults {
|
|||
static let bundleScriptMap = "BundleScriptMap"
|
||||
static let defaultScriptName = "DefaultScriptName"
|
||||
static let defaultScriptNameValue = ""
|
||||
static let targetDeviceIP = "TunnelDeviceIP"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ struct SettingsView: View {
|
|||
@AppStorage(UserDefaults.Keys.confirmExternalJITRequests) private var confirmExternalJITRequests = true
|
||||
@AppStorage("keepAliveAudio") private var keepAliveAudio = true
|
||||
@AppStorage("keepAliveLocation") private var keepAliveLocation = true
|
||||
@AppStorage(UserDefaults.Keys.targetDeviceIP) private var targetDeviceIP = DeviceConnectionContext.defaultTargetIPAddress
|
||||
|
||||
@State private var isShowingPairingFilePicker = false
|
||||
@State private var isImportingFile = false
|
||||
|
|
@ -134,8 +135,13 @@ struct SettingsView: View {
|
|||
HStack {
|
||||
Text("Target Device IP")
|
||||
Spacer()
|
||||
Text(DeviceConnectionContext.defaultTargetIPAddress)
|
||||
TextField(DeviceConnectionContext.defaultTargetIPAddress, text: $targetDeviceIP)
|
||||
.multilineTextAlignment(.trailing)
|
||||
.foregroundStyle(.secondary)
|
||||
.textInputAutocapitalization(.never)
|
||||
.autocorrectionDisabled(true)
|
||||
.keyboardType(.numbersAndPunctuation)
|
||||
.frame(maxWidth: 160)
|
||||
}
|
||||
Button { openAppFolder() } label: {
|
||||
Label("App Folder", systemImage: "folder")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue