Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't Show unreachable nodes in the contact list #814

Merged
merged 2 commits into from
Dec 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions Meshtastic/Views/Messages/UserList.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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>

Expand Down Expand Up @@ -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")
Expand All @@ -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 {
Expand Down
Loading