diff --git a/Meshtastic.xcodeproj/project.pbxproj b/Meshtastic.xcodeproj/project.pbxproj index 000b7ec6..f1cd50d1 100644 --- a/Meshtastic.xcodeproj/project.pbxproj +++ b/Meshtastic.xcodeproj/project.pbxproj @@ -1611,7 +1611,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 2.3.3; + MARKETING_VERSION = 2.3.4; PRODUCT_BUNDLE_IDENTIFIER = gvh.MeshtasticClient; PRODUCT_NAME = "$(TARGET_NAME)"; SUPPORTS_MACCATALYST = YES; @@ -1645,7 +1645,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 2.3.3; + MARKETING_VERSION = 2.3.4; PRODUCT_BUNDLE_IDENTIFIER = gvh.MeshtasticClient; PRODUCT_NAME = "$(TARGET_NAME)"; SUPPORTS_MACCATALYST = YES; @@ -1767,7 +1767,7 @@ "@executable_path/Frameworks", "@executable_path/../../Frameworks", ); - MARKETING_VERSION = 2.3.3; + MARKETING_VERSION = 2.3.4; PRODUCT_BUNDLE_IDENTIFIER = gvh.MeshtasticClient.Widgets; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -1800,7 +1800,7 @@ "@executable_path/Frameworks", "@executable_path/../../Frameworks", ); - MARKETING_VERSION = 2.3.3; + MARKETING_VERSION = 2.3.4; PRODUCT_BUNDLE_IDENTIFIER = gvh.MeshtasticClient.Widgets; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; diff --git a/Meshtastic/Views/MapKitMap/WaypointFormMapKit.swift b/Meshtastic/Views/MapKitMap/WaypointFormMapKit.swift index 722a95d8..f32300ea 100644 --- a/Meshtastic/Views/MapKitMap/WaypointFormMapKit.swift +++ b/Meshtastic/Views/MapKitMap/WaypointFormMapKit.swift @@ -53,11 +53,7 @@ struct WaypointFormMapKit: View { let totalBytes = name.utf8.count // Only mess with the value if it is too big if totalBytes > 30 { - let firstNBytes = Data(name.utf8.prefix(30)) - if let maxBytesString = String(data: firstNBytes, encoding: String.Encoding.utf8) { - // Set the name back to the last place where it was the right size - name = maxBytesString - } + name = String(name.dropLast()) } }) } @@ -74,11 +70,7 @@ struct WaypointFormMapKit: View { let totalBytes = description.utf8.count // Only mess with the value if it is too big if totalBytes > 100 { - let firstNBytes = Data(description.utf8.prefix(100)) - if let maxBytesString = String(data: firstNBytes, encoding: String.Encoding.utf8) { - // Set the name back to the last place where it was the right size - description = maxBytesString - } + description = String(description.dropLast()) } }) } diff --git a/Meshtastic/Views/Messages/TextMessageField/TextMessageField.swift b/Meshtastic/Views/Messages/TextMessageField/TextMessageField.swift index e5cd01d3..c8f1abaa 100644 --- a/Meshtastic/Views/Messages/TextMessageField/TextMessageField.swift +++ b/Meshtastic/Views/Messages/TextMessageField/TextMessageField.swift @@ -33,13 +33,7 @@ struct TextMessageField: View { totalBytes = value.utf8.count // Only mess with the value if it is too big if totalBytes > Self.maxbytes { - let firstNBytes = Data(typingMessage.utf8.prefix(Self.maxbytes)) - if let maxBytesString = String(data: firstNBytes, encoding: String.Encoding.utf8) { - // Set the message back to the last place where it was the right size - typingMessage = maxBytesString - } else { - print("not a valid UTF-8 sequence") - } + typingMessage = String(typingMessage.dropLast()) } }) .keyboardType(.default) diff --git a/Meshtastic/Views/Nodes/Helpers/Map/WaypointForm.swift b/Meshtastic/Views/Nodes/Helpers/Map/WaypointForm.swift index 7ab6c7a6..446ed2c0 100644 --- a/Meshtastic/Views/Nodes/Helpers/Map/WaypointForm.swift +++ b/Meshtastic/Views/Nodes/Helpers/Map/WaypointForm.swift @@ -63,11 +63,7 @@ struct WaypointForm: View { let totalBytes = name.utf8.count // Only mess with the value if it is too big if totalBytes > 30 { - let firstNBytes = Data(name.utf8.prefix(30)) - if let maxBytesString = String(data: firstNBytes, encoding: String.Encoding.utf8) { - // Set the name back to the last place where it was the right size - name = maxBytesString - } + name = String(name.dropLast()) } }) } @@ -84,11 +80,7 @@ struct WaypointForm: View { let totalBytes = description.utf8.count // Only mess with the value if it is too big if totalBytes > 100 { - let firstNBytes = Data(description.utf8.prefix(100)) - if let maxBytesString = String(data: firstNBytes, encoding: String.Encoding.utf8) { - // Set the name back to the last place where it was the right size - description = maxBytesString - } + description = String(description.dropLast()) } }) } diff --git a/Meshtastic/Views/Settings/Channels/ChannelForm.swift b/Meshtastic/Views/Settings/Channels/ChannelForm.swift index 09238d49..cdde8442 100644 --- a/Meshtastic/Views/Settings/Channels/ChannelForm.swift +++ b/Meshtastic/Views/Settings/Channels/ChannelForm.swift @@ -47,11 +47,7 @@ struct ChannelForm: View { let totalBytes = channelName.utf8.count // Only mess with the value if it is too big if totalBytes > 11 { - let firstNBytes = Data(channelName.utf8.prefix(11)) - if let maxBytesString = String(data: firstNBytes, encoding: String.Encoding.utf8) { - // Set the channelName back to the last place where it was the right size - channelName = maxBytesString - } + channelName = String(channelName.dropLast()) } hasChanges = true }) diff --git a/Meshtastic/Views/Settings/Config/Module/CannedMessagesConfig.swift b/Meshtastic/Views/Settings/Config/Module/CannedMessagesConfig.swift index 67b45e3f..dd5df775 100644 --- a/Meshtastic/Views/Settings/Config/Module/CannedMessagesConfig.swift +++ b/Meshtastic/Views/Settings/Config/Module/CannedMessagesConfig.swift @@ -74,12 +74,7 @@ struct CannedMessagesConfig: View { let totalBytes = messages.utf8.count // Only mess with the value if it is too big if totalBytes > 198 { - - let firstNBytes = Data(messages.utf8.prefix(198)) - if let maxBytesString = String(data: firstNBytes, encoding: String.Encoding.utf8) { - // Set the shortName back to the last place where it was the right size - messages = maxBytesString - } + messages = String(messages.dropLast()) } hasMessagesChanges = true }) diff --git a/Meshtastic/Views/Settings/Config/Module/DetectionSensorConfig.swift b/Meshtastic/Views/Settings/Config/Module/DetectionSensorConfig.swift index bd00c76e..e78a9967 100644 --- a/Meshtastic/Views/Settings/Config/Module/DetectionSensorConfig.swift +++ b/Meshtastic/Views/Settings/Config/Module/DetectionSensorConfig.swift @@ -94,12 +94,7 @@ struct DetectionSensorConfig: View { let totalBytes = name.utf8.count // Only mess with the value if it is too big if totalBytes > 20 { - - let firstNBytes = Data(name.utf8.prefix(20)) - if let maxBytesString = String(data: firstNBytes, encoding: String.Encoding.utf8) { - // Set the shortName back to the last place where it was the right size - name = maxBytesString - } + name = String(name.dropLast()) } }) } diff --git a/Meshtastic/Views/Settings/Config/Module/MQTTConfig.swift b/Meshtastic/Views/Settings/Config/Module/MQTTConfig.swift index b0de0cbb..4175c623 100644 --- a/Meshtastic/Views/Settings/Config/Module/MQTTConfig.swift +++ b/Meshtastic/Views/Settings/Config/Module/MQTTConfig.swift @@ -139,11 +139,7 @@ struct MQTTConfig: View { let totalBytes = root.utf8.count // Only mess with the value if it is too big if totalBytes > 30 { - let firstNBytes = Data(root.utf8.prefix(30)) - if let maxBytesString = String(data: firstNBytes, encoding: String.Encoding.utf8) { - // Set the shortName back to the last place where it was the right size - root = maxBytesString - } + root = String(root.dropLast()) } }) .foregroundColor(.gray) @@ -181,11 +177,7 @@ struct MQTTConfig: View { let totalBytes = address.utf8.count // Only mess with the value if it is too big if totalBytes > 62 { - let firstNBytes = Data(username.utf8.prefix(62)) - if let maxBytesString = String(data: firstNBytes, encoding: String.Encoding.utf8) { - // Set the shortName back to the last place where it was the right size - address = maxBytesString - } + address = String(address.dropLast()) } hasChanges = true }) @@ -205,14 +197,7 @@ struct MQTTConfig: View { // Only mess with the value if it is too big if totalBytes > 62 { - - let firstNBytes = Data(username.utf8.prefix(62)) - - if let maxBytesString = String(data: firstNBytes, encoding: String.Encoding.utf8) { - - // Set the shortName back to the last place where it was the right size - username = maxBytesString - } + username = String(username.dropLast()) } hasChanges = true }) @@ -229,17 +214,9 @@ struct MQTTConfig: View { .onChange(of: password, perform: { _ in let totalBytes = password.utf8.count - // Only mess with the value if it is too big if totalBytes > 62 { - - let firstNBytes = Data(password.utf8.prefix(62)) - - if let maxBytesString = String(data: firstNBytes, encoding: String.Encoding.utf8) { - - // Set the shortName back to the last place where it was the right size - password = maxBytesString - } + password = String(password.dropLast()) } hasChanges = true }) diff --git a/Meshtastic/Views/Settings/Config/Module/RtttlConfig.swift b/Meshtastic/Views/Settings/Config/Module/RtttlConfig.swift index 78dd2b7e..dfd951df 100644 --- a/Meshtastic/Views/Settings/Config/Module/RtttlConfig.swift +++ b/Meshtastic/Views/Settings/Config/Module/RtttlConfig.swift @@ -35,12 +35,7 @@ struct RtttlConfig: View { let totalBytes = ringtone.utf8.count // Only mess with the value if it is too big if totalBytes > 228 { - - let firstNBytes = Data(ringtone.utf8.prefix(228)) - if let maxBytesString = String(data: firstNBytes, encoding: String.Encoding.utf8) { - // Set the ringtone back to the last place where it was the right size - ringtone = maxBytesString - } + ringtone = String(ringtone.dropLast()) } }) .foregroundColor(.gray) diff --git a/Meshtastic/Views/Settings/Config/NetworkConfig.swift b/Meshtastic/Views/Settings/Config/NetworkConfig.swift index 93923232..ca134b7b 100644 --- a/Meshtastic/Views/Settings/Config/NetworkConfig.swift +++ b/Meshtastic/Views/Settings/Config/NetworkConfig.swift @@ -48,11 +48,7 @@ struct NetworkConfig: View { let totalBytes = wifiSsid.utf8.count // Only mess with the value if it is too big if totalBytes > 32 { - let firstNBytes = Data(wifiSsid.utf8.prefix(32)) - if let maxBytesString = String(data: firstNBytes, encoding: String.Encoding.utf8) { - // Set the shortName back to the last place where it was the right size - wifiSsid = maxBytesString - } + wifiSsid = String(wifiSsid.dropLast()) } hasChanges = true }) @@ -69,11 +65,7 @@ struct NetworkConfig: View { let totalBytes = wifiPsk.utf8.count // Only mess with the value if it is too big if totalBytes > 63 { - let firstNBytes = Data(wifiPsk.utf8.prefix(63)) - if let maxBytesString = String(data: firstNBytes, encoding: String.Encoding.utf8) { - // Set the shortName back to the last place where it was the right size - wifiPsk = maxBytesString - } + wifiPsk = String(wifiPsk.dropLast()) } hasChanges = true }) diff --git a/Meshtastic/Views/Settings/UserConfig.swift b/Meshtastic/Views/Settings/UserConfig.swift index e7b71c60..a9da310d 100644 --- a/Meshtastic/Views/Settings/UserConfig.swift +++ b/Meshtastic/Views/Settings/UserConfig.swift @@ -52,11 +52,7 @@ struct UserConfig: View { let totalBytes = longName.utf8.count // Only mess with the value if it is too big if totalBytes > (isLicensed ? 6 : 36) { - let firstNBytes = Data(longName.utf8.prefix(isLicensed ? 6 : 36)) - if let maxBytesString = String(data: firstNBytes, encoding: String.Encoding.utf8) { - // Set the longName back to the last place where it was the right size - longName = maxBytesString - } + longName = String(longName.dropLast()) } }) } @@ -80,11 +76,7 @@ struct UserConfig: View { let totalBytes = shortName.utf8.count // Only mess with the value if it is too big if totalBytes > 4 { - let firstNBytes = Data(shortName.utf8.prefix(4)) - if let maxBytesString = String(data: firstNBytes, encoding: String.Encoding.utf8) { - // Set the shortName back to the last place where it was the right size - shortName = maxBytesString - } + shortName = String(shortName.dropLast()) } }) .foregroundColor(.gray)