To improve message reliability, we're adding an urgency flag to outgoing messages. For example, outgoing calls are urgent, but delivery receipts are not. [Android][] and [Desktop][] have already done this work. At a high level, I added an `isUrgent` property to `TSOutgoingMessage`s. It defaults to `true`. Some subclasses, like `OWSReceiptsForSenderMessage`, override it to return `false`. Builds off of a few other commits (not necessary to understand this commit, but might be useful for posterity): -e858a0d916-8c6d2ebe8c-402b117221-2ba0cd764d-266a4663e9-8e5009bbf7[Android]:dc04c8ed98[Desktop]:06190b1434
35 lines
1.2 KiB
Swift
35 lines
1.2 KiB
Swift
//
|
|
// Copyright (c) 2022 Open Whisper Systems. All rights reserved.
|
|
//
|
|
|
|
import XCTest
|
|
@testable import SignalServiceKit
|
|
|
|
class OWSReceiptsForSenderMessageTest: SSKBaseTestSwift {
|
|
func testIsUrgent() throws {
|
|
write { transaction in
|
|
let thread = TSContactThread.getOrCreateThread(
|
|
withContactAddress: SignalServiceAddress(phoneNumber: "+12223334444"),
|
|
transaction: transaction
|
|
)
|
|
|
|
let receiptSet = MessageReceiptSet()
|
|
receiptSet.insert(timestamp: 123)
|
|
receiptSet.insert(timestamp: 456)
|
|
|
|
let fns = [
|
|
OWSReceiptsForSenderMessage.deliveryReceiptsForSenderMessage,
|
|
// TODO: For unknown reasons, `readReceiptsForSenderMessage` is not available here.
|
|
// We should fix this, but we couldn't figure out how.
|
|
// OWSReceiptsForSenderMessage.readReceiptsForSenderMessage,
|
|
OWSReceiptsForSenderMessage.viewedReceiptsForSenderMessage
|
|
]
|
|
|
|
for fn in fns {
|
|
let receiptsMessage = fn(thread, receiptSet, transaction)
|
|
XCTAssertFalse(receiptsMessage.isUrgent)
|
|
}
|
|
}
|
|
}
|
|
}
|