mirror of
https://github.com/oxen-io/session-ios.git
synced 2023-12-13 21:30:14 +01:00
76 lines
3.2 KiB
Objective-C
76 lines
3.2 KiB
Objective-C
//
|
|
// Copyright (c) 2019 Open Whisper Systems. All rights reserved.
|
|
//
|
|
|
|
#import <SignalUtilitiesKit/OWSReadTracking.h>
|
|
#import <SignalUtilitiesKit/TSMessage.h>
|
|
|
|
NS_ASSUME_NONNULL_BEGIN
|
|
|
|
@class SSKProtoEnvelope;
|
|
|
|
typedef NS_ENUM(int32_t, TSErrorMessageType) {
|
|
TSErrorMessageNoSession,
|
|
// DEPRECATED: We no longer create TSErrorMessageWrongTrustedIdentityKey, but
|
|
// persisted legacy messages could exist indefinitly.
|
|
TSErrorMessageWrongTrustedIdentityKey,
|
|
TSErrorMessageInvalidKeyException,
|
|
// unused
|
|
TSErrorMessageMissingKeyId,
|
|
TSErrorMessageInvalidMessage,
|
|
// unused
|
|
TSErrorMessageDuplicateMessage,
|
|
TSErrorMessageInvalidVersion,
|
|
TSErrorMessageNonBlockingIdentityChange,
|
|
TSErrorMessageUnknownContactBlockOffer,
|
|
TSErrorMessageGroupCreationFailed,
|
|
};
|
|
|
|
@interface TSErrorMessage : TSMessage <OWSReadTracking>
|
|
|
|
- (instancetype)initMessageWithTimestamp:(uint64_t)timestamp
|
|
inThread:(nullable TSThread *)thread
|
|
messageBody:(nullable NSString *)body
|
|
attachmentIds:(NSArray<NSString *> *)attachmentIds
|
|
expiresInSeconds:(uint32_t)expiresInSeconds
|
|
expireStartedAt:(uint64_t)expireStartedAt
|
|
quotedMessage:(nullable TSQuotedMessage *)quotedMessage
|
|
contactShare:(nullable OWSContact *)contact
|
|
linkPreview:(nullable OWSLinkPreview *)linkPreview NS_UNAVAILABLE;
|
|
|
|
- (instancetype)initWithTimestamp:(uint64_t)timestamp
|
|
inThread:(nullable TSThread *)thread
|
|
messageBody:(nullable NSString *)body
|
|
attachmentIds:(NSArray<NSString *> *)attachmentIds
|
|
expiresInSeconds:(uint32_t)expiresInSeconds
|
|
expireStartedAt:(uint64_t)expireStartedAt NS_UNAVAILABLE;
|
|
|
|
- (nullable instancetype)initWithCoder:(NSCoder *)coder NS_DESIGNATED_INITIALIZER;
|
|
|
|
- (instancetype)initWithTimestamp:(uint64_t)timestamp
|
|
inThread:(nullable TSThread *)thread
|
|
failedMessageType:(TSErrorMessageType)errorMessageType
|
|
recipientId:(nullable NSString *)recipientId NS_DESIGNATED_INITIALIZER;
|
|
|
|
+ (instancetype)corruptedMessageWithEnvelope:(SSKProtoEnvelope *)envelope
|
|
withTransaction:(YapDatabaseReadWriteTransaction *)transaction;
|
|
|
|
+ (instancetype)corruptedMessageInUnknownThread;
|
|
|
|
+ (instancetype)invalidVersionWithEnvelope:(SSKProtoEnvelope *)envelope
|
|
withTransaction:(YapDatabaseReadWriteTransaction *)transaction;
|
|
|
|
+ (instancetype)invalidKeyExceptionWithEnvelope:(SSKProtoEnvelope *)envelope
|
|
withTransaction:(YapDatabaseReadWriteTransaction *)transaction;
|
|
|
|
+ (instancetype)missingSessionWithEnvelope:(SSKProtoEnvelope *)envelope
|
|
withTransaction:(YapDatabaseReadWriteTransaction *)transaction;
|
|
|
|
+ (instancetype)nonblockingIdentityChangeInThread:(TSThread *)thread recipientId:(NSString *)recipientId;
|
|
|
|
@property (nonatomic, readonly) TSErrorMessageType errorType;
|
|
@property (nullable, nonatomic, readonly) NSString *recipientId;
|
|
|
|
@end
|
|
|
|
NS_ASSUME_NONNULL_END
|