Delete broadcast user hacks

This commit is contained in:
Garth Vander Houwen 2022-11-07 19:10:22 -08:00
parent 5844066931
commit 45e3c08cc0
2 changed files with 0 additions and 33 deletions

View file

@ -592,30 +592,6 @@ class BLEManager: NSObject, ObservableObject, CBCentralManagerDelegate, CBPeriph
case .max:
print("MAX PORT NUM OF 511")
}
// MARK: Check for an All / Broadcast User
let fetchBCUserRequest: NSFetchRequest<NSFetchRequestResult> = NSFetchRequest.init(entityName: "UserEntity")
fetchBCUserRequest.predicate = NSPredicate(format: "num == %lld", Int64(broadcastNodeNum))
do {
let fetchedUser = try context?.fetch(fetchBCUserRequest) as! [UserEntity]
if fetchedUser.isEmpty {
// Save the broadcast user if it does not exist
// let bcu: UserEntity = UserEntity(context: context!)
// bcu.shortName = "ALL"
// bcu.longName = "All - Broadcast"
// bcu.hwModel = "UNSET"
// bcu.num = Int64(broadcastNodeNum)
// bcu.userId = "BROADCASTNODE"
// print("💾 Saved the All - Broadcast User")
} else {
context!.delete(fetchedUser[0])
}
} catch {
MeshLogger.log("💥 Error Saving the All - Broadcast User")
}
// MARK: Share Location Position Update Timer
// Use context to pass the radio name with the timer

View file

@ -1277,15 +1277,6 @@ func textMessageAppPacket(packet: MeshPacket, connectedNode: Int64, context: NSM
if packet.decoded.replyID > 0 {
newMessage.replyID = Int64(packet.decoded.replyID)
}
//if packet.to == broadcastNodeNum && fetchedUsers.count == 1 {
// Save the broadcast user if it does not exist
// let bcu: UserEntity = UserEntity(context: context)
// bcu.shortName = "ALL"
// bcu.longName = "All - Broadcast"
// bcu.hwModel = "UNSET"
// bcu.num = Int64(broadcastNodeNum)
// bcu.userId = "BROADCASTNODE"
// newMessage.toUser = bcu
if fetchedUsers.first(where: { $0.num == packet.to }) != nil {
newMessage.toUser = fetchedUsers.first(where: { $0.num == packet.to })