diff --git a/Sesame-Watch Watch App/Settings/SettingsNumberInputView.swift b/Sesame-Watch Watch App/Settings/SettingsNumberInputView.swift index 7d30b9e..d23e04c 100644 --- a/Sesame-Watch Watch App/Settings/SettingsNumberInputView.swift +++ b/Sesame-Watch Watch App/Settings/SettingsNumberInputView.swift @@ -1,11 +1,11 @@ import SwiftUI -struct SettingsNumberInputView: View { +struct SettingsNumberInputView: View where Value: FixedWidthInteger { let title: String @Binding - var value: Int + var value: Value @State private var text: String = "" @@ -16,7 +16,7 @@ struct SettingsNumberInputView: View { VStack(alignment: .leading) { TextField(title, text: $text) .onSubmit { - guard let newValue = Int(text) else { + guard let newValue = Value(text) else { return } value = newValue diff --git a/Sesame-Watch Watch App/Settings/SettingsNumberItemLink.swift b/Sesame-Watch Watch App/Settings/SettingsNumberItemLink.swift index 5e5f331..7b98e20 100644 --- a/Sesame-Watch Watch App/Settings/SettingsNumberItemLink.swift +++ b/Sesame-Watch Watch App/Settings/SettingsNumberItemLink.swift @@ -1,11 +1,11 @@ import SwiftUI -struct SettingsNumberItemLink: View { +struct SettingsNumberItemLink: View where Value: FixedWidthInteger { let title: String @Binding - var value: Int + var value: Value let footnote: String diff --git a/Sesame-Watch Watch App/SettingsView.swift b/Sesame-Watch Watch App/SettingsView.swift index 190efc7..e27a02d 100644 --- a/Sesame-Watch Watch App/SettingsView.swift +++ b/Sesame-Watch Watch App/SettingsView.swift @@ -11,6 +11,9 @@ struct SettingsView: View { @AppStorage("localIP") var localAddress: String = "192.168.178.104/" + @AppStorage("localPort") + var localPort: UInt16 = 8888 + @EnvironmentObject var keys: KeyManagement @@ -38,17 +41,21 @@ struct SettingsView: View { title: "Local url", value: $localAddress, footnote: "The url where the device can be reached directly on the local WiFi network.") + SettingsNumberItemLink( + title: "Local port", + value: $localPort, + footnote: "The port for the local connection") SettingsKeyItemLink( type: .deviceKey, - footnote: "Some text describing the purpose of the key.") + footnote: "The key used by the device for responses") .environmentObject(keys) SettingsKeyItemLink( type: .remoteKey, - footnote: "Some text describing the purpose of the key.") + footnote: "The key used by the remote for requests.") .environmentObject(keys) SettingsKeyItemLink( type: .authToken, - footnote: "Some text describing the purpose of the key.") + footnote: "The authentication token of the remote for the server.") .environmentObject(keys) } .navigationTitle("Settings") diff --git a/Sesame.xcodeproj/project.pbxproj b/Sesame.xcodeproj/project.pbxproj index a3eabd7..3f6265c 100644 --- a/Sesame.xcodeproj/project.pbxproj +++ b/Sesame.xcodeproj/project.pbxproj @@ -86,6 +86,7 @@ E24EE77927FF95E00011CFD2 /* Message.swift in Sources */ = {isa = PBXBuildFile; fileRef = E24EE77827FF95E00011CFD2 /* Message.swift */; }; E24F6C6E2A89749A0040F8C4 /* ConnectionStrategy.swift in Sources */ = {isa = PBXBuildFile; fileRef = E24F6C6D2A89749A0040F8C4 /* ConnectionStrategy.swift */; }; E24F6C6F2A8974C60040F8C4 /* ConnectionStrategy.swift in Sources */ = {isa = PBXBuildFile; fileRef = E24F6C6D2A89749A0040F8C4 /* ConnectionStrategy.swift */; }; + E25231782C0227B500FFE373 /* UDPClient.swift in Sources */ = {isa = PBXBuildFile; fileRef = 88BA7DD22BD41B8A008F2A3C /* UDPClient.swift */; }; E25317562A8A1ABF005A537D /* HistoryItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = E28DED34281EB17600259690 /* HistoryItem.swift */; }; E268E0822A85302000185913 /* WidgetKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E268E0532A852F8E00185913 /* WidgetKit.framework */; }; E268E0832A85302000185913 /* SwiftUI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E268E0552A852F8E00185913 /* SwiftUI.framework */; }; @@ -610,6 +611,7 @@ 8860D76C2B246F5E00849FAC /* UInt32+Random.swift in Sources */, E240655A2A82218D009C1AD8 /* SettingsKeyInputView.swift in Sources */, 8860D76F2B246FC400849FAC /* Text+Extensions.swift in Sources */, + E25231782C0227B500FFE373 /* UDPClient.swift in Sources */, 88E197D229EDCE6600BF1D19 /* SesameRoute.swift in Sources */, 8860D75E2B237FC600849FAC /* Message+Size.swift in Sources */, 8860D7552B237F9100849FAC /* TransmissionType.swift in Sources */, diff --git a/Sesame.xcodeproj/project.xcworkspace/xcuserdata/ch.xcuserdatad/UserInterfaceState.xcuserstate b/Sesame.xcodeproj/project.xcworkspace/xcuserdata/ch.xcuserdatad/UserInterfaceState.xcuserstate index 6f7fa7f..abeefdf 100644 Binary files a/Sesame.xcodeproj/project.xcworkspace/xcuserdata/ch.xcuserdatad/UserInterfaceState.xcuserstate and b/Sesame.xcodeproj/project.xcworkspace/xcuserdata/ch.xcuserdatad/UserInterfaceState.xcuserstate differ