Fix crash with early message manager
This commit is contained in:
parent
14666cfab0
commit
3fdcb8effe
@ -166,13 +166,17 @@ public class EarlyMessageManager: NSObject {
|
||||
wasReceivedByUD: Bool,
|
||||
serverDeliveryTimestamp: UInt64,
|
||||
associatedMessageTimestamp: UInt64,
|
||||
associatedMessageAuthor: SignalServiceAddress,
|
||||
associatedMessageAuthor: SignalServiceAddress?,
|
||||
transaction: SDSAnyWriteTransaction
|
||||
) {
|
||||
guard plainTextData?.count ?? 0 <= Self.maxEarlyEnvelopeSize else {
|
||||
return owsFailDebug("unexpectedly tried to record an excessively large early envelope")
|
||||
}
|
||||
|
||||
guard let associatedMessageAuthor = associatedMessageAuthor else {
|
||||
return owsFailDebug("unexpectedly missing associatedMessageAuthor for early envelope \(OWSMessageManager.description(for: envelope))")
|
||||
}
|
||||
|
||||
let identifier = MessageIdentifier(timestamp: associatedMessageTimestamp, author: associatedMessageAuthor)
|
||||
|
||||
Logger.info("Recording early envelope \(OWSMessageManager.description(for: envelope)) for message \(identifier)")
|
||||
@ -202,7 +206,7 @@ public class EarlyMessageManager: NSObject {
|
||||
@objc
|
||||
public func recordEarlyReceiptForOutgoingMessage(
|
||||
type: SSKProtoReceiptMessageType,
|
||||
senderAddress: SignalServiceAddress,
|
||||
senderAddress: SignalServiceAddress?,
|
||||
senderDeviceId: UInt32,
|
||||
timestamp: UInt64,
|
||||
associatedMessageTimestamp: UInt64,
|
||||
@ -212,6 +216,10 @@ public class EarlyMessageManager: NSObject {
|
||||
return owsFailDebug("missing local address")
|
||||
}
|
||||
|
||||
guard let senderAddress = senderAddress else {
|
||||
return owsFailDebug("unexpectedly missing senderAddress for early \(type) receipt with timestamp \(timestamp)")
|
||||
}
|
||||
|
||||
let identifier = MessageIdentifier(timestamp: associatedMessageTimestamp, author: localAddress)
|
||||
|
||||
Logger.info("Recording early \(type) receipt for outgoing message \(identifier)")
|
||||
@ -227,9 +235,13 @@ public class EarlyMessageManager: NSObject {
|
||||
public func recordEarlyReadReceiptFromLinkedDevice(
|
||||
timestamp: UInt64,
|
||||
associatedMessageTimestamp: UInt64,
|
||||
associatedMessageAuthor: SignalServiceAddress,
|
||||
associatedMessageAuthor: SignalServiceAddress?,
|
||||
transaction: SDSAnyWriteTransaction
|
||||
) {
|
||||
guard let associatedMessageAuthor = associatedMessageAuthor else {
|
||||
return owsFailDebug("unexpectedly missing associatedMessageAuthor for early read receipt with timestamp \(timestamp)")
|
||||
}
|
||||
|
||||
let identifier = MessageIdentifier(timestamp: associatedMessageTimestamp, author: associatedMessageAuthor)
|
||||
|
||||
Logger.info("Recording early read receipt from linked device for message \(identifier)")
|
||||
@ -245,9 +257,13 @@ public class EarlyMessageManager: NSObject {
|
||||
public func recordEarlyViewedReceiptFromLinkedDevice(
|
||||
timestamp: UInt64,
|
||||
associatedMessageTimestamp: UInt64,
|
||||
associatedMessageAuthor: SignalServiceAddress,
|
||||
associatedMessageAuthor: SignalServiceAddress?,
|
||||
transaction: SDSAnyWriteTransaction
|
||||
) {
|
||||
guard let associatedMessageAuthor = associatedMessageAuthor else {
|
||||
return owsFailDebug("unexpectedly missing associatedMessageAuthor for early viewed receipt with timestamp \(timestamp)")
|
||||
}
|
||||
|
||||
let identifier = MessageIdentifier(timestamp: associatedMessageTimestamp, author: associatedMessageAuthor)
|
||||
|
||||
Logger.info("Recording early viewed receipt from linked device for message \(identifier)")
|
||||
|
||||
Loading…
Reference in New Issue
Block a user