File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -11,6 +11,12 @@ enum DeviceConnectionContext {
1111 static let defaultTargetIPAddress = " 10.7.0.1 "
1212
1313 static var targetIPAddress : String {
14- defaultTargetIPAddress
14+ let stored = UserDefaults . standard
15+ . string ( forKey: UserDefaults . Keys. targetDeviceIP) ?
16+ . trimmingCharacters ( in: . whitespacesAndNewlines)
17+ guard let stored, !stored. isEmpty else {
18+ return defaultTargetIPAddress
19+ }
20+ return stored
1521 }
1622}
Original file line number Diff line number Diff line change @@ -103,16 +103,11 @@ final class TunnelManager: ObservableObject {
103103 }
104104
105105 private func handleInvalidPairingFile( ) {
106- do {
107- try PairingFileStore . remove ( )
108- LogManager . shared. addInfoLog ( " Removed invalid pairing file " )
109- } catch {
110- LogManager . shared. addErrorLog ( " Failed to remove invalid pairing file: \( error. localizedDescription) " )
111- }
106+ LogManager . shared. addInfoLog ( " Pairing file reported invalid; keeping existing file " )
112107
113108 showAlert (
114109 title: " Invalid Pairing File " ,
115- message: " The pairing file is invalid or expired. Please select a new pairing file. " ,
110+ message: " The pairing file may be invalid or expired. You can import a new pairing file to replace it . " ,
116111 showOk: true ,
117112 showTryAgain: false ,
118113 primaryButtonText: " Select New File "
Original file line number Diff line number Diff line change @@ -14,5 +14,6 @@ extension UserDefaults {
1414 static let bundleScriptMap = " BundleScriptMap "
1515 static let defaultScriptName = " DefaultScriptName "
1616 static let defaultScriptNameValue = " "
17+ static let targetDeviceIP = " TunnelDeviceIP "
1718 }
1819}
Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ struct SettingsView: View {
1818 @AppStorage ( UserDefaults . Keys. confirmExternalJITRequests) private var confirmExternalJITRequests = true
1919 @AppStorage ( " keepAliveAudio " ) private var keepAliveAudio = true
2020 @AppStorage ( " keepAliveLocation " ) private var keepAliveLocation = true
21+ @AppStorage ( UserDefaults . Keys. targetDeviceIP) private var targetDeviceIP = DeviceConnectionContext . defaultTargetIPAddress
2122
2223 @State private var isShowingPairingFilePicker = false
2324 @State private var isImportingFile = false
@@ -134,8 +135,13 @@ struct SettingsView: View {
134135 HStack {
135136 Text ( " Target Device IP " )
136137 Spacer ( )
137- Text ( DeviceConnectionContext . defaultTargetIPAddress)
138+ TextField ( DeviceConnectionContext . defaultTargetIPAddress, text: $targetDeviceIP)
139+ . multilineTextAlignment ( . trailing)
138140 . foregroundStyle ( . secondary)
141+ . textInputAutocapitalization ( . never)
142+ . autocorrectionDisabled ( true )
143+ . keyboardType ( . numbersAndPunctuation)
144+ . frame ( maxWidth: 160 )
139145 }
140146 Button { openAppFolder ( ) } label: {
141147 Label ( " App Folder " , systemImage: " folder " )
You can’t perform that action at this time.
0 commit comments