From 19f3e7ddae42eff9a039f80e60eb00f974192d9e Mon Sep 17 00:00:00 2001 From: Garth Vander Houwen Date: Tue, 2 Jul 2024 09:20:12 -0700 Subject: [PATCH 1/2] Remove option to set 192bit keys --- Localizable.xcstrings | 5 +---- Meshtastic/Views/Settings/Channels/ChannelForm.swift | 1 - 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/Localizable.xcstrings b/Localizable.xcstrings index aa22cc670..7d7ba619b 100644 --- a/Localizable.xcstrings +++ b/Localizable.xcstrings @@ -181,9 +181,6 @@ }, "128 bit" : { - }, - "192 bit" : { - }, "256 bit" : { @@ -22405,4 +22402,4 @@ } }, "version" : "1.0" -} +} \ No newline at end of file diff --git a/Meshtastic/Views/Settings/Channels/ChannelForm.swift b/Meshtastic/Views/Settings/Channels/ChannelForm.swift index 476695bb7..780a19b47 100644 --- a/Meshtastic/Views/Settings/Channels/ChannelForm.swift +++ b/Meshtastic/Views/Settings/Channels/ChannelForm.swift @@ -57,7 +57,6 @@ struct ChannelForm: View { Text("Default").tag(-1) Text("1 byte").tag(1) Text("128 bit").tag(16) - Text("192 bit").tag(24) Text("256 bit").tag(32) } .pickerStyle(DefaultPickerStyle()) From 0b7dfc222799acc3d308283c60eacdce891f939d Mon Sep 17 00:00:00 2001 From: Garth Vander Houwen Date: Tue, 2 Jul 2024 09:28:55 -0700 Subject: [PATCH 2/2] Fix channel delete bug --- Meshtastic/Views/Settings/Channels.swift | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/Meshtastic/Views/Settings/Channels.swift b/Meshtastic/Views/Settings/Channels.swift index dee462093..2021b536b 100644 --- a/Meshtastic/Views/Settings/Channels.swift +++ b/Meshtastic/Views/Settings/Channels.swift @@ -154,14 +154,12 @@ struct Channels: View { var channel = Channel() channel.index = channelIndex channel.role = ChannelRoles(rawValue: channelRole)?.protoEnumValue() ?? .secondary - if channel.role != Channel.Role.disabled { channel.index = channelIndex channel.settings.name = channelName channel.settings.psk = Data(base64Encoded: channelKey) ?? Data() channel.settings.uplinkEnabled = uplink channel.settings.downlinkEnabled = downlink channel.settings.moduleSettings.positionPrecision = UInt32(positionPrecision) - selectedChannel!.role = Int32(channelRole) selectedChannel!.index = channelIndex selectedChannel!.name = channelName @@ -180,6 +178,7 @@ struct Channels: View { } node?.myInfo?.channels = mutableChannels.copy() as? NSOrderedSet context.refresh(selectedChannel!, mergeChanges: true) + if channel.role != Channel.Role.disabled { do { try context.save() Logger.data.info("💾 Saved Channel: \(channel.settings.name)") @@ -189,19 +188,14 @@ struct Channels: View { Logger.data.error("Unresolved Core Data error in the channel editor. Error: \(nsError)") } } else { - guard let channelEntities = node?.myInfo?.channels as? [ChannelEntity], - let channelEntity = channelEntities.first(where: { $0.index == channelIndex }) else { - return - } - - let objects = channelEntity.allPrivateMessages + let objects = selectedChannel?.allPrivateMessages ?? [] for object in objects { context.delete(object) } - for node in nodes where node.channel == channelEntity.index { + for node in nodes where node.channel == channel.index { context.delete(node) } - context.delete(channelEntity) + context.delete(selectedChannel!) do { try context.save() Logger.data.info("💾 Deleted Channel: \(channel.settings.name)") @@ -211,7 +205,6 @@ struct Channels: View { Logger.data.error("Unresolved Core Data error in the channel editor. Error: \(nsError)") } } - let adminMessageId = bleManager.saveChannel(channel: channel, fromUser: node!.user!, toUser: node!.user!) if adminMessageId > 0 {