Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
signalapp
GitHub Repository: signalapp/Signal-iOS
Path: blob/main/SignalServiceKit/Messages/Interactions/OWSVerificationStateChangeMessage.m
1 views
1
//
2
// Copyright 2018 Signal Messenger, LLC
3
// SPDX-License-Identifier: AGPL-3.0-only
4
//
5
6
#import "OWSVerificationStateChangeMessage.h"
7
#import <SignalServiceKit/SignalServiceKit-Swift.h>
8
9
NS_ASSUME_NONNULL_BEGIN
10
11
@implementation OWSVerificationStateChangeMessage
12
13
- (instancetype)initWithThread:(TSThread *)thread
14
timestamp:(uint64_t)timestamp
15
recipientAddress:(SignalServiceAddress *)recipientAddress
16
verificationState:(OWSVerificationState)verificationState
17
isLocalChange:(BOOL)isLocalChange
18
{
19
OWSAssertDebug(recipientAddress.isValid);
20
21
self = [super initWithThread:thread
22
timestamp:timestamp
23
serverGuid:nil
24
messageType:TSInfoMessageVerificationStateChange
25
expireTimerVersion:nil
26
expiresInSeconds:0
27
infoMessageUserInfo:nil];
28
if (!self) {
29
return self;
30
}
31
32
_recipientAddress = recipientAddress;
33
_verificationState = verificationState;
34
_isLocalChange = isLocalChange;
35
36
return self;
37
}
38
39
- (NSUInteger)hash
40
{
41
NSUInteger result = [super hash];
42
result ^= self.isLocalChange;
43
result ^= self.recipientAddress.hash;
44
result ^= self.verificationState;
45
return result;
46
}
47
48
- (BOOL)isEqual:(id)other
49
{
50
if (![super isEqual:other]) {
51
return NO;
52
}
53
OWSVerificationStateChangeMessage *typedOther = (OWSVerificationStateChangeMessage *)other;
54
if (self.isLocalChange != typedOther.isLocalChange) {
55
return NO;
56
}
57
if (![NSObject isObject:self.recipientAddress equalToObject:typedOther.recipientAddress]) {
58
return NO;
59
}
60
if (self.verificationState != typedOther.verificationState) {
61
return NO;
62
}
63
return YES;
64
}
65
66
- (bool)isVerified
67
{
68
return _verificationState == OWSVerificationStateVerified;
69
}
70
71
// --- CODE GENERATION MARKER
72
73
// This snippet is generated by /Scripts/sds_codegen/sds_generate.py. Do not manually edit it, instead run
74
// `sds_codegen.sh`.
75
76
// clang-format off
77
78
- (instancetype)initWithGrdbId:(int64_t)grdbId
79
uniqueId:(NSString *)uniqueId
80
receivedAtTimestamp:(uint64_t)receivedAtTimestamp
81
sortId:(uint64_t)sortId
82
timestamp:(uint64_t)timestamp
83
uniqueThreadId:(NSString *)uniqueThreadId
84
body:(nullable NSString *)body
85
bodyRanges:(nullable MessageBodyRanges *)bodyRanges
86
contactShare:(nullable OWSContact *)contactShare
87
deprecated_attachmentIds:(nullable NSArray<NSString *> *)deprecated_attachmentIds
88
editState:(TSEditState)editState
89
expireStartedAt:(uint64_t)expireStartedAt
90
expireTimerVersion:(nullable NSNumber *)expireTimerVersion
91
expiresAt:(uint64_t)expiresAt
92
expiresInSeconds:(unsigned int)expiresInSeconds
93
giftBadge:(nullable OWSGiftBadge *)giftBadge
94
isGroupStoryReply:(BOOL)isGroupStoryReply
95
isPoll:(BOOL)isPoll
96
isSmsMessageRestoredFromBackup:(BOOL)isSmsMessageRestoredFromBackup
97
isViewOnceComplete:(BOOL)isViewOnceComplete
98
isViewOnceMessage:(BOOL)isViewOnceMessage
99
linkPreview:(nullable OWSLinkPreview *)linkPreview
100
messageSticker:(nullable MessageSticker *)messageSticker
101
quotedMessage:(nullable TSQuotedMessage *)quotedMessage
102
storedShouldStartExpireTimer:(BOOL)storedShouldStartExpireTimer
103
storyAuthorUuidString:(nullable NSString *)storyAuthorUuidString
104
storyReactionEmoji:(nullable NSString *)storyReactionEmoji
105
storyTimestamp:(nullable NSNumber *)storyTimestamp
106
wasRemotelyDeleted:(BOOL)wasRemotelyDeleted
107
customMessage:(nullable NSString *)customMessage
108
infoMessageUserInfo:(nullable NSDictionary<InfoMessageUserInfoKey, id> *)infoMessageUserInfo
109
messageType:(TSInfoMessageType)messageType
110
read:(BOOL)read
111
serverGuid:(nullable NSString *)serverGuid
112
unregisteredAddress:(nullable SignalServiceAddress *)unregisteredAddress
113
isLocalChange:(BOOL)isLocalChange
114
recipientAddress:(SignalServiceAddress *)recipientAddress
115
verificationState:(OWSVerificationState)verificationState
116
{
117
self = [super initWithGrdbId:grdbId
118
uniqueId:uniqueId
119
receivedAtTimestamp:receivedAtTimestamp
120
sortId:sortId
121
timestamp:timestamp
122
uniqueThreadId:uniqueThreadId
123
body:body
124
bodyRanges:bodyRanges
125
contactShare:contactShare
126
deprecated_attachmentIds:deprecated_attachmentIds
127
editState:editState
128
expireStartedAt:expireStartedAt
129
expireTimerVersion:expireTimerVersion
130
expiresAt:expiresAt
131
expiresInSeconds:expiresInSeconds
132
giftBadge:giftBadge
133
isGroupStoryReply:isGroupStoryReply
134
isPoll:isPoll
135
isSmsMessageRestoredFromBackup:isSmsMessageRestoredFromBackup
136
isViewOnceComplete:isViewOnceComplete
137
isViewOnceMessage:isViewOnceMessage
138
linkPreview:linkPreview
139
messageSticker:messageSticker
140
quotedMessage:quotedMessage
141
storedShouldStartExpireTimer:storedShouldStartExpireTimer
142
storyAuthorUuidString:storyAuthorUuidString
143
storyReactionEmoji:storyReactionEmoji
144
storyTimestamp:storyTimestamp
145
wasRemotelyDeleted:wasRemotelyDeleted
146
customMessage:customMessage
147
infoMessageUserInfo:infoMessageUserInfo
148
messageType:messageType
149
read:read
150
serverGuid:serverGuid
151
unregisteredAddress:unregisteredAddress];
152
153
if (!self) {
154
return self;
155
}
156
157
_isLocalChange = isLocalChange;
158
_recipientAddress = recipientAddress;
159
_verificationState = verificationState;
160
161
return self;
162
}
163
164
// clang-format on
165
166
// --- CODE GENERATION MARKER
167
168
@end
169
170
NS_ASSUME_NONNULL_END
171
172