2017-02-15 23:09:55 +01:00
|
|
|
//
|
|
|
|
// Copyright (c) 2017 Open Whisper Systems. All rights reserved.
|
|
|
|
//
|
2015-12-07 03:31:43 +01:00
|
|
|
|
|
|
|
#import "TSInteraction.h"
|
|
|
|
|
2016-08-29 00:48:35 +02:00
|
|
|
NS_ASSUME_NONNULL_BEGIN
|
|
|
|
|
2015-12-07 03:31:43 +01:00
|
|
|
/**
|
2016-07-28 01:58:49 +02:00
|
|
|
* Abstract message class.
|
2015-12-07 03:31:43 +01:00
|
|
|
*/
|
|
|
|
|
2016-10-14 23:00:29 +02:00
|
|
|
@class TSAttachmentPointer;
|
|
|
|
|
2015-12-07 03:31:43 +01:00
|
|
|
@interface TSMessage : TSInteraction
|
|
|
|
|
2016-07-29 21:33:25 +02:00
|
|
|
@property (nonatomic, readonly) NSMutableArray<NSString *> *attachmentIds;
|
2016-08-29 00:48:35 +02:00
|
|
|
@property (nullable, nonatomic) NSString *body;
|
2016-10-05 17:42:44 +02:00
|
|
|
@property (nonatomic) uint32_t expiresInSeconds;
|
|
|
|
@property (nonatomic) uint64_t expireStartedAt;
|
|
|
|
@property (nonatomic, readonly) uint64_t expiresAt;
|
|
|
|
@property (nonatomic, readonly) BOOL isExpiringMessage;
|
2015-12-07 03:31:43 +01:00
|
|
|
|
2016-08-29 00:48:35 +02:00
|
|
|
- (instancetype)initWithTimestamp:(uint64_t)timestamp;
|
|
|
|
|
|
|
|
- (instancetype)initWithTimestamp:(uint64_t)timestamp inThread:(nullable TSThread *)thread;
|
|
|
|
|
2015-12-07 03:31:43 +01:00
|
|
|
- (instancetype)initWithTimestamp:(uint64_t)timestamp
|
2016-08-29 00:48:35 +02:00
|
|
|
inThread:(nullable TSThread *)thread
|
|
|
|
messageBody:(nullable NSString *)body;
|
|
|
|
|
|
|
|
- (instancetype)initWithTimestamp:(uint64_t)timestamp
|
|
|
|
inThread:(nullable TSThread *)thread
|
|
|
|
messageBody:(nullable NSString *)body
|
2016-07-29 21:33:25 +02:00
|
|
|
attachmentIds:(NSArray<NSString *> *)attachmentIds;
|
2015-12-07 03:31:43 +01:00
|
|
|
|
2016-10-05 17:42:44 +02:00
|
|
|
- (instancetype)initWithTimestamp:(uint64_t)timestamp
|
|
|
|
inThread:(nullable TSThread *)thread
|
|
|
|
messageBody:(nullable NSString *)body
|
|
|
|
attachmentIds:(NSArray<NSString *> *)attachmentIds
|
|
|
|
expiresInSeconds:(uint32_t)expiresInSeconds;
|
|
|
|
|
|
|
|
- (instancetype)initWithTimestamp:(uint64_t)timestamp
|
|
|
|
inThread:(nullable TSThread *)thread
|
|
|
|
messageBody:(nullable NSString *)body
|
|
|
|
attachmentIds:(NSArray<NSString *> *)attachmentIds
|
|
|
|
expiresInSeconds:(uint32_t)expiresInSeconds
|
2017-04-12 17:15:15 +02:00
|
|
|
expireStartedAt:(uint64_t)expireStartedAt NS_DESIGNATED_INITIALIZER;
|
2016-10-05 17:42:44 +02:00
|
|
|
|
|
|
|
- (nullable instancetype)initWithCoder:(NSCoder *)coder NS_DESIGNATED_INITIALIZER;
|
|
|
|
|
2015-12-07 03:31:43 +01:00
|
|
|
- (BOOL)hasAttachments;
|
2017-10-18 02:48:15 +02:00
|
|
|
|
2017-09-29 21:49:03 +02:00
|
|
|
- (NSString *)previewTextWithTransaction:(YapDatabaseReadTransaction *)transaction;
|
2015-12-07 03:31:43 +01:00
|
|
|
|
2017-10-18 02:48:15 +02:00
|
|
|
- (BOOL)shouldStartExpireTimer;
|
|
|
|
- (BOOL)shouldStartExpireTimer:(YapDatabaseReadTransaction *)transaction;
|
|
|
|
|
2015-12-07 03:31:43 +01:00
|
|
|
@end
|
2016-08-29 00:48:35 +02:00
|
|
|
|
|
|
|
NS_ASSUME_NONNULL_END
|