mirror of
https://github.com/meshtastic/Meshtastic-Apple.git
synced 2026-04-20 22:13:56 +00:00
Add ignore node functionality to the node and user list
This commit is contained in:
parent
e118412808
commit
49c7bd7bef
7 changed files with 39 additions and 8 deletions
|
|
@ -8957,6 +8957,9 @@
|
|||
},
|
||||
"Ignore Node" : {
|
||||
|
||||
},
|
||||
"Ignored" : {
|
||||
|
||||
},
|
||||
"Import Route" : {
|
||||
|
||||
|
|
|
|||
|
|
@ -77,13 +77,13 @@ extension UserEntity {
|
|||
return "TLORAV2118"
|
||||
/// Seeed Studio
|
||||
case "SENSECAPINDICATOR":
|
||||
return "SENSECAPINDICATOR"
|
||||
return "UNSET"
|
||||
case "TRACKERT1000E":
|
||||
return "TRACKERT1000E"
|
||||
return "UNSET"
|
||||
case "SEEEDXIAOS3":
|
||||
return "SEEEDXIAOS3"
|
||||
return "UNSET"
|
||||
case "WIOWM1110":
|
||||
return "WIOWM1110"
|
||||
return "UNSET"
|
||||
/// RAK Wireless
|
||||
case "RAK4631":
|
||||
return "UNSET"
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ struct UserList: View {
|
|||
@State private var isOnline = false
|
||||
@State private var isPkiEncrypted = false
|
||||
@State private var isFavorite = false
|
||||
@State private var isIgnored = false
|
||||
@State private var isEnvironment = false
|
||||
@State private var distanceFilter = false
|
||||
@State private var maxDistance: Double = 800000
|
||||
|
|
@ -44,7 +45,7 @@ struct UserList: View {
|
|||
NSSortDescriptor(key: "pkiEncrypted", ascending: false),
|
||||
NSSortDescriptor(key: "userNode.lastHeard", ascending: false),
|
||||
NSSortDescriptor(key: "longName", ascending: true)],
|
||||
predicate: NSPredicate(format: "longName != ''"),
|
||||
predicate: NSPredicate(format: "userNode.ignored == false && longName != ''"),
|
||||
animation: .default
|
||||
)
|
||||
var users: FetchedResults<UserEntity>
|
||||
|
|
@ -194,7 +195,7 @@ struct UserList: View {
|
|||
.listStyle(.plain)
|
||||
.navigationTitle(String.localizedStringWithFormat("contacts %@".localized, String(users.count == 0 ? 0 : users.count)))
|
||||
.sheet(isPresented: $editingFilters) {
|
||||
NodeListFilter(filterTitle: "Contact Filters", viaLora: $viaLora, viaMqtt: $viaMqtt, isOnline: $isOnline, isPkiEncrypted: $isPkiEncrypted, isFavorite: $isFavorite, isEnvironment: $isEnvironment, distanceFilter: $distanceFilter, maximumDistance: $maxDistance, hopsAway: $hopsAway, roleFilter: $roleFilter, deviceRoles: $deviceRoles)
|
||||
NodeListFilter(filterTitle: "Contact Filters", viaLora: $viaLora, viaMqtt: $viaMqtt, isOnline: $isOnline, isPkiEncrypted: $isPkiEncrypted, isFavorite: $isFavorite, isIgnored: $isIgnored, isEnvironment: $isEnvironment, distanceFilter: $distanceFilter, maximumDistance: $maxDistance, hopsAway: $hopsAway, roleFilter: $roleFilter, deviceRoles: $deviceRoles)
|
||||
}
|
||||
.sheet(isPresented: $showingHelp) {
|
||||
DirectMessagesHelp()
|
||||
|
|
|
|||
|
|
@ -35,9 +35,9 @@ struct IgnoreNodeButton: View {
|
|||
}
|
||||
} label: {
|
||||
Label {
|
||||
Text(node.favorite ? "Remove from ignored" : "Ignore Node")
|
||||
Text(node.ignored ? "Remove from ignored" : "Ignore Node")
|
||||
} icon: {
|
||||
Image(systemName: node.favorite ? "minus.circle.fill" : "minus.circle")
|
||||
Image(systemName: node.ignored ? "minus.circle.fill" : "minus.circle")
|
||||
.symbolRenderingMode(.multicolor)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ struct NodeListFilter: View {
|
|||
@Binding var isOnline: Bool
|
||||
@Binding var isPkiEncrypted: Bool
|
||||
@Binding var isFavorite: Bool
|
||||
@Binding var isIgnored: Bool
|
||||
@Binding var isEnvironment: Bool
|
||||
@Binding var distanceFilter: Bool
|
||||
@Binding var maximumDistance: Double
|
||||
|
|
@ -90,6 +91,18 @@ struct NodeListFilter: View {
|
|||
}
|
||||
.toggleStyle(SwitchToggleStyle(tint: .accentColor))
|
||||
.listRowSeparator(.visible)
|
||||
Toggle(isOn: $isIgnored) {
|
||||
|
||||
Label {
|
||||
Text("Ignored")
|
||||
} icon: {
|
||||
|
||||
Image(systemName: "minus.circle.fill")
|
||||
.symbolRenderingMode(.multicolor)
|
||||
}
|
||||
}
|
||||
.toggleStyle(SwitchToggleStyle(tint: .accentColor))
|
||||
.listRowSeparator(.visible)
|
||||
|
||||
if filterTitle == "Node Filters" {
|
||||
Toggle(isOn: $isEnvironment) {
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@ struct MeshMap: View {
|
|||
@State private var isOnline = false
|
||||
@State private var isPkiEncrypted = false
|
||||
@State private var isFavorite = false
|
||||
@State private var isIgnored = false
|
||||
@State private var isEnvironment = false
|
||||
@State private var distanceFilter = false
|
||||
@State private var maxDistance: Double = 800000
|
||||
|
|
@ -161,6 +162,7 @@ struct MeshMap: View {
|
|||
isOnline: $isOnline,
|
||||
isPkiEncrypted: $isPkiEncrypted,
|
||||
isFavorite: $isFavorite,
|
||||
isIgnored: $isIgnored,
|
||||
isEnvironment: $isEnvironment,
|
||||
distanceFilter: $distanceFilter,
|
||||
maximumDistance: $maxDistance,
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ struct NodeList: View {
|
|||
@State private var isOnline = false
|
||||
@State private var isPkiEncrypted = false
|
||||
@State private var isFavorite = false
|
||||
@State private var isIgnored = false
|
||||
@State private var isEnvironment = false
|
||||
@State private var distanceFilter = false
|
||||
@State private var maxDistance: Double = 800000
|
||||
|
|
@ -40,6 +41,7 @@ struct NodeList: View {
|
|||
|
||||
var boolFilters: [Bool] {[
|
||||
isFavorite,
|
||||
isIgnored,
|
||||
isOnline,
|
||||
isPkiEncrypted,
|
||||
isEnvironment,
|
||||
|
|
@ -53,6 +55,7 @@ struct NodeList: View {
|
|||
|
||||
@FetchRequest(
|
||||
sortDescriptors: [
|
||||
NSSortDescriptor(key: "ignored", ascending: true),
|
||||
NSSortDescriptor(key: "favorite", ascending: false),
|
||||
NSSortDescriptor(key: "lastHeard", ascending: false),
|
||||
NSSortDescriptor(key: "user.longName", ascending: true)
|
||||
|
|
@ -169,6 +172,7 @@ struct NodeList: View {
|
|||
isOnline: $isOnline,
|
||||
isPkiEncrypted: $isPkiEncrypted,
|
||||
isFavorite: $isFavorite,
|
||||
isIgnored: $isIgnored,
|
||||
isEnvironment: $isEnvironment,
|
||||
distanceFilter: $distanceFilter,
|
||||
maximumDistance: $maxDistance,
|
||||
|
|
@ -397,6 +401,14 @@ struct NodeList: View {
|
|||
let isFavoritePredicate = NSPredicate(format: "favorite == YES")
|
||||
predicates.append(isFavoritePredicate)
|
||||
}
|
||||
/// Ignored
|
||||
if isIgnored {
|
||||
let isIgnoredPredicate = NSPredicate(format: "ignored == YES")
|
||||
predicates.append(isIgnoredPredicate)
|
||||
} else if !isIgnored {
|
||||
let isIgnoredPredicate = NSPredicate(format: "ignored == NO")
|
||||
predicates.append(isIgnoredPredicate)
|
||||
}
|
||||
/// Environment
|
||||
if isEnvironment {
|
||||
let environmentPredicate = NSPredicate(format: "SUBQUERY(telemetries, $tel, $tel.metricsType == 1).@count > 0")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue