diff --git a/Localizable.xcstrings b/Localizable.xcstrings
index 0742d933..27f582c3 100644
--- a/Localizable.xcstrings
+++ b/Localizable.xcstrings
@@ -2136,6 +2136,12 @@
}
}
}
+ },
+ "Add Contact" : {
+
+ },
+ "Add Meshtastic Node %@ as a contact" : {
+
},
"Add to favorites" : {
"localizations" : {
@@ -15095,12 +15101,6 @@
}
}
}
- },
- "Add Contact" : {
-
- },
- "Add Meshtastic Node %@ as a contact" : {
-
},
"Import Route" : {
"localizations" : {
@@ -30920,7 +30920,7 @@
}
}
},
- "The URL for the node to import" : {
+ "The URL for the node to add" : {
},
"There has been no response to a request for device metadata over the admin channel for this node." : {
diff --git a/Meshtastic/Meshtastic.xcdatamodeld/MeshtasticDataModelV 50.xcdatamodel/contents b/Meshtastic/Meshtastic.xcdatamodeld/MeshtasticDataModelV 50.xcdatamodel/contents
index f9a2cddb..1124c59b 100644
--- a/Meshtastic/Meshtastic.xcdatamodeld/MeshtasticDataModelV 50.xcdatamodel/contents
+++ b/Meshtastic/Meshtastic.xcdatamodeld/MeshtasticDataModelV 50.xcdatamodel/contents
@@ -479,7 +479,6 @@
-
diff --git a/Meshtastic/Meshtastic.xcdatamodeld/MeshtasticDataModelV 51.xcdatamodel/contents b/Meshtastic/Meshtastic.xcdatamodeld/MeshtasticDataModelV 51.xcdatamodel/contents
index 9578507a..f9a2cddb 100644
--- a/Meshtastic/Meshtastic.xcdatamodeld/MeshtasticDataModelV 51.xcdatamodel/contents
+++ b/Meshtastic/Meshtastic.xcdatamodeld/MeshtasticDataModelV 51.xcdatamodel/contents
@@ -1,5 +1,5 @@
-
+
@@ -479,6 +479,7 @@
+
diff --git a/Meshtastic/Persistence/UpdateCoreData.swift b/Meshtastic/Persistence/UpdateCoreData.swift
index 5e271228..d7d25a9d 100644
--- a/Meshtastic/Persistence/UpdateCoreData.swift
+++ b/Meshtastic/Persistence/UpdateCoreData.swift
@@ -183,6 +183,17 @@ func upsertNodeInfoPacket (packet: MeshPacket, context: NSManagedObjectContext)
newUser.role = Int32(newUserMessage.role.rawValue)
newUser.hwModel = String(describing: newUserMessage.hwModel).uppercased()
newUser.hwModelId = Int32(newUserMessage.hwModel.rawValue)
+ if newUserMessage.hasIsUnmessagable {
+ newUser.unmessagable = newUserMessage.isUnmessagable
+ } else {
+ // For older firmare make Repeater, Router, Router Late, Sensor, Tracker, TAK, and TAK Tracker unmessagable
+ let roles: [Int32] = [4, 2, 11, 6, 7, 10]
+ if roles.contains(newUser.role) {
+ newUser.unmessagable = true
+ } else {
+ newUser.unmessagable = false
+ }
+ }
if !newUserMessage.publicKey.isEmpty {
newUser.pkiEncrypted = true
newUser.publicKey = newUserMessage.publicKey
@@ -279,6 +290,17 @@ func upsertNodeInfoPacket (packet: MeshPacket, context: NSManagedObjectContext)
fetchedNode[0].user!.role = Int32(nodeInfoMessage.user.role.rawValue)
fetchedNode[0].user!.hwModel = String(describing: nodeInfoMessage.user.hwModel).uppercased()
fetchedNode[0].user!.hwModelId = Int32(nodeInfoMessage.user.hwModel.rawValue)
+ if nodeInfoMessage.user.hasIsUnmessagable {
+ fetchedNode[0].user!.unmessagable = nodeInfoMessage.user.isUnmessagable
+ } else {
+ // For older firmare make Repeater, Router, Router Late, Sensor, Tracker, TAK, and TAK Tracker unmessagable
+ let roles: [Int32] = [-1, 4, 2, 11, 6, 7, 10]
+ if roles.contains(fetchedNode[0].user?.role ?? -1) {
+ fetchedNode[0].user!.unmessagable = true
+ } else {
+ fetchedNode[0].user!.unmessagable = false
+ }
+ }
if !nodeInfoMessage.user.publicKey.isEmpty {
fetchedNode[0].user!.pkiEncrypted = true
fetchedNode[0].user!.publicKey = nodeInfoMessage.user.publicKey
diff --git a/Meshtastic/Views/Messages/UserList.swift b/Meshtastic/Views/Messages/UserList.swift
index 7e57ce8c..ddb1264e 100644
--- a/Meshtastic/Views/Messages/UserList.swift
+++ b/Meshtastic/Views/Messages/UserList.swift
@@ -46,9 +46,8 @@ struct UserList: View {
NSSortDescriptor(key: "userNode.lastHeard", ascending: false),
NSSortDescriptor(key: "longName", ascending: true)],
predicate: NSPredicate(
- format: "userNode.ignored == false && longName != '' AND NOT (userNode.viaMqtt == YES AND userNode.hopsAway > 0)"
- ), animation: .default
- )
+ format: "userNode.ignored == false && longName != '' AND unmessagable == false"
+ ), animation: .default)
var users: FetchedResults
@Binding var node: NodeInfoEntity?
@@ -298,17 +297,19 @@ struct UserList: View {
let textSearchPredicate = NSCompoundPredicate(type: .or, subpredicates: searchPredicates)
/// Create an array of predicates to hold our AND predicates
var predicates: [NSPredicate] = []
+ let defaultPredicate = NSPredicate(format: "userNode.ignored == NO AND longName != '' AND unmessagable == NO")
+ predicates.append(defaultPredicate)
/// Mqtt and lora
if !(viaLora && viaMqtt) {
if viaLora {
let loraPredicate = NSPredicate(format: "userNode.viaMqtt == NO")
predicates.append(loraPredicate)
} else {
- let mqttPredicate = NSPredicate(format: "userNode.viaMqtt == YES AND userNode.hopsAway == 0")
+ let mqttPredicate = NSPredicate(format: "userNode.viaMqtt == YES")
predicates.append(mqttPredicate)
}
} else {
- let mqttPredicate = NSPredicate(format: "NOT (userNode.viaMqtt == YES AND userNode.hopsAway > 0)")
+ let mqttPredicate = NSPredicate(format: "NOT (userNode.viaMqtt == YES)")
predicates.append(mqttPredicate)
}
/// Roles
@@ -362,16 +363,11 @@ struct UserList: View {
predicates.append(distancePredicate)
}
}
-
- if predicates.count > 0 || !searchText.isEmpty {
- if !searchText.isEmpty {
- let filterPredicates = NSCompoundPredicate(type: .and, subpredicates: predicates)
- users.nsPredicate = NSCompoundPredicate(type: .and, subpredicates: [textSearchPredicate, filterPredicates])
- } else {
- users.nsPredicate = NSCompoundPredicate(type: .and, subpredicates: predicates)
- }
+ if !searchText.isEmpty {
+ let filterPredicates = NSCompoundPredicate(type: .and, subpredicates: predicates)
+ users.nsPredicate = NSCompoundPredicate(type: .and, subpredicates: [textSearchPredicate, filterPredicates])
} else {
- users.nsPredicate = nil
+ users.nsPredicate = NSCompoundPredicate(type: .and, subpredicates: predicates)
}
}
}