mirror of
https://github.com/meshtastic/Meshtastic-Apple.git
synced 2026-04-20 22:13:56 +00:00
Merge pull request #814 from meshtastic/filter-unreachable-users
Don't Show unreachable nodes in the contact list
This commit is contained in:
commit
e2ce6bff07
1 changed files with 6 additions and 6 deletions
|
|
@ -45,8 +45,9 @@ struct UserList: View {
|
|||
NSSortDescriptor(key: "pkiEncrypted", ascending: false),
|
||||
NSSortDescriptor(key: "userNode.lastHeard", ascending: false),
|
||||
NSSortDescriptor(key: "longName", ascending: true)],
|
||||
predicate: NSPredicate(format: "userNode.ignored == false && longName != ''"),
|
||||
animation: .default
|
||||
predicate: NSPredicate(
|
||||
format: "userNode.ignored == false && longName != '' AND NOT (userNode.viaMqtt == YES AND userNode.hopsAway > 0)"
|
||||
), animation: .default
|
||||
)
|
||||
var users: FetchedResults<UserEntity>
|
||||
|
||||
|
|
@ -297,7 +298,7 @@ struct UserList: View {
|
|||
let textSearchPredicate = NSCompoundPredicate(type: .or, subpredicates: searchPredicates)
|
||||
/// Create an array of predicates to hold our AND predicates
|
||||
var predicates: [NSPredicate] = []
|
||||
/// Mqtt
|
||||
/// Mqtt and lora
|
||||
if !(viaLora && viaMqtt) {
|
||||
if viaLora {
|
||||
let loraPredicate = NSPredicate(format: "userNode.viaMqtt == NO")
|
||||
|
|
@ -307,9 +308,8 @@ struct UserList: View {
|
|||
predicates.append(mqttPredicate)
|
||||
}
|
||||
} else {
|
||||
/// Only show mqtt nodes that can be contacted (zero hops) on the default key
|
||||
// let bothPredicate = NSPredicate(format: "userNode.viaMqtt == YES AND userNode.hopsAway == 0 OR userNode.viaMqtt == NO")
|
||||
// predicates.append(bothPredicate)
|
||||
let mqttPredicate = NSPredicate(format: "NOT (userNode.viaMqtt == YES AND userNode.hopsAway > 0)")
|
||||
predicates.append(mqttPredicate)
|
||||
}
|
||||
/// Roles
|
||||
if roleFilter && deviceRoles.count > 0 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue