Swiftify OWSOutgoingSyncMessage

This commit is contained in:
Max Radermacher 2026-01-22 00:39:43 -06:00 committed by GitHub
parent 16d434d512
commit ec589ce554
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
33 changed files with 159 additions and 293 deletions

View File

@ -821,6 +821,7 @@
50DCCBFA2F1817280024D124 /* DisappearingMessagesConfigurationMessage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50DCCBF92F1817280024D124 /* DisappearingMessagesConfigurationMessage.swift */; };
50DCCBFC2F181A790024D124 /* ProfileKeyMessage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50DCCBFB2F181A790024D124 /* ProfileKeyMessage.swift */; };
50DCCBFE2F1820600024D124 /* OutgoingSenderKeyDistributionMessage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50DCCBFD2F1820600024D124 /* OutgoingSenderKeyDistributionMessage.swift */; };
50DE50602F21F4A700F30994 /* OutgoingSyncMessage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50DE505F2F21F4A700F30994 /* OutgoingSyncMessage.swift */; };
50E42FEA2C1BA3B900554BD6 /* CallHTTPClient.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50E42FE92C1BA3B900554BD6 /* CallHTTPClient.swift */; };
50E51A3B2AE989C4004F9069 /* AccountAttributesTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50E51A3A2AE989C4004F9069 /* AccountAttributesTest.swift */; };
50E5E4B129932D9B00E15A1C /* DeviceMessage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50E5E4B029932D9B00E15A1C /* DeviceMessage.swift */; };
@ -3538,9 +3539,7 @@
F9C5C8AA289451B900548EEE /* SignalServiceKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F9C5C897289451B900548EEE /* SignalServiceKit.framework */; };
F9C5C8AB289451B900548EEE /* SignalServiceKit.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = F9C5C897289451B900548EEE /* SignalServiceKit.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
F9C5CBB4289453B300548EEE /* OutgoingPaymentSyncMessage.swift in Sources */ = {isa = PBXBuildFile; fileRef = F9C5C8BF289453B100548EEE /* OutgoingPaymentSyncMessage.swift */; };
F9C5CBB7289453B300548EEE /* OWSOutgoingSyncMessage.m in Sources */ = {isa = PBXBuildFile; fileRef = F9C5C8C2289453B100548EEE /* OWSOutgoingSyncMessage.m */; };
F9C5CBB8289453B300548EEE /* OWSSyncContactsMessage.swift in Sources */ = {isa = PBXBuildFile; fileRef = F9C5C8C3289453B100548EEE /* OWSSyncContactsMessage.swift */; };
F9C5CBC7289453B300548EEE /* OWSOutgoingSyncMessage.h in Headers */ = {isa = PBXBuildFile; fileRef = F9C5C8D2289453B100548EEE /* OWSOutgoingSyncMessage.h */; settings = {ATTRIBUTES = (Public, ); }; };
F9C5CBC8289453B300548EEE /* TSCall.h in Headers */ = {isa = PBXBuildFile; fileRef = F9C5C8D3289453B100548EEE /* TSCall.h */; settings = {ATTRIBUTES = (Public, ); }; };
F9C5CBC9289453B300548EEE /* MessageBody.swift in Sources */ = {isa = PBXBuildFile; fileRef = F9C5C8D4289453B100548EEE /* MessageBody.swift */; };
F9C5CBCA289453B300548EEE /* MessageSender.swift in Sources */ = {isa = PBXBuildFile; fileRef = F9C5C8D5289453B100548EEE /* MessageSender.swift */; };
@ -4979,6 +4978,7 @@
50DCCBF92F1817280024D124 /* DisappearingMessagesConfigurationMessage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DisappearingMessagesConfigurationMessage.swift; sourceTree = "<group>"; };
50DCCBFB2F181A790024D124 /* ProfileKeyMessage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProfileKeyMessage.swift; sourceTree = "<group>"; };
50DCCBFD2F1820600024D124 /* OutgoingSenderKeyDistributionMessage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OutgoingSenderKeyDistributionMessage.swift; sourceTree = "<group>"; };
50DE505F2F21F4A700F30994 /* OutgoingSyncMessage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OutgoingSyncMessage.swift; sourceTree = "<group>"; };
50E42FE52C1B9EB900554BD6 /* CallLinkState.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CallLinkState.swift; sourceTree = "<group>"; };
50E42FE92C1BA3B900554BD6 /* CallHTTPClient.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CallHTTPClient.swift; sourceTree = "<group>"; };
50E51A3A2AE989C4004F9069 /* AccountAttributesTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountAttributesTest.swift; sourceTree = "<group>"; };
@ -7747,9 +7747,7 @@
F9C5C899289451B900548EEE /* SignalServiceKit.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SignalServiceKit.h; sourceTree = "<group>"; };
F9C5C89E289451B900548EEE /* SignalServiceKitTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = SignalServiceKitTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
F9C5C8BF289453B100548EEE /* OutgoingPaymentSyncMessage.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OutgoingPaymentSyncMessage.swift; sourceTree = "<group>"; };
F9C5C8C2289453B100548EEE /* OWSOutgoingSyncMessage.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OWSOutgoingSyncMessage.m; sourceTree = "<group>"; };
F9C5C8C3289453B100548EEE /* OWSSyncContactsMessage.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OWSSyncContactsMessage.swift; sourceTree = "<group>"; };
F9C5C8D2289453B100548EEE /* OWSOutgoingSyncMessage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OWSOutgoingSyncMessage.h; sourceTree = "<group>"; };
F9C5C8D3289453B100548EEE /* TSCall.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TSCall.h; sourceTree = "<group>"; };
F9C5C8D4289453B100548EEE /* MessageBody.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MessageBody.swift; sourceTree = "<group>"; };
F9C5C8D5289453B100548EEE /* MessageSender.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MessageSender.swift; sourceTree = "<group>"; };
@ -14438,9 +14436,8 @@
F9C5C8BF289453B100548EEE /* OutgoingPaymentSyncMessage.swift */,
D93CE1232A5C84F600D916B7 /* OutgoingRequestSyncMessage.swift */,
C16B8B742B8940D40030BA24 /* OutgoingSentMessageTranscript.swift */,
50DE505F2F21F4A700F30994 /* OutgoingSyncMessage.swift */,
6619A1C62B2BA21F004B38FE /* OWSIncomingSentMessageTranscript.swift */,
F9C5C8D2289453B100548EEE /* OWSOutgoingSyncMessage.h */,
F9C5C8C2289453B100548EEE /* OWSOutgoingSyncMessage.m */,
F9C5C8C3289453B100548EEE /* OWSSyncContactsMessage.swift */,
);
path = DeviceSyncing;
@ -15326,7 +15323,6 @@
C190F8F52C1B47E100D1EAC9 /* OWSOutgoingArchivedPaymentMessage.h in Headers */,
F9C5CC05289453B300548EEE /* OWSOutgoingPaymentMessage.h in Headers */,
F9C5CC39289453B300548EEE /* OWSOutgoingReactionMessage.h in Headers */,
F9C5CBC7289453B300548EEE /* OWSOutgoingSyncMessage.h in Headers */,
6642A8702A8D7B4B00E591C2 /* OWSPaymentActivationRequestFinishedMessage.h in Headers */,
6642A8742A8D80CB00E591C2 /* OWSPaymentActivationRequestMessage.h in Headers */,
6605D4FD2A85AD17004DC345 /* OWSPaymentMessage.h in Headers */,
@ -19094,6 +19090,7 @@
C16B8B752B8940D40030BA24 /* OutgoingSentMessageTranscript.swift in Sources */,
F9C5CC5A289453B300548EEE /* OutgoingStoryMessage.swift in Sources */,
884E4C4828AF2F2A007A338C /* OutgoingStorySentMessageTranscript.swift in Sources */,
50DE50602F21F4A700F30994 /* OutgoingSyncMessage.swift in Sources */,
042223BA2EDF30BA00158556 /* OutgoingUnpinMessage.swift in Sources */,
50BCD5562F219A730032BF02 /* OutgoingVerificationStateSyncMessage.swift in Sources */,
50BCD5402F21447B0032BF02 /* OutgoingViewedReceiptsSyncMessage.swift in Sources */,
@ -19169,7 +19166,6 @@
6674807E2E344EE9004DA6E9 /* OWSOutgoingPaymentMessage.swift in Sources */,
F9C5CC3B289453B300548EEE /* OWSOutgoingReactionMessage.m in Sources */,
505B228329F73ABE005578F3 /* OWSOutgoingResendResponse.swift in Sources */,
F9C5CBB7289453B300548EEE /* OWSOutgoingSyncMessage.m in Sources */,
6642A87A2A8D85F500E591C2 /* OWSPaymentActivationRequestFinishedMessage+SDS.swift in Sources */,
6642A8722A8D7C5700E591C2 /* OWSPaymentActivationRequestFinishedMessage.m in Sources */,
6642A8792A8D85F500E591C2 /* OWSPaymentActivationRequestMessage+SDS.swift in Sources */,

View File

@ -45,7 +45,7 @@ final class PniDistributionSyncMessage {
let syncMessageBuilder = SSKProtoSyncMessage.builder()
syncMessageBuilder.setPniChangeNumber(changeNumberBuilder.buildInfallibly())
let syncMessageProto = try OWSOutgoingSyncMessage.buildSyncMessageProto(for: syncMessageBuilder)
let syncMessageProto = try OutgoingSyncMessage.buildSyncMessageProto(forMessageBuilder: syncMessageBuilder)
let contentProto = SSKProtoContent.builder()
contentProto.setSyncMessage(syncMessageProto)

View File

@ -103,7 +103,7 @@ class OutgoingCallEvent: NSObject, NSSecureCoding {
///
/// - SeeAlso ``IncomingCallEventSyncMessageManager``
@objc(OutgoingCallEventSyncMessage)
public class OutgoingCallEventSyncMessage: OWSOutgoingSyncMessage {
public class OutgoingCallEventSyncMessage: OutgoingSyncMessage {
override public class var supportsSecureCoding: Bool { true }
public required init?(coder: NSCoder) {
@ -142,12 +142,12 @@ public class OutgoingCallEventSyncMessage: OWSOutgoingSyncMessage {
tx: DBReadTransaction,
) {
self.callEvent = event
super.init(localThread: localThread, transaction: tx)
super.init(localThread: localThread, tx: tx)
}
override public var isUrgent: Bool { false }
override public func syncMessageBuilder(transaction: DBReadTransaction) -> SSKProtoSyncMessageBuilder? {
override public func syncMessageBuilder(tx: DBReadTransaction) -> SSKProtoSyncMessageBuilder? {
let callEventBuilder = SSKProtoSyncMessageCallEvent.builder()
callEventBuilder.setCallID(callEvent.callId)
callEventBuilder.setType(callEvent.callType.protoValue)

View File

@ -7,7 +7,7 @@ import Foundation
public import SignalRingRTC
@objc(OutgoingCallLinkUpdateMessage)
public class OutgoingCallLinkUpdateMessage: OWSOutgoingSyncMessage {
public class OutgoingCallLinkUpdateMessage: OutgoingSyncMessage {
override public class var supportsSecureCoding: Bool { true }
public required init?(coder: NSCoder) {
@ -54,12 +54,12 @@ public class OutgoingCallLinkUpdateMessage: OWSOutgoingSyncMessage {
) {
self.rootKey = rootKey.bytes
self.adminPasskey = adminPasskey
super.init(localThread: localThread, transaction: tx)
super.init(localThread: localThread, tx: tx)
}
override public var isUrgent: Bool { false }
override public func syncMessageBuilder(transaction: DBReadTransaction) -> SSKProtoSyncMessageBuilder? {
override public func syncMessageBuilder(tx: DBReadTransaction) -> SSKProtoSyncMessageBuilder? {
let callLinkUpdateBuilder = SSKProtoSyncMessageCallLinkUpdate.builder()
callLinkUpdateBuilder.setType(.update)
callLinkUpdateBuilder.setRootKey(self.rootKey)

View File

@ -8,7 +8,7 @@
///
/// - SeeAlso ``IncomingCallLogEventSyncMessageManager``
@objc(OutgoingCallLogEventSyncMessage)
public class OutgoingCallLogEventSyncMessage: OWSOutgoingSyncMessage {
public class OutgoingCallLogEventSyncMessage: OutgoingSyncMessage {
override public class var supportsSecureCoding: Bool { true }
public required init?(coder: NSCoder) {
@ -47,12 +47,12 @@ public class OutgoingCallLogEventSyncMessage: OWSOutgoingSyncMessage {
tx: DBReadTransaction,
) {
self.callLogEvent = callLogEvent
super.init(localThread: localThread, transaction: tx)
super.init(localThread: localThread, tx: tx)
}
override public var isUrgent: Bool { false }
override public func syncMessageBuilder(transaction: DBReadTransaction) -> SSKProtoSyncMessageBuilder? {
override public func syncMessageBuilder(tx: DBReadTransaction) -> SSKProtoSyncMessageBuilder? {
let callLogEventBuilder = SSKProtoSyncMessageCallLogEvent.builder()
callLogEventBuilder.setTimestamp(callLogEvent.timestamp)

View File

@ -7,7 +7,7 @@ import Foundation
import LibSignalClient
@objc(OWSBlockedPhoneNumbersMessage)
final class OutgoingBlockedSyncMessage: OWSOutgoingSyncMessage {
final class OutgoingBlockedSyncMessage: OutgoingSyncMessage {
let phoneNumbers: [String]
let acis: [Aci]
@ -58,10 +58,10 @@ final class OutgoingBlockedSyncMessage: OWSOutgoingSyncMessage {
self.phoneNumbers = phoneNumbers
self.acis = acis
self.groupIds = groupIds
super.init(localThread: localThread, transaction: tx)
super.init(localThread: localThread, tx: tx)
}
override func syncMessageBuilder(transaction: DBReadTransaction) -> SSKProtoSyncMessageBuilder? {
override func syncMessageBuilder(tx: DBReadTransaction) -> SSKProtoSyncMessageBuilder? {
let blockedBuilder = SSKProtoSyncMessageBlocked.builder()
blockedBuilder.setNumbers(self.phoneNumbers)
if BuildFlags.serviceIdStrings {

View File

@ -6,7 +6,7 @@
/// Informs other platforms that a linked device's name has changed, and they
/// should refresh their list of linked devices.
@objc(OutgoingDeviceNameChangeSyncMessage)
public class OutgoingDeviceNameChangeSyncMessage: OWSOutgoingSyncMessage {
public class OutgoingDeviceNameChangeSyncMessage: OutgoingSyncMessage {
override public class var supportsSecureCoding: Bool { true }
public required init?(coder: NSCoder) {
@ -44,12 +44,12 @@ public class OutgoingDeviceNameChangeSyncMessage: OWSOutgoingSyncMessage {
tx: DBReadTransaction,
) {
self.deviceId = deviceId
super.init(localThread: localThread, transaction: tx)
super.init(localThread: localThread, tx: tx)
}
override public var isUrgent: Bool { false }
override public func syncMessageBuilder(transaction: DBReadTransaction) -> SSKProtoSyncMessageBuilder? {
override public func syncMessageBuilder(tx: DBReadTransaction) -> SSKProtoSyncMessageBuilder? {
let deviceNameChangeBuilder = SSKProtoSyncMessageDeviceNameChange.builder()
deviceNameChangeBuilder.setDeviceID(deviceId)

View File

@ -7,7 +7,7 @@ import Foundation
import LibSignalClient
@objc(OWSReadReceiptsForLinkedDevicesMessage)
final class OutgoingReadReceiptsSyncMessage: OWSOutgoingSyncMessage {
final class OutgoingReadReceiptsSyncMessage: OutgoingSyncMessage {
let readReceipts: [LinkedDeviceReadReceipt]
@ -17,7 +17,7 @@ final class OutgoingReadReceiptsSyncMessage: OWSOutgoingSyncMessage {
tx: DBReadTransaction,
) {
self.readReceipts = readReceipts
super.init(localThread: localThread, transaction: tx)
super.init(localThread: localThread, tx: tx)
}
override class var supportsSecureCoding: Bool { true }
@ -49,7 +49,7 @@ final class OutgoingReadReceiptsSyncMessage: OWSOutgoingSyncMessage {
return true
}
override func syncMessageBuilder(transaction: DBReadTransaction) -> SSKProtoSyncMessageBuilder? {
override func syncMessageBuilder(tx: DBReadTransaction) -> SSKProtoSyncMessageBuilder? {
let syncMessageBuilder = SSKProtoSyncMessage.builder()
for readReceipt in self.readReceipts {
let readProtoBuilder = SSKProtoSyncMessageRead.builder(timestamp: readReceipt.messageIdTimestamp)

View File

@ -6,7 +6,7 @@
import Foundation
@objc(OWSVerificationStateSyncMessage)
final class OutgoingVerificationStateSyncMessage: OWSOutgoingSyncMessage {
final class OutgoingVerificationStateSyncMessage: OutgoingSyncMessage {
// This is a clunky name, but we want to differentiate it from
// `recipientIdentifier` inherited from `TSOutgoingMessage`
@ -40,7 +40,7 @@ final class OutgoingVerificationStateSyncMessage: OWSOutgoingSyncMessage {
// subtract it from the total length.
self.paddingBytesLength = UInt.random(in: 1...512)
super.init(localThread: localThread, transaction: tx)
super.init(localThread: localThread, tx: tx)
}
override class var supportsSecureCoding: Bool { true }
@ -98,7 +98,7 @@ final class OutgoingVerificationStateSyncMessage: OWSOutgoingSyncMessage {
return true
}
override func syncMessageBuilder(transaction: DBReadTransaction) -> SSKProtoSyncMessageBuilder? {
override func syncMessageBuilder(tx: DBReadTransaction) -> SSKProtoSyncMessageBuilder? {
// We add the same amount of padding in the VerificationStateSync message and it's corresponding NullMessage so that
// the sync message is indistinguishable from an outgoing Sent transcript corresponding to the NullMessage. We pad
// the NullMessage so as to obscure it's content. The sync message (like all sync messages) will be *additionally*

View File

@ -7,7 +7,7 @@ import Foundation
import LibSignalClient
@objc(OWSViewOnceMessageReadSyncMessage)
final class OutgoingViewOnceOpenSyncMessage: OWSOutgoingSyncMessage {
final class OutgoingViewOnceOpenSyncMessage: OutgoingSyncMessage {
let senderAddress: SignalServiceAddress
let messageIdTimestamp: UInt64
@ -26,7 +26,7 @@ final class OutgoingViewOnceOpenSyncMessage: OWSOutgoingSyncMessage {
self.messageUniqueId = message.uniqueId
self.messageIdTimestamp = message.timestamp
self.readTimestamp = readTimestamp
super.init(localThread: localThread, transaction: tx)
super.init(localThread: localThread, tx: tx)
}
override class var supportsSecureCoding: Bool { true }
@ -82,7 +82,7 @@ final class OutgoingViewOnceOpenSyncMessage: OWSOutgoingSyncMessage {
override var isUrgent: Bool { false }
override func syncMessageBuilder(transaction: DBReadTransaction) -> SSKProtoSyncMessageBuilder? {
override func syncMessageBuilder(tx: DBReadTransaction) -> SSKProtoSyncMessageBuilder? {
let syncMessageBuilder = SSKProtoSyncMessage.builder()
let readProtoBuilder = SSKProtoSyncMessageViewOnceOpen.builder(timestamp: self.messageIdTimestamp)

View File

@ -7,7 +7,7 @@ import Foundation
import LibSignalClient
@objc(OWSViewedReceiptsForLinkedDevicesMessage)
final class OutgoingViewedReceiptsSyncMessage: OWSOutgoingSyncMessage {
final class OutgoingViewedReceiptsSyncMessage: OutgoingSyncMessage {
let viewedReceipts: [LinkedDeviceViewedReceipt]
@ -17,7 +17,7 @@ final class OutgoingViewedReceiptsSyncMessage: OWSOutgoingSyncMessage {
tx: DBReadTransaction,
) {
self.viewedReceipts = viewedReceipts
super.init(localThread: localThread, transaction: tx)
super.init(localThread: localThread, tx: tx)
}
override class var supportsSecureCoding: Bool { true }
@ -51,7 +51,7 @@ final class OutgoingViewedReceiptsSyncMessage: OWSOutgoingSyncMessage {
override var isUrgent: Bool { false }
override func syncMessageBuilder(transaction: DBReadTransaction) -> SSKProtoSyncMessageBuilder? {
override func syncMessageBuilder(tx: DBReadTransaction) -> SSKProtoSyncMessageBuilder? {
let syncMessageBuilder = SSKProtoSyncMessage.builder()
for viewedReceipt in self.viewedReceipts {
let viewedProtoBuilder = SSKProtoSyncMessageViewed.builder(timestamp: viewedReceipt.messageIdTimestamp)

View File

@ -11,7 +11,7 @@ enum StickerPackOperationType: UInt {
}
@objc(OWSStickerPackSyncMessage)
final class StickerPackSyncMessage: OWSOutgoingSyncMessage {
final class StickerPackSyncMessage: OutgoingSyncMessage {
private let packs: [StickerPackInfo]
private let operationType: StickerPackOperationType
@ -61,10 +61,10 @@ final class StickerPackSyncMessage: OWSOutgoingSyncMessage {
) {
self.packs = packs
self.operationType = operationType
super.init(localThread: localThread, transaction: tx)
super.init(localThread: localThread, tx: tx)
}
override func syncMessageBuilder(transaction: DBReadTransaction) -> SSKProtoSyncMessageBuilder? {
override func syncMessageBuilder(tx: DBReadTransaction) -> SSKProtoSyncMessageBuilder? {
let operationType: SSKProtoSyncMessageStickerPackOperationType
switch self.operationType {
case .install:

View File

@ -10,7 +10,7 @@ import LibSignalClient
///
/// - SeeAlso ``DeleteForMeOutgoingSyncMessageManager``
@objc(DeleteForMeOutgoingSyncMessage)
class DeleteForMeOutgoingSyncMessage: OWSOutgoingSyncMessage {
final class DeleteForMeOutgoingSyncMessage: OutgoingSyncMessage {
override class var supportsSecureCoding: Bool { true }
required init?(coder: NSCoder) {
@ -111,12 +111,12 @@ class DeleteForMeOutgoingSyncMessage: OWSOutgoingSyncMessage {
return nil
}
super.init(localThread: localThread, transaction: tx)
super.init(localThread: localThread, tx: tx)
}
override var isUrgent: Bool { false }
override func syncMessageBuilder(transaction: DBReadTransaction) -> SSKProtoSyncMessageBuilder? {
override func syncMessageBuilder(tx: DBReadTransaction) -> SSKProtoSyncMessageBuilder? {
let contents: Contents
do {
contents = try JSONDecoder().decode(Contents.self, from: self.contents)

View File

@ -1,90 +0,0 @@
//
// Copyright 2018 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
//
#import <SignalServiceKit/TSOutgoingMessage.h>
NS_ASSUME_NONNULL_BEGIN
@class DBReadTransaction;
@class SSKProtoSyncMessage;
@class SSKProtoSyncMessageBuilder;
@class TSContactThread;
/**
* Abstract base class used for the family of sync messages which take care
* of keeping your multiple registered devices consistent. E.g. sharing contacts, sharing groups,
* notifying your devices of sent messages, and "read" receipts.
*/
@interface OWSOutgoingSyncMessage : TSOutgoingMessage
- (instancetype)initOutgoingMessageWithBuilder:(TSOutgoingMessageBuilder *)outgoingMessageBuilder
recipientAddressStates:
(NSDictionary<SignalServiceAddress *, TSOutgoingMessageRecipientState *> *)
recipientAddressStates NS_UNAVAILABLE;
- (instancetype)initOutgoingMessageWithBuilder:(TSOutgoingMessageBuilder *)outgoingMessageBuilder
additionalRecipients:(NSArray<ServiceIdObjC *> *)additionalRecipients
explicitRecipients:(NSArray<AciObjC *> *)explicitRecipients
skippedRecipients:(NSArray<ServiceIdObjC *> *)skippedRecipients
transaction:(DBReadTransaction *)transaction NS_UNAVAILABLE;
- (instancetype)initWithGrdbId:(int64_t)grdbId
uniqueId:(NSString *)uniqueId
receivedAtTimestamp:(uint64_t)receivedAtTimestamp
sortId:(uint64_t)sortId
timestamp:(uint64_t)timestamp
uniqueThreadId:(NSString *)uniqueThreadId
body:(nullable NSString *)body
bodyRanges:(nullable MessageBodyRanges *)bodyRanges
contactShare:(nullable OWSContact *)contactShare
deprecated_attachmentIds:(nullable NSArray<NSString *> *)deprecated_attachmentIds
editState:(TSEditState)editState
expireStartedAt:(uint64_t)expireStartedAt
expireTimerVersion:(nullable NSNumber *)expireTimerVersion
expiresAt:(uint64_t)expiresAt
expiresInSeconds:(unsigned int)expiresInSeconds
giftBadge:(nullable OWSGiftBadge *)giftBadge
isGroupStoryReply:(BOOL)isGroupStoryReply
isPoll:(BOOL)isPoll
isSmsMessageRestoredFromBackup:(BOOL)isSmsMessageRestoredFromBackup
isViewOnceComplete:(BOOL)isViewOnceComplete
isViewOnceMessage:(BOOL)isViewOnceMessage
linkPreview:(nullable OWSLinkPreview *)linkPreview
messageSticker:(nullable MessageSticker *)messageSticker
quotedMessage:(nullable TSQuotedMessage *)quotedMessage
storedShouldStartExpireTimer:(BOOL)storedShouldStartExpireTimer
storyAuthorUuidString:(nullable NSString *)storyAuthorUuidString
storyReactionEmoji:(nullable NSString *)storyReactionEmoji
storyTimestamp:(nullable NSNumber *)storyTimestamp
wasRemotelyDeleted:(BOOL)wasRemotelyDeleted
customMessage:(nullable NSString *)customMessage
groupMetaMessage:(TSGroupMetaMessage)groupMetaMessage
hasLegacyMessageState:(BOOL)hasLegacyMessageState
hasSyncedTranscript:(BOOL)hasSyncedTranscript
isVoiceMessage:(BOOL)isVoiceMessage
legacyMessageState:(TSOutgoingMessageState)legacyMessageState
legacyWasDelivered:(BOOL)legacyWasDelivered
mostRecentFailureText:(nullable NSString *)mostRecentFailureText
recipientAddressStates:(nullable NSDictionary<SignalServiceAddress *, TSOutgoingMessageRecipientState *> *)
recipientAddressStates
storedMessageState:(TSOutgoingMessageState)storedMessageState
wasNotCreatedLocally:(BOOL)wasNotCreatedLocally NS_UNAVAILABLE;
- (instancetype)initWithLocalThread:(TSContactThread *)localThread
transaction:(DBReadTransaction *)transaction NS_DESIGNATED_INITIALIZER;
- (instancetype)initWithTimestamp:(uint64_t)timestamp
localThread:(TSContactThread *)localThread
transaction:(DBReadTransaction *)transaction NS_DESIGNATED_INITIALIZER;
- (nullable instancetype)initWithCoder:(NSCoder *)coder NS_DESIGNATED_INITIALIZER;
- (nullable SSKProtoSyncMessageBuilder *)syncMessageBuilderWithTransaction:(DBReadTransaction *)transaction
NS_SWIFT_NAME(syncMessageBuilder(transaction:));
+ (nullable SSKProtoSyncMessage *)buildSyncMessageProtoForMessageBuilder:
(SSKProtoSyncMessageBuilder *)syncMessageBuilder
error:(NSError **)errorHandle;
@end
NS_ASSUME_NONNULL_END

View File

@ -1,120 +0,0 @@
//
// Copyright 2017 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
//
#import "OWSOutgoingSyncMessage.h"
#import <SignalServiceKit/SignalServiceKit-Swift.h>
NS_ASSUME_NONNULL_BEGIN
@implementation OWSOutgoingSyncMessage
+ (BOOL)supportsSecureCoding
{
return YES;
}
- (nullable instancetype)initWithCoder:(NSCoder *)coder
{
return [super initWithCoder:coder];
}
- (instancetype)initWithLocalThread:(TSContactThread *)localThread transaction:(DBReadTransaction *)transaction
{
TSOutgoingMessageBuilder *messageBuilder = [TSOutgoingMessageBuilder outgoingMessageBuilderWithThread:localThread];
self = [super initOutgoingMessageWithBuilder:messageBuilder
additionalRecipients:@[]
explicitRecipients:@[]
skippedRecipients:@[]
transaction:transaction];
if (!self) {
return self;
}
return self;
}
- (instancetype)initWithTimestamp:(uint64_t)timestamp
localThread:(TSContactThread *)localThread
transaction:(DBReadTransaction *)transaction
{
TSOutgoingMessageBuilder *messageBuilder = [TSOutgoingMessageBuilder outgoingMessageBuilderWithThread:localThread];
messageBuilder.timestamp = timestamp;
self = [super initOutgoingMessageWithBuilder:messageBuilder
additionalRecipients:@[]
explicitRecipients:@[]
skippedRecipients:@[]
transaction:transaction];
if (!self) {
return self;
}
return self;
}
- (BOOL)shouldBeSaved
{
return NO;
}
- (BOOL)shouldSyncTranscript
{
return NO;
}
// This method should not be overridden, since we want to add random padding to *every* sync message
- (nullable SSKProtoSyncMessage *)buildSyncMessageWithTransaction:(DBReadTransaction *)transaction
{
SSKProtoSyncMessageBuilder *_Nullable builder = [self syncMessageBuilderWithTransaction:transaction];
if (!builder) {
return nil;
}
NSError *error;
SSKProtoSyncMessage *_Nullable proto = [[self class] buildSyncMessageProtoForMessageBuilder:builder error:&error];
if (error || !proto) {
OWSFailDebug(@"could not build protobuf: %@", error);
return nil;
}
return proto;
}
- (nullable SSKProtoSyncMessageBuilder *)syncMessageBuilderWithTransaction:(DBReadTransaction *)transaction
{
OWSAbstractMethod();
return [SSKProtoSyncMessage builder];
}
- (nullable SSKProtoContentBuilder *)contentBuilderWithThread:(TSThread *)thread
transaction:(DBReadTransaction *)transaction
{
SSKProtoSyncMessage *_Nullable syncMessage = [self buildSyncMessageWithTransaction:transaction];
if (!syncMessage) {
return nil;
}
SSKProtoContentBuilder *contentBuilder = [SSKProtoContent builder];
[contentBuilder setSyncMessage:syncMessage];
return contentBuilder;
}
+ (nullable SSKProtoSyncMessage *)buildSyncMessageProtoForMessageBuilder:
(SSKProtoSyncMessageBuilder *)syncMessageBuilder
error:(NSError **)errorHandle
{
// Add a random 1-512 bytes to obscure sync message type
size_t paddingBytesLength = arc4random_uniform(512) + 1;
syncMessageBuilder.padding = [Randomness generateRandomBytes:paddingBytesLength];
return [syncMessageBuilder buildAndReturnError:errorHandle];
}
@end
NS_ASSUME_NONNULL_END

View File

@ -5,7 +5,7 @@
import Foundation
public final class OWSSyncContactsMessage: OWSOutgoingSyncMessage {
public final class OWSSyncContactsMessage: OutgoingSyncMessage {
private let uploadedAttachment: Upload.Result<Upload.LocalUploadMetadata>
@ -15,7 +15,7 @@ public final class OWSSyncContactsMessage: OWSOutgoingSyncMessage {
tx: DBReadTransaction,
) {
self.uploadedAttachment = uploadedAttachment
super.init(localThread: localThread, transaction: tx)
super.init(localThread: localThread, tx: tx)
}
override public func encode(with coder: NSCoder) {
@ -29,7 +29,7 @@ public final class OWSSyncContactsMessage: OWSOutgoingSyncMessage {
override public var isUrgent: Bool { false }
override public func syncMessageBuilder(transaction tx: DBReadTransaction) -> SSKProtoSyncMessageBuilder? {
override public func syncMessageBuilder(tx: DBReadTransaction) -> SSKProtoSyncMessageBuilder? {
let attachmentBuilder = SSKProtoAttachmentPointer.builder()

View File

@ -6,7 +6,7 @@
import Foundation
@objc(OWSSyncConfigurationMessage)
final class OutgoingConfigurationSyncMessage: OWSOutgoingSyncMessage {
final class OutgoingConfigurationSyncMessage: OutgoingSyncMessage {
private let areReadReceiptsEnabled: Bool
private let showUnidentifiedDeliveryIndicators: Bool
@ -28,7 +28,7 @@ final class OutgoingConfigurationSyncMessage: OWSOutgoingSyncMessage {
self.showTypingIndicators = showTypingIndicators
self.sendLinkPreviews = sendLinkPreviews
self.provisioningVersion = provisioningVersion
super.init(localThread: localThread, transaction: tx)
super.init(localThread: localThread, tx: tx)
}
override class var supportsSecureCoding: Bool { true }
@ -73,7 +73,7 @@ final class OutgoingConfigurationSyncMessage: OWSOutgoingSyncMessage {
return true
}
override func syncMessageBuilder(transaction: DBReadTransaction) -> SSKProtoSyncMessageBuilder? {
override func syncMessageBuilder(tx: DBReadTransaction) -> SSKProtoSyncMessageBuilder? {
let configurationBuilder = SSKProtoSyncMessageConfiguration.builder()
configurationBuilder.setReadReceipts(self.areReadReceiptsEnabled)
configurationBuilder.setUnidentifiedDeliveryIndicators(self.showUnidentifiedDeliveryIndicators)

View File

@ -6,7 +6,7 @@
import Foundation
@objc(OWSSyncFetchLatestMessage)
final class OutgoingFetchLatestSyncMessage: OWSOutgoingSyncMessage {
final class OutgoingFetchLatestSyncMessage: OutgoingSyncMessage {
enum FetchType: UInt {
case localProfile = 1
@ -22,7 +22,7 @@ final class OutgoingFetchLatestSyncMessage: OWSOutgoingSyncMessage {
tx: DBReadTransaction,
) {
self.fetchType = fetchType
super.init(localThread: localThread, transaction: tx)
super.init(localThread: localThread, tx: tx)
}
override class var supportsSecureCoding: Bool { true }
@ -65,7 +65,7 @@ final class OutgoingFetchLatestSyncMessage: OWSOutgoingSyncMessage {
}
}
override func syncMessageBuilder(transaction: DBReadTransaction) -> SSKProtoSyncMessageBuilder? {
override func syncMessageBuilder(tx: DBReadTransaction) -> SSKProtoSyncMessageBuilder? {
let fetchLatestBuilder = SSKProtoSyncMessageFetchLatest.builder()
fetchLatestBuilder.setType(self.fetchTypeAsProtoFetchType)

View File

@ -6,7 +6,7 @@
import Foundation
@objc(OWSSyncKeysMessage)
final class OutgoingKeysSyncMessage: OWSOutgoingSyncMessage {
final class OutgoingKeysSyncMessage: OutgoingSyncMessage {
let accountEntropyPool: String?
let masterKey: Data?
@ -22,7 +22,7 @@ final class OutgoingKeysSyncMessage: OWSOutgoingSyncMessage {
self.accountEntropyPool = accountEntropyPool?.rawString
self.masterKey = masterKey?.rawData
self.mediaRootBackupKey = mediaRootBackupKey?.serialize()
super.init(localThread: localThread, transaction: tx)
super.init(localThread: localThread, tx: tx)
}
override class var supportsSecureCoding: Bool { true }
@ -65,7 +65,7 @@ final class OutgoingKeysSyncMessage: OWSOutgoingSyncMessage {
return true
}
override func syncMessageBuilder(transaction: DBReadTransaction) -> SSKProtoSyncMessageBuilder? {
override func syncMessageBuilder(tx: DBReadTransaction) -> SSKProtoSyncMessageBuilder? {
let keysBuilder = SSKProtoSyncMessageKeys.builder()
if let accountEntropyPool {
keysBuilder.setAccountEntropyPool(accountEntropyPool)

View File

@ -7,7 +7,7 @@ import Foundation
import LibSignalClient
@objc(OWSSyncMessageRequestResponseMessage)
public final class OutgoingMessageRequestResponseSyncMessage: OWSOutgoingSyncMessage {
public final class OutgoingMessageRequestResponseSyncMessage: OutgoingSyncMessage {
public enum ResponseType: UInt64 {
case accept = 0
@ -115,10 +115,10 @@ public final class OutgoingMessageRequestResponseSyncMessage: OWSOutgoingSyncMes
owsFailDebug("can't response to thread type")
}
self.responseType = responseType
super.init(localThread: localThread, transaction: tx)
super.init(localThread: localThread, tx: tx)
}
override public func syncMessageBuilder(transaction: DBReadTransaction) -> SSKProtoSyncMessageBuilder? {
override public func syncMessageBuilder(tx: DBReadTransaction) -> SSKProtoSyncMessageBuilder? {
let messageRequestResponseBuilder = SSKProtoSyncMessageMessageRequestResponse.builder()
messageRequestResponseBuilder.setType(self.responseType.asProtoResponseType)
@ -135,7 +135,7 @@ public final class OutgoingMessageRequestResponseSyncMessage: OWSOutgoingSyncMes
// Fallback behavior. Messages of this version are no longer created.
// Eventually, all enqueued messages of this type should be resolved
// (either because they have been sent or because they ran out of retries).
let thread = self.thread(tx: transaction)
let thread = self.thread(tx: tx)
guard let thread else {
owsFailDebug("Missing thread for message request response")
return nil

View File

@ -6,7 +6,7 @@
import Foundation
@objc(OutgoingPaymentSyncMessage)
public final class OutgoingPaymentSyncMessage: OWSOutgoingSyncMessage {
public final class OutgoingPaymentSyncMessage: OutgoingSyncMessage {
let mobileCoin: OutgoingPaymentMobileCoin
@ -16,7 +16,7 @@ public final class OutgoingPaymentSyncMessage: OWSOutgoingSyncMessage {
tx: DBReadTransaction,
) {
self.mobileCoin = mobileCoin
super.init(localThread: localThread, transaction: tx)
super.init(localThread: localThread, tx: tx)
}
override public class var supportsSecureCoding: Bool { true }
@ -48,7 +48,7 @@ public final class OutgoingPaymentSyncMessage: OWSOutgoingSyncMessage {
return true
}
override public func syncMessageBuilder(transaction: DBReadTransaction) -> SSKProtoSyncMessageBuilder? {
override public func syncMessageBuilder(tx: DBReadTransaction) -> SSKProtoSyncMessageBuilder? {
do {
let amountPicoMob = mobileCoin.amountPicoMob
let feePicoMob = mobileCoin.feePicoMob

View File

@ -4,7 +4,7 @@
//
@objc(OWSSyncRequestMessage)
final class OutgoingRequestSyncMessage: OWSOutgoingSyncMessage {
final class OutgoingRequestSyncMessage: OutgoingSyncMessage {
let requestType: SSKProtoSyncMessageRequestType
init(
@ -13,7 +13,7 @@ final class OutgoingRequestSyncMessage: OWSOutgoingSyncMessage {
tx: DBReadTransaction,
) {
self.requestType = requestType
super.init(localThread: localThread, transaction: tx)
super.init(localThread: localThread, tx: tx)
}
override class var supportsSecureCoding: Bool { true }
@ -48,7 +48,7 @@ final class OutgoingRequestSyncMessage: OWSOutgoingSyncMessage {
return true
}
override func syncMessageBuilder(transaction: DBReadTransaction) -> SSKProtoSyncMessageBuilder? {
override func syncMessageBuilder(tx: DBReadTransaction) -> SSKProtoSyncMessageBuilder? {
let requestBuilder = SSKProtoSyncMessageRequest.builder()
switch self.requestType {

View File

@ -8,7 +8,7 @@ import Foundation
/// Notifies your other registered devices (if you have any) that you've
/// sent a message. This way the message you just sent can appear on all
/// your devices.
class OutgoingSentMessageTranscript: OWSOutgoingSyncMessage {
class OutgoingSentMessageTranscript: OutgoingSyncMessage {
let message: TSOutgoingMessage
let messageThread: TSThread
let isRecipientUpdate: Bool
@ -30,7 +30,7 @@ class OutgoingSentMessageTranscript: OWSOutgoingSyncMessage {
self.sentRecipientAddress = (messageThread as? TSContactThread)?.contactAddress
// The sync message's timestamp must match the original outgoing message's timestamp.
super.init(timestamp: message.timestamp, localThread: localThread, transaction: tx)
super.init(timestamp: message.timestamp, localThread: localThread, tx: tx)
}
override func encode(with coder: NSCoder) {
@ -64,7 +64,7 @@ class OutgoingSentMessageTranscript: OWSOutgoingSyncMessage {
override var isUrgent: Bool { false }
override func syncMessageBuilder(transaction: DBReadTransaction) -> SSKProtoSyncMessageBuilder? {
override func syncMessageBuilder(tx: DBReadTransaction) -> SSKProtoSyncMessageBuilder? {
let sentBuilder = SSKProtoSyncMessageSent.builder()
sentBuilder.setTimestamp(self.timestamp)
if let phoneNumber = self.sentRecipientAddress?.phoneNumber {
@ -80,11 +80,11 @@ class OutgoingSentMessageTranscript: OWSOutgoingSyncMessage {
}
sentBuilder.setIsRecipientUpdate(self.isRecipientUpdate)
guard prepareDataSyncMessageContent(with: sentBuilder, tx: transaction) else {
guard prepareDataSyncMessageContent(with: sentBuilder, tx: tx) else {
return nil
}
prepareUnidentifiedStatusSyncMessageContent(with: sentBuilder, tx: transaction)
prepareUnidentifiedStatusSyncMessageContent(with: sentBuilder, tx: tx)
do {
let syncMessageBuilder = SSKProtoSyncMessage.builder()

View File

@ -0,0 +1,82 @@
//
// Copyright 2026 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
//
import Foundation
/**
* Abstract base class used for the family of sync messages which take care
* of keeping your multiple registered devices consistent. E.g. sharing contacts, sharing groups,
* notifying your devices of sent messages, and "read" receipts.
*/
@objc(OWSOutgoingSyncMessage)
public class OutgoingSyncMessage: TSOutgoingMessage {
override public class var supportsSecureCoding: Bool { true }
required init?(coder: NSCoder) {
super.init(coder: coder)
}
init(localThread: TSContactThread, tx: DBReadTransaction) {
let messageBuilder = TSOutgoingMessageBuilder.outgoingMessageBuilder(thread: localThread)
super.init(
outgoingMessageWith: messageBuilder,
additionalRecipients: [],
explicitRecipients: [],
skippedRecipients: [],
transaction: tx,
)
}
init(timestamp: UInt64, localThread: TSContactThread, tx: DBReadTransaction) {
let messageBuilder = TSOutgoingMessageBuilder.outgoingMessageBuilder(thread: localThread)
messageBuilder.timestamp = timestamp
super.init(
outgoingMessageWith: messageBuilder,
additionalRecipients: [],
explicitRecipients: [],
skippedRecipients: [],
transaction: tx,
)
}
override public var shouldBeSaved: Bool { false }
override public func shouldSyncTranscript() -> Bool { false }
// This method should not be overridden because we want to add random padding to *every* sync message
private func buildSyncMessage(tx: DBReadTransaction) -> SSKProtoSyncMessage? {
guard let builder = self.syncMessageBuilder(tx: tx) else {
return nil
}
do {
return try Self.buildSyncMessageProto(forMessageBuilder: builder)
} catch {
owsFailDebug("could not build protobuf: \(error)")
return nil
}
}
func syncMessageBuilder(tx: DBReadTransaction) -> SSKProtoSyncMessageBuilder? {
owsFail("Method must be implemented by subclasses.")
}
override public func contentBuilder(thread: TSThread, transaction: DBReadTransaction) -> SSKProtoContentBuilder? {
guard let syncMessage = self.buildSyncMessage(tx: transaction) else {
return nil
}
let contentBuilder = SSKProtoContent.builder()
contentBuilder.setSyncMessage(syncMessage)
return contentBuilder
}
static func buildSyncMessageProto(forMessageBuilder messageBuilder: SSKProtoSyncMessageBuilder) throws -> SSKProtoSyncMessage {
// Add a random 1-512 bytes to obscure sync message type
let paddingBytesLength = UInt.random(in: 1...512)
messageBuilder.setPadding(Randomness.generateRandomBytes(paddingBytesLength))
return try messageBuilder.build()
}
}

View File

@ -129,7 +129,7 @@ public final class OutgoingEditMessage: TSOutgoingMessage {
override public func buildTranscriptSyncMessage(
localThread: TSContactThread,
transaction: DBWriteTransaction,
) -> OWSOutgoingSyncMessage? {
) -> OutgoingSyncMessage? {
guard let thread = thread(tx: transaction) else {
owsFailDebug("Missing thread for interaction.")
return nil

View File

@ -167,7 +167,7 @@ extension TSInteraction {
public func shouldAppearInInbox(
groupUpdateItemsBuilder: (TSInfoMessage) -> [TSInfoMessage.PersistableGroupUpdateItem]?,
) -> Bool {
if !shouldBeSaved || isDynamicInteraction || self is OWSOutgoingSyncMessage {
if !shouldBeSaved || isDynamicInteraction || self is OutgoingSyncMessage {
owsFailDebug("Unexpected interaction type: \(type(of: self))")
return false
}

View File

@ -4,7 +4,6 @@
//
#import "TSOutgoingMessage.h"
#import "OWSOutgoingSyncMessage.h"
#import "TSContactThread.h"
#import "TSGroupThread.h"
#import "TSQuotedMessage.h"

View File

@ -538,7 +538,7 @@ extension TSOutgoingMessage {
}
@objc
func _buildTranscriptSyncMessage(localThread: TSContactThread, tx: DBWriteTransaction) -> OWSOutgoingSyncMessage? {
func _buildTranscriptSyncMessage(localThread: TSContactThread, tx: DBWriteTransaction) -> OutgoingSyncMessage? {
owsAssertDebug(self.shouldSyncTranscript())
guard let messageThread = self.thread(tx: tx) else {

View File

@ -124,7 +124,7 @@ public class MessageSendLog {
// not a major issue. The MSL is critical for correct behavior of sender
// key messages. For non sender key messages, it's a nice-to-have in case
// some unforeseen decryption failure happens.
owsAssertDebug(message is OWSOutgoingSyncMessage, "Found an MSL inconsistency for a non-sync message.")
owsAssertDebug(message is OutgoingSyncMessage, "Found an MSL inconsistency for a non-sync message.")
return nil
}

View File

@ -17,7 +17,7 @@ private extension TSOutgoingMessage {
self is OutgoingResendRequest
}
var isSyncMessage: Bool { self is OWSOutgoingSyncMessage }
var isSyncMessage: Bool { self is OutgoingSyncMessage }
var canSendToLocalAddress: Bool {
return isSyncMessage ||

View File

@ -128,7 +128,7 @@ public class OutgoingStoryMessage: TSOutgoingMessage {
override public func buildTranscriptSyncMessage(
localThread: TSContactThread,
transaction: DBWriteTransaction,
) -> OWSOutgoingSyncMessage? {
) -> OutgoingSyncMessage? {
guard let storyMessage = StoryMessage.anyFetch(uniqueId: storyMessageId, transaction: transaction) else {
owsFailDebug("Missing story message")
return nil

View File

@ -6,7 +6,7 @@
import Foundation
public import LibSignalClient
public class OutgoingStorySentMessageTranscript: OWSOutgoingSyncMessage {
public class OutgoingStorySentMessageTranscript: OutgoingSyncMessage {
override public class var supportsSecureCoding: Bool { true }
public required init?(coder: NSCoder) {
@ -59,14 +59,14 @@ public class OutgoingStorySentMessageTranscript: OWSOutgoingSyncMessage {
self.storyEncodedRecipientStates = Self.encodeRecipientStates(recipientStates)
self.storyMessageUniqueId = nil
self.isRecipientUpdate = true
super.init(timestamp: timestamp, localThread: localThread, transaction: transaction)
super.init(timestamp: timestamp, localThread: localThread, tx: transaction)
}
public init(localThread: TSContactThread, storyMessage: StoryMessage, transaction: DBReadTransaction) {
self.storyEncodedRecipientStates = nil
self.storyMessageUniqueId = storyMessage.uniqueId
self.isRecipientUpdate = false
super.init(timestamp: storyMessage.timestamp, localThread: localThread, transaction: transaction)
super.init(timestamp: storyMessage.timestamp, localThread: localThread, tx: transaction)
}
private static func encodeRecipientStates(_ recipientStates: [ServiceId: StoryRecipientState]) -> Data? {
@ -90,14 +90,14 @@ public class OutgoingStorySentMessageTranscript: OWSOutgoingSyncMessage {
return StoryMessage.anyFetch(uniqueId: storyMessageUniqueId, transaction: transaction)
}
override public func syncMessageBuilder(transaction: DBReadTransaction) -> SSKProtoSyncMessageBuilder? {
override public func syncMessageBuilder(tx: DBReadTransaction) -> SSKProtoSyncMessageBuilder? {
let sentBuilder = SSKProtoSyncMessageSent.builder()
sentBuilder.setTimestamp(timestamp)
sentBuilder.setIsRecipientUpdate(isRecipientUpdate)
if let storyMessage = storyMessage(transaction: transaction) {
if let storyMessage = storyMessage(transaction: tx) {
if !isRecipientUpdate {
guard let storyMessageProto = storyMessageProto(for: storyMessage, transaction: transaction) else {
guard let storyMessageProto = storyMessageProto(for: storyMessage, transaction: tx) else {
owsFailDebug("Failed to build sync proto for story message with timestamp \(storyMessage.timestamp)")
return nil
}

View File

@ -29,7 +29,6 @@ FOUNDATION_EXPORT const unsigned char SignalServiceKitVersionString[];
#import <SignalServiceKit/OWSOutgoingArchivedPaymentMessage.h>
#import <SignalServiceKit/OWSOutgoingPaymentMessage.h>
#import <SignalServiceKit/OWSOutgoingReactionMessage.h>
#import <SignalServiceKit/OWSOutgoingSyncMessage.h>
#import <SignalServiceKit/OWSPaymentActivationRequestFinishedMessage.h>
#import <SignalServiceKit/OWSPaymentActivationRequestMessage.h>
#import <SignalServiceKit/OWSPaymentMessage.h>