Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
signalapp
GitHub Repository: signalapp/Signal-iOS
Path: blob/main/SignalServiceKit/Messages/Interactions/TSIncomingMessage.h
1 views
1
//
2
// Copyright 2017 Signal Messenger, LLC
3
// SPDX-License-Identifier: AGPL-3.0-only
4
//
5
6
#import <SignalServiceKit/OWSReadTracking.h>
7
#import <SignalServiceKit/TSMessage.h>
8
9
NS_ASSUME_NONNULL_BEGIN
10
11
@class DBWriteTransaction;
12
@class SignalServiceAddress;
13
@class TSContactThread;
14
@class TSGroupThread;
15
@class TSIncomingMessageBuilder;
16
17
@interface TSIncomingMessage : TSMessage <OWSReadTracking>
18
19
/// Derived from the value of the `X-Signal-Timestamp` header when receiving a
20
/// message from the server, this represents the server-timestamp at which we
21
/// popped the message off the queue.
22
@property (nonatomic, readonly) uint64_t serverDeliveryTimestamp;
23
24
/// Derived from the `serverTimestamp` field on an incoming message `Envelope`,
25
/// this represents the server-timestamp at which the sender uploaded the
26
/// message to the server.
27
@property (nonatomic, readonly, nullable) NSNumber *serverTimestamp;
28
29
/// Derived from the server-populated `serverGuid` field on an incoming message
30
/// `Envelope`, this represents a server-generated UUID for this message.
31
@property (nonatomic, readonly, nullable) NSString *serverGuid;
32
33
@property (nonatomic, readonly) BOOL wasReceivedByUD;
34
35
- (instancetype)initMessageWithBuilder:(TSMessageBuilder *)messageBuilder NS_UNAVAILABLE;
36
37
- (instancetype)initWithGrdbId:(int64_t)grdbId
38
uniqueId:(NSString *)uniqueId
39
receivedAtTimestamp:(uint64_t)receivedAtTimestamp
40
sortId:(uint64_t)sortId
41
timestamp:(uint64_t)timestamp
42
uniqueThreadId:(NSString *)uniqueThreadId
43
body:(nullable NSString *)body
44
bodyRanges:(nullable MessageBodyRanges *)bodyRanges
45
contactShare:(nullable OWSContact *)contactShare
46
deprecated_attachmentIds:(nullable NSArray<NSString *> *)deprecated_attachmentIds
47
editState:(TSEditState)editState
48
expireStartedAt:(uint64_t)expireStartedAt
49
expireTimerVersion:(nullable NSNumber *)expireTimerVersion
50
expiresAt:(uint64_t)expiresAt
51
expiresInSeconds:(unsigned int)expiresInSeconds
52
giftBadge:(nullable OWSGiftBadge *)giftBadge
53
isGroupStoryReply:(BOOL)isGroupStoryReply
54
isPoll:(BOOL)isPoll
55
isSmsMessageRestoredFromBackup:(BOOL)isSmsMessageRestoredFromBackup
56
isViewOnceComplete:(BOOL)isViewOnceComplete
57
isViewOnceMessage:(BOOL)isViewOnceMessage
58
linkPreview:(nullable OWSLinkPreview *)linkPreview
59
messageSticker:(nullable MessageSticker *)messageSticker
60
quotedMessage:(nullable TSQuotedMessage *)quotedMessage
61
storedShouldStartExpireTimer:(BOOL)storedShouldStartExpireTimer
62
storyAuthorUuidString:(nullable NSString *)storyAuthorUuidString
63
storyReactionEmoji:(nullable NSString *)storyReactionEmoji
64
storyTimestamp:(nullable NSNumber *)storyTimestamp
65
wasRemotelyDeleted:(BOOL)wasRemotelyDeleted NS_UNAVAILABLE;
66
67
- (nullable instancetype)initWithCoder:(NSCoder *)coder NS_UNAVAILABLE;
68
69
- (instancetype)initIncomingMessageWithBuilder:(TSIncomingMessageBuilder *)incomingMessageBuilder
70
NS_DESIGNATED_INITIALIZER NS_SWIFT_NAME(init(incomingMessageWithBuilder:));
71
72
// --- CODE GENERATION MARKER
73
74
// This snippet is generated by /Scripts/sds_codegen/sds_generate.py. Do not manually edit it, instead run
75
// `sds_codegen.sh`.
76
77
// clang-format off
78
79
- (instancetype)initWithGrdbId:(int64_t)grdbId
80
uniqueId:(NSString *)uniqueId
81
receivedAtTimestamp:(uint64_t)receivedAtTimestamp
82
sortId:(uint64_t)sortId
83
timestamp:(uint64_t)timestamp
84
uniqueThreadId:(NSString *)uniqueThreadId
85
body:(nullable NSString *)body
86
bodyRanges:(nullable MessageBodyRanges *)bodyRanges
87
contactShare:(nullable OWSContact *)contactShare
88
deprecated_attachmentIds:(nullable NSArray<NSString *> *)deprecated_attachmentIds
89
editState:(TSEditState)editState
90
expireStartedAt:(uint64_t)expireStartedAt
91
expireTimerVersion:(nullable NSNumber *)expireTimerVersion
92
expiresAt:(uint64_t)expiresAt
93
expiresInSeconds:(unsigned int)expiresInSeconds
94
giftBadge:(nullable OWSGiftBadge *)giftBadge
95
isGroupStoryReply:(BOOL)isGroupStoryReply
96
isPoll:(BOOL)isPoll
97
isSmsMessageRestoredFromBackup:(BOOL)isSmsMessageRestoredFromBackup
98
isViewOnceComplete:(BOOL)isViewOnceComplete
99
isViewOnceMessage:(BOOL)isViewOnceMessage
100
linkPreview:(nullable OWSLinkPreview *)linkPreview
101
messageSticker:(nullable MessageSticker *)messageSticker
102
quotedMessage:(nullable TSQuotedMessage *)quotedMessage
103
storedShouldStartExpireTimer:(BOOL)storedShouldStartExpireTimer
104
storyAuthorUuidString:(nullable NSString *)storyAuthorUuidString
105
storyReactionEmoji:(nullable NSString *)storyReactionEmoji
106
storyTimestamp:(nullable NSNumber *)storyTimestamp
107
wasRemotelyDeleted:(BOOL)wasRemotelyDeleted
108
authorPhoneNumber:(nullable NSString *)authorPhoneNumber
109
authorUUID:(nullable NSString *)authorUUID
110
deprecated_sourceDeviceId:(nullable NSNumber *)deprecated_sourceDeviceId
111
read:(BOOL)read
112
serverDeliveryTimestamp:(uint64_t)serverDeliveryTimestamp
113
serverGuid:(nullable NSString *)serverGuid
114
serverTimestamp:(nullable NSNumber *)serverTimestamp
115
viewed:(BOOL)viewed
116
wasReceivedByUD:(BOOL)wasReceivedByUD
117
NS_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:));
118
119
// clang-format on
120
121
// --- CODE GENERATION MARKER
122
123
/// This field should always be ignored. In the beginning, we did not
124
/// store this value and so all rows would be 0. Then we started
125
/// storing it, but we never should have. Then we stopped.
126
/// In other words, DONT USE IT.
127
/// Kept only so sds codegen outputs code with backwards compatibility with our sql
128
/// table without needing to migrate or reindex TSInteraction.
129
@property (nonatomic, readonly, nullable) NSNumber *deprecated_sourceDeviceId;
130
131
@property (nonatomic, readonly) SignalServiceAddress *authorAddress;
132
@property (nonatomic, readonly, nullable) NSString *authorPhoneNumber;
133
@property (nonatomic, readonly, nullable) NSString *authorUUID;
134
135
@property (nonatomic, readonly, getter=wasViewed) BOOL viewed;
136
137
- (void)markAsViewedAtTimestamp:(uint64_t)viewedTimestamp
138
thread:(TSThread *)thread
139
circumstance:(OWSReceiptCircumstance)circumstance
140
transaction:(DBWriteTransaction *)transaction;
141
142
@end
143
144
NS_ASSUME_NONNULL_END
145
146