mirror of
https://github.com/meshtastic/Meshtastic-Apple.git
synced 2026-04-20 22:13:56 +00:00
Actually save isClientMuted to the node and switch channelList to a fetch request
This commit is contained in:
parent
6e5c045226
commit
339ecb3ace
2 changed files with 12 additions and 2 deletions
|
|
@ -32,6 +32,7 @@ extension ChannelEntity {
|
|||
channel.settings.psk = self.psk ?? Data()
|
||||
channel.role = Channel.Role(rawValue: Int(self.role)) ?? Channel.Role.secondary
|
||||
channel.settings.moduleSettings.positionPrecision = UInt32(self.positionPrecision)
|
||||
channel.settings.moduleSettings.isClientMuted = self.mute
|
||||
return channel
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,6 +26,12 @@ struct ChannelList: View {
|
|||
|
||||
var restrictedChannels = ["gpio", "mqtt", "serial", "admin"]
|
||||
|
||||
@FetchRequest(
|
||||
sortDescriptors: [NSSortDescriptor(keyPath: \ChannelEntity.index, ascending: true)],
|
||||
predicate: nil,
|
||||
animation: .default
|
||||
) private var channels: FetchedResults<ChannelEntity>
|
||||
|
||||
@ViewBuilder
|
||||
private func makeChannelRow(
|
||||
myInfo: MyInfoEntity,
|
||||
|
|
@ -87,6 +93,9 @@ struct ChannelList: View {
|
|||
.foregroundColor(.secondary)
|
||||
}
|
||||
}
|
||||
if channel.mute {
|
||||
Image(systemName: "bell.slash")
|
||||
}
|
||||
}
|
||||
|
||||
if channel.allPrivateMessages.count > 0 {
|
||||
|
|
@ -103,7 +112,7 @@ struct ChannelList: View {
|
|||
var body: some View {
|
||||
VStack {
|
||||
// Display Contacts for the rest of the non admin channels
|
||||
if let node, let myInfo = node.myInfo, let channels = myInfo.channels?.array as? [ChannelEntity] {
|
||||
if let node, let myInfo = node.myInfo {
|
||||
List(selection: $channelSelection) {
|
||||
ForEach(channels) { (channel: ChannelEntity) in
|
||||
if !restrictedChannels.contains(channel.name?.lowercased() ?? "") {
|
||||
|
|
@ -119,7 +128,7 @@ struct ChannelList: View {
|
|||
}
|
||||
}
|
||||
Button {
|
||||
channel.mute = !channel.mute
|
||||
channel.mute.toggle()
|
||||
do {
|
||||
let adminMessageId = bleManager.saveChannel(channel: channel.protoBuf, fromUser: node.user!, toUser: node.user!)
|
||||
if adminMessageId > 0 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue