Path: blob/main/SignalServiceKit/Messages/Interactions/TSIncomingMessage.h
1 views
//1// Copyright 2017 Signal Messenger, LLC2// SPDX-License-Identifier: AGPL-3.0-only3//45#import <SignalServiceKit/OWSReadTracking.h>6#import <SignalServiceKit/TSMessage.h>78NS_ASSUME_NONNULL_BEGIN910@class DBWriteTransaction;11@class SignalServiceAddress;12@class TSContactThread;13@class TSGroupThread;14@class TSIncomingMessageBuilder;1516@interface TSIncomingMessage : TSMessage <OWSReadTracking>1718/// Derived from the value of the `X-Signal-Timestamp` header when receiving a19/// message from the server, this represents the server-timestamp at which we20/// popped the message off the queue.21@property (nonatomic, readonly) uint64_t serverDeliveryTimestamp;2223/// Derived from the `serverTimestamp` field on an incoming message `Envelope`,24/// this represents the server-timestamp at which the sender uploaded the25/// message to the server.26@property (nonatomic, readonly, nullable) NSNumber *serverTimestamp;2728/// Derived from the server-populated `serverGuid` field on an incoming message29/// `Envelope`, this represents a server-generated UUID for this message.30@property (nonatomic, readonly, nullable) NSString *serverGuid;3132@property (nonatomic, readonly) BOOL wasReceivedByUD;3334- (instancetype)initMessageWithBuilder:(TSMessageBuilder *)messageBuilder NS_UNAVAILABLE;3536- (instancetype)initWithGrdbId:(int64_t)grdbId37uniqueId:(NSString *)uniqueId38receivedAtTimestamp:(uint64_t)receivedAtTimestamp39sortId:(uint64_t)sortId40timestamp:(uint64_t)timestamp41uniqueThreadId:(NSString *)uniqueThreadId42body:(nullable NSString *)body43bodyRanges:(nullable MessageBodyRanges *)bodyRanges44contactShare:(nullable OWSContact *)contactShare45deprecated_attachmentIds:(nullable NSArray<NSString *> *)deprecated_attachmentIds46editState:(TSEditState)editState47expireStartedAt:(uint64_t)expireStartedAt48expireTimerVersion:(nullable NSNumber *)expireTimerVersion49expiresAt:(uint64_t)expiresAt50expiresInSeconds:(unsigned int)expiresInSeconds51giftBadge:(nullable OWSGiftBadge *)giftBadge52isGroupStoryReply:(BOOL)isGroupStoryReply53isPoll:(BOOL)isPoll54isSmsMessageRestoredFromBackup:(BOOL)isSmsMessageRestoredFromBackup55isViewOnceComplete:(BOOL)isViewOnceComplete56isViewOnceMessage:(BOOL)isViewOnceMessage57linkPreview:(nullable OWSLinkPreview *)linkPreview58messageSticker:(nullable MessageSticker *)messageSticker59quotedMessage:(nullable TSQuotedMessage *)quotedMessage60storedShouldStartExpireTimer:(BOOL)storedShouldStartExpireTimer61storyAuthorUuidString:(nullable NSString *)storyAuthorUuidString62storyReactionEmoji:(nullable NSString *)storyReactionEmoji63storyTimestamp:(nullable NSNumber *)storyTimestamp64wasRemotelyDeleted:(BOOL)wasRemotelyDeleted NS_UNAVAILABLE;6566- (nullable instancetype)initWithCoder:(NSCoder *)coder NS_UNAVAILABLE;6768- (instancetype)initIncomingMessageWithBuilder:(TSIncomingMessageBuilder *)incomingMessageBuilder69NS_DESIGNATED_INITIALIZER NS_SWIFT_NAME(init(incomingMessageWithBuilder:));7071// --- CODE GENERATION MARKER7273// This snippet is generated by /Scripts/sds_codegen/sds_generate.py. Do not manually edit it, instead run74// `sds_codegen.sh`.7576// clang-format off7778- (instancetype)initWithGrdbId:(int64_t)grdbId79uniqueId:(NSString *)uniqueId80receivedAtTimestamp:(uint64_t)receivedAtTimestamp81sortId:(uint64_t)sortId82timestamp:(uint64_t)timestamp83uniqueThreadId:(NSString *)uniqueThreadId84body:(nullable NSString *)body85bodyRanges:(nullable MessageBodyRanges *)bodyRanges86contactShare:(nullable OWSContact *)contactShare87deprecated_attachmentIds:(nullable NSArray<NSString *> *)deprecated_attachmentIds88editState:(TSEditState)editState89expireStartedAt:(uint64_t)expireStartedAt90expireTimerVersion:(nullable NSNumber *)expireTimerVersion91expiresAt:(uint64_t)expiresAt92expiresInSeconds:(unsigned int)expiresInSeconds93giftBadge:(nullable OWSGiftBadge *)giftBadge94isGroupStoryReply:(BOOL)isGroupStoryReply95isPoll:(BOOL)isPoll96isSmsMessageRestoredFromBackup:(BOOL)isSmsMessageRestoredFromBackup97isViewOnceComplete:(BOOL)isViewOnceComplete98isViewOnceMessage:(BOOL)isViewOnceMessage99linkPreview:(nullable OWSLinkPreview *)linkPreview100messageSticker:(nullable MessageSticker *)messageSticker101quotedMessage:(nullable TSQuotedMessage *)quotedMessage102storedShouldStartExpireTimer:(BOOL)storedShouldStartExpireTimer103storyAuthorUuidString:(nullable NSString *)storyAuthorUuidString104storyReactionEmoji:(nullable NSString *)storyReactionEmoji105storyTimestamp:(nullable NSNumber *)storyTimestamp106wasRemotelyDeleted:(BOOL)wasRemotelyDeleted107authorPhoneNumber:(nullable NSString *)authorPhoneNumber108authorUUID:(nullable NSString *)authorUUID109deprecated_sourceDeviceId:(nullable NSNumber *)deprecated_sourceDeviceId110read:(BOOL)read111serverDeliveryTimestamp:(uint64_t)serverDeliveryTimestamp112serverGuid:(nullable NSString *)serverGuid113serverTimestamp:(nullable NSNumber *)serverTimestamp114viewed:(BOOL)viewed115wasReceivedByUD:(BOOL)wasReceivedByUD116NS_DESIGNATED_INITIALIZER NS_SWIFT_NAME(init(grdbId:uniqueId:receivedAtTimestamp:sortId:timestamp:uniqueThreadId:body:bodyRanges:contactShare:deprecated_attachmentIds:editState:expireStartedAt:expireTimerVersion:expiresAt:expiresInSeconds:giftBadge:isGroupStoryReply:isPoll:isSmsMessageRestoredFromBackup:isViewOnceComplete:isViewOnceMessage:linkPreview:messageSticker:quotedMessage:storedShouldStartExpireTimer:storyAuthorUuidString:storyReactionEmoji:storyTimestamp:wasRemotelyDeleted:authorPhoneNumber:authorUUID:deprecated_sourceDeviceId:read:serverDeliveryTimestamp:serverGuid:serverTimestamp:viewed:wasReceivedByUD:));117118// clang-format on119120// --- CODE GENERATION MARKER121122/// This field should always be ignored. In the beginning, we did not123/// store this value and so all rows would be 0. Then we started124/// storing it, but we never should have. Then we stopped.125/// In other words, DONT USE IT.126/// Kept only so sds codegen outputs code with backwards compatibility with our sql127/// table without needing to migrate or reindex TSInteraction.128@property (nonatomic, readonly, nullable) NSNumber *deprecated_sourceDeviceId;129130@property (nonatomic, readonly) SignalServiceAddress *authorAddress;131@property (nonatomic, readonly, nullable) NSString *authorPhoneNumber;132@property (nonatomic, readonly, nullable) NSString *authorUUID;133134@property (nonatomic, readonly, getter=wasViewed) BOOL viewed;135136- (void)markAsViewedAtTimestamp:(uint64_t)viewedTimestamp137thread:(TSThread *)thread138circumstance:(OWSReceiptCircumstance)circumstance139transaction:(DBWriteTransaction *)transaction;140141@end142143NS_ASSUME_NONNULL_END144145146