Rework outgoing message state.

// FREEBIE
This commit is contained in:
Matthew Chen 2017-04-12 17:30:02 -04:00
parent 1404d0d7eb
commit 1023eeb8a0
3 changed files with 23 additions and 21 deletions

View File

@ -12,14 +12,6 @@ NS_ASSUME_NONNULL_BEGIN
@class TSAttachmentPointer;
typedef NS_ENUM(NSInteger, TSGroupMetaMessage) {
TSGroupMessageNone,
TSGroupMessageNew,
TSGroupMessageUpdate,
TSGroupMessageDeliver,
TSGroupMessageQuit
};
@interface TSMessage : TSInteraction
@property (nonatomic, readonly) NSMutableArray<NSString *> *attachmentIds;

View File

@ -6,11 +6,6 @@
NS_ASSUME_NONNULL_BEGIN
@class OWSSignalServiceProtosAttachmentPointer;
@class OWSSignalServiceProtosDataMessageBuilder;
@interface TSOutgoingMessage : TSMessage
typedef NS_ENUM(NSInteger, TSOutgoingMessageState) {
// The message is either:
// a) Enqueued for sending.
@ -26,8 +21,18 @@ typedef NS_ENUM(NSInteger, TSOutgoingMessageState) {
TSOutgoingMessageStateSentToService,
};
- (instancetype)initWithTimestamp:(uint64_t)timestamp;
- (instancetype)initWithTimestamp:(uint64_t)timestamp inThread:(nullable TSThread *)thread;
typedef NS_ENUM(NSInteger, TSGroupMetaMessage) {
TSGroupMessageNone,
TSGroupMessageNew,
TSGroupMessageUpdate,
TSGroupMessageDeliver,
TSGroupMessageQuit
};
@class OWSSignalServiceProtosAttachmentPointer;
@class OWSSignalServiceProtosDataMessageBuilder;
@interface TSOutgoingMessage : TSMessage
- (instancetype)initWithTimestamp:(uint64_t)timestamp
inThread:(nullable TSThread *)thread
@ -37,11 +42,6 @@ typedef NS_ENUM(NSInteger, TSOutgoingMessageState) {
inThread:(nullable TSThread *)thread
groupMetaMessage:(TSGroupMetaMessage)groupMetaMessage;
- (instancetype)initWithTimestamp:(uint64_t)timestamp
inThread:(nullable TSThread *)thread
messageBody:(nullable NSString *)body
attachmentIds:(NSMutableArray<NSString *> *)attachmentIds;
- (instancetype)initWithTimestamp:(uint64_t)timestamp
inThread:(nullable TSThread *)thread
messageBody:(nullable NSString *)body

View File

@ -65,11 +65,15 @@ NSString *const kTSOutgoingMessageSentRecipientAll = @"kTSOutgoingMessageSentRec
- (instancetype)initWithTimestamp:(uint64_t)timestamp
{
OWSAssert(0);
return [self initWithTimestamp:timestamp inThread:nil];
}
- (instancetype)initWithTimestamp:(uint64_t)timestamp inThread:(nullable TSThread *)thread
{
OWSAssert(0);
return [self initWithTimestamp:timestamp inThread:thread messageBody:nil];
}
@ -77,7 +81,11 @@ NSString *const kTSOutgoingMessageSentRecipientAll = @"kTSOutgoingMessageSentRec
inThread:(nullable TSThread *)thread
messageBody:(nullable NSString *)body
{
return [self initWithTimestamp:timestamp inThread:thread messageBody:body attachmentIds:[NSMutableArray new]];
return [self initWithTimestamp:timestamp
inThread:thread
messageBody:body
attachmentIds:[NSMutableArray new]
expiresInSeconds:0];
}
- (instancetype)initWithTimestamp:(uint64_t)timestamp
@ -85,6 +93,8 @@ NSString *const kTSOutgoingMessageSentRecipientAll = @"kTSOutgoingMessageSentRec
messageBody:(nullable NSString *)body
attachmentIds:(NSMutableArray<NSString *> *)attachmentIds
{
OWSAssert(0);
return [self initWithTimestamp:timestamp
inThread:thread
messageBody:body