Path: blob/main/SignalServiceKit/Messages/Interactions/OWSVerificationStateChangeMessage.m
1 views
//1// Copyright 2018 Signal Messenger, LLC2// SPDX-License-Identifier: AGPL-3.0-only3//45#import "OWSVerificationStateChangeMessage.h"6#import <SignalServiceKit/SignalServiceKit-Swift.h>78NS_ASSUME_NONNULL_BEGIN910@implementation OWSVerificationStateChangeMessage1112- (instancetype)initWithThread:(TSThread *)thread13timestamp:(uint64_t)timestamp14recipientAddress:(SignalServiceAddress *)recipientAddress15verificationState:(OWSVerificationState)verificationState16isLocalChange:(BOOL)isLocalChange17{18OWSAssertDebug(recipientAddress.isValid);1920self = [super initWithThread:thread21timestamp:timestamp22serverGuid:nil23messageType:TSInfoMessageVerificationStateChange24expireTimerVersion:nil25expiresInSeconds:026infoMessageUserInfo:nil];27if (!self) {28return self;29}3031_recipientAddress = recipientAddress;32_verificationState = verificationState;33_isLocalChange = isLocalChange;3435return self;36}3738- (NSUInteger)hash39{40NSUInteger result = [super hash];41result ^= self.isLocalChange;42result ^= self.recipientAddress.hash;43result ^= self.verificationState;44return result;45}4647- (BOOL)isEqual:(id)other48{49if (![super isEqual:other]) {50return NO;51}52OWSVerificationStateChangeMessage *typedOther = (OWSVerificationStateChangeMessage *)other;53if (self.isLocalChange != typedOther.isLocalChange) {54return NO;55}56if (![NSObject isObject:self.recipientAddress equalToObject:typedOther.recipientAddress]) {57return NO;58}59if (self.verificationState != typedOther.verificationState) {60return NO;61}62return YES;63}6465- (bool)isVerified66{67return _verificationState == OWSVerificationStateVerified;68}6970// --- CODE GENERATION MARKER7172// This snippet is generated by /Scripts/sds_codegen/sds_generate.py. Do not manually edit it, instead run73// `sds_codegen.sh`.7475// clang-format off7677- (instancetype)initWithGrdbId:(int64_t)grdbId78uniqueId:(NSString *)uniqueId79receivedAtTimestamp:(uint64_t)receivedAtTimestamp80sortId:(uint64_t)sortId81timestamp:(uint64_t)timestamp82uniqueThreadId:(NSString *)uniqueThreadId83body:(nullable NSString *)body84bodyRanges:(nullable MessageBodyRanges *)bodyRanges85contactShare:(nullable OWSContact *)contactShare86deprecated_attachmentIds:(nullable NSArray<NSString *> *)deprecated_attachmentIds87editState:(TSEditState)editState88expireStartedAt:(uint64_t)expireStartedAt89expireTimerVersion:(nullable NSNumber *)expireTimerVersion90expiresAt:(uint64_t)expiresAt91expiresInSeconds:(unsigned int)expiresInSeconds92giftBadge:(nullable OWSGiftBadge *)giftBadge93isGroupStoryReply:(BOOL)isGroupStoryReply94isPoll:(BOOL)isPoll95isSmsMessageRestoredFromBackup:(BOOL)isSmsMessageRestoredFromBackup96isViewOnceComplete:(BOOL)isViewOnceComplete97isViewOnceMessage:(BOOL)isViewOnceMessage98linkPreview:(nullable OWSLinkPreview *)linkPreview99messageSticker:(nullable MessageSticker *)messageSticker100quotedMessage:(nullable TSQuotedMessage *)quotedMessage101storedShouldStartExpireTimer:(BOOL)storedShouldStartExpireTimer102storyAuthorUuidString:(nullable NSString *)storyAuthorUuidString103storyReactionEmoji:(nullable NSString *)storyReactionEmoji104storyTimestamp:(nullable NSNumber *)storyTimestamp105wasRemotelyDeleted:(BOOL)wasRemotelyDeleted106customMessage:(nullable NSString *)customMessage107infoMessageUserInfo:(nullable NSDictionary<InfoMessageUserInfoKey, id> *)infoMessageUserInfo108messageType:(TSInfoMessageType)messageType109read:(BOOL)read110serverGuid:(nullable NSString *)serverGuid111unregisteredAddress:(nullable SignalServiceAddress *)unregisteredAddress112isLocalChange:(BOOL)isLocalChange113recipientAddress:(SignalServiceAddress *)recipientAddress114verificationState:(OWSVerificationState)verificationState115{116self = [super initWithGrdbId:grdbId117uniqueId:uniqueId118receivedAtTimestamp:receivedAtTimestamp119sortId:sortId120timestamp:timestamp121uniqueThreadId:uniqueThreadId122body:body123bodyRanges:bodyRanges124contactShare:contactShare125deprecated_attachmentIds:deprecated_attachmentIds126editState:editState127expireStartedAt:expireStartedAt128expireTimerVersion:expireTimerVersion129expiresAt:expiresAt130expiresInSeconds:expiresInSeconds131giftBadge:giftBadge132isGroupStoryReply:isGroupStoryReply133isPoll:isPoll134isSmsMessageRestoredFromBackup:isSmsMessageRestoredFromBackup135isViewOnceComplete:isViewOnceComplete136isViewOnceMessage:isViewOnceMessage137linkPreview:linkPreview138messageSticker:messageSticker139quotedMessage:quotedMessage140storedShouldStartExpireTimer:storedShouldStartExpireTimer141storyAuthorUuidString:storyAuthorUuidString142storyReactionEmoji:storyReactionEmoji143storyTimestamp:storyTimestamp144wasRemotelyDeleted:wasRemotelyDeleted145customMessage:customMessage146infoMessageUserInfo:infoMessageUserInfo147messageType:messageType148read:read149serverGuid:serverGuid150unregisteredAddress:unregisteredAddress];151152if (!self) {153return self;154}155156_isLocalChange = isLocalChange;157_recipientAddress = recipientAddress;158_verificationState = verificationState;159160return self;161}162163// clang-format on164165// --- CODE GENERATION MARKER166167@end168169NS_ASSUME_NONNULL_END170171172