Remove lightly used receivedTimestamp

This commit is contained in:
Garth Vander Houwen 2024-07-31 20:56:09 -07:00
parent d49b83685f
commit 33978592d3
4 changed files with 2 additions and 4 deletions

View file

@ -14,7 +14,7 @@ import SwiftUI
extension MessageEntity {
var timestamp: Date {
let time = messageTimestamp <= 0 ? receivedTimestamp : messageTimestamp
let time = messageTimestamp
return Date(timeIntervalSince1970: TimeInterval(time))
}

View file

@ -795,7 +795,6 @@ func textMessageAppPacket(
let newMessage = MessageEntity(context: context)
newMessage.messageId = Int64(packet.id)
newMessage.messageTimestamp = Int32(bitPattern: packet.rxTime)
newMessage.receivedTimestamp = Int32(Date().timeIntervalSince1970)
newMessage.receivedACK = false
newMessage.snr = packet.rxSnr
newMessage.rssi = packet.rxRssi

View file

@ -159,7 +159,6 @@
<attribute name="read" attributeType="Boolean" defaultValueString="NO" usesScalarValueType="YES"/>
<attribute name="realACK" optional="YES" attributeType="Boolean" defaultValueString="NO" usesScalarValueType="YES"/>
<attribute name="receivedACK" attributeType="Boolean" usesScalarValueType="YES"/>
<attribute name="receivedTimestamp" optional="YES" attributeType="Integer 32" defaultValueString="0" usesScalarValueType="YES"/>
<attribute name="replyID" optional="YES" attributeType="Integer 64" defaultValueString="0" usesScalarValueType="YES"/>
<attribute name="rssi" optional="YES" attributeType="Integer 32" defaultValueString="0" usesScalarValueType="YES"/>
<attribute name="snr" optional="YES" attributeType="Float" defaultValueString="0.0" usesScalarValueType="YES"/>

View file

@ -29,7 +29,7 @@ public func getStoreAndForwardMessageIds(seconds: Int, context: NSManagedObjectC
let fetchMessagesRequest = MessageEntity.fetchRequest()
let timeRange = Calendar.current.date(byAdding: .minute, value: time, to: Date())
let milleseconds = Int32(timeRange?.timeIntervalSince1970 ?? 0)
fetchMessagesRequest.predicate = NSPredicate(format: "receivedTimestamp >= %d", milleseconds)
fetchMessagesRequest.predicate = NSPredicate(format: "messageTimestamp >= %d", milleseconds)
do {
let fetchedMessages = try context.fetch(fetchMessagesRequest)