Path: blob/main/SignalServiceKit/Messages/Interactions/Quotes/TSQuotedMessage.h
1 views
//1// Copyright 2018 Signal Messenger, LLC2// SPDX-License-Identifier: AGPL-3.0-only3//45@import Foundation;67NS_ASSUME_NONNULL_BEGIN89@class DBReadTransaction;10@class DBWriteTransaction;11@class DisplayableQuotedThumbnailAttachment;12@class MessageBodyRanges;13@class OWSAttachmentInfo;14@class QuotedThumbnailAttachmentMetadata;15@class SSKProtoDataMessage;16@class SignalServiceAddress;17@class TSMessage;18@class TSQuotedMessage;19@class TSThread;2021@protocol QuotedMessageAttachmentHelper;2223/// Note that ContentSource is NOT the same as OWSAttachmentInfoReference;24/// this tells us where we got the quote from (whether it has an attachment or not)25/// and doesn't ever change, including after downloading any attachments.26typedef NS_ENUM(NSUInteger, TSQuotedMessageContentSource) {27TSQuotedMessageContentSourceUnknown,28TSQuotedMessageContentSourceLocal,29TSQuotedMessageContentSourceRemote,30TSQuotedMessageContentSourceStory31};323334@interface TSQuotedMessage : NSObject <NSSecureCoding, NSCopying>3536@property (nullable, nonatomic, readonly) NSNumber *timestampValue;37@property (nonatomic, readonly) SignalServiceAddress *authorAddress;38@property (nonatomic, readonly) TSQuotedMessageContentSource bodySource;3940// This property should be set IFF we are quoting a text message41// or attachment with caption.42@property (nullable, nonatomic, readonly) NSString *body;43@property (nonatomic, readonly, nullable) MessageBodyRanges *bodyRanges;4445@property (nonatomic, readonly) BOOL isGiftBadge;46/// If we found the target message at receive time (TSQuotedMessageContentSourceLocal),47/// true if that target message was view once.48/// If we did not find the target message (TSQuotedMessageContentSourceRemote), will always49/// be false because we do not know if the target message was view-once. In these cases, we50/// take the body off the Quote proto we receive.51/// At send time, we always set the body of the outgoing Quote proto as the localized string52/// that indicates this was a reply to a view-once message.53@property (nonatomic, readonly) BOOL isTargetMessageViewOnce;5455@property (nonatomic, readonly) BOOL isPoll;5657#pragma mark - Attachments5859- (nullable OWSAttachmentInfo *)attachmentInfo;6061+ (instancetype)new NS_UNAVAILABLE;62- (instancetype)init NS_UNAVAILABLE;6364// used when sending quoted messages65- (instancetype)initWithTimestamp:(nullable NSNumber *)timestamp66authorAddress:(SignalServiceAddress *)authorAddress67body:(nullable NSString *)body68bodyRanges:(nullable MessageBodyRanges *)bodyRanges69quotedAttachmentForSending:(nullable OWSAttachmentInfo *)attachmentInfo70isGiftBadge:(BOOL)isGiftBadge71isTargetMessageViewOnce:(BOOL)isTargetMessageViewOnce72isPoll:(BOOL)isPoll;7374// used when receiving quoted messages. Do not call directly outside AttachmentManager.75- (instancetype)initWithTimestamp:(uint64_t)timestamp76authorAddress:(SignalServiceAddress *)authorAddress77body:(nullable NSString *)body78bodyRanges:(nullable MessageBodyRanges *)bodyRanges79bodySource:(TSQuotedMessageContentSource)bodySource80receivedQuotedAttachmentInfo:(nullable OWSAttachmentInfo *)attachmentInfo81isGiftBadge:(BOOL)isGiftBadge82isTargetMessageViewOnce:(BOOL)isTargetMessageViewOnce83isPoll:(BOOL)isPoll;8485// used when restoring quoted messages from backups86+ (instancetype)quotedMessageFromBackupWithTargetMessageTimestamp:(nullable NSNumber *)timestamp87authorAddress:(SignalServiceAddress *)authorAddress88body:(nullable NSString *)body89bodyRanges:(nullable MessageBodyRanges *)bodyRanges90bodySource:(TSQuotedMessageContentSource)bodySource91quotedAttachmentInfo:(nullable OWSAttachmentInfo *)attachmentInfo92isGiftBadge:(BOOL)isGiftBadge93isTargetMessageViewOnce:(BOOL)isTargetMessageViewOnce94isPoll:(BOOL)isPoll;9596@end9798#pragma mark -99100NS_ASSUME_NONNULL_END101102103