mirror of https://github.com/oxen-io/session-ios
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
114 lines
4.3 KiB
C
114 lines
4.3 KiB
C
9 years ago
|
//
|
||
|
// Copyright (c) 2017 Open Whisper Systems. All rights reserved.
|
||
|
//
|
||
10 years ago
|
|
||
9 years ago
|
#import "OWSReadTracking.h"
|
||
10 years ago
|
#import "TSMessage.h"
|
||
|
|
||
9 years ago
|
NS_ASSUME_NONNULL_BEGIN
|
||
|
|
||
9 years ago
|
@class TSContactThread;
|
||
|
@class TSGroupThread;
|
||
|
|
||
9 years ago
|
extern NSString *const TSIncomingMessageWasReadOnThisDeviceNotification;
|
||
|
|
||
9 years ago
|
@interface TSIncomingMessage : TSMessage <OWSReadTracking>
|
||
10 years ago
|
|
||
|
/**
|
||
9 years ago
|
* Inits an incoming group message without attachments
|
||
10 years ago
|
*
|
||
9 years ago
|
* @param timestamp
|
||
9 years ago
|
* When the message was created in milliseconds since epoch
|
||
9 years ago
|
* @param thread
|
||
|
* Thread to which the message belongs
|
||
|
* @param authorId
|
||
9 years ago
|
* Signal ID (i.e. e164) of the user who sent the message
|
||
9 years ago
|
* @param sourceDeviceId
|
||
|
* Numeric ID of the device used to send the message. Used to detect duplicate messages.
|
||
9 years ago
|
* @param body
|
||
|
* Body of the message
|
||
|
*
|
||
|
* @return initiated incoming group message
|
||
|
*/
|
||
|
- (instancetype)initWithTimestamp:(uint64_t)timestamp
|
||
9 years ago
|
inThread:(TSThread *)thread
|
||
|
authorId:(NSString *)authorId
|
||
9 years ago
|
sourceDeviceId:(uint32_t)sourceDeviceId
|
||
9 years ago
|
messageBody:(nullable NSString *)body;
|
||
|
|
||
9 years ago
|
/**
|
||
|
* Inits an incoming group message that expires.
|
||
|
*
|
||
|
* @param timestamp
|
||
|
* When the message was created in milliseconds since epoch
|
||
|
* @param thread
|
||
|
* Thread to which the message belongs
|
||
|
* @param authorId
|
||
|
* Signal ID (i.e. e164) of the user who sent the message
|
||
9 years ago
|
* @param sourceDeviceId
|
||
|
* Numeric ID of the device used to send the message. Used to detect duplicate messages.
|
||
9 years ago
|
* @param body
|
||
|
* Body of the message
|
||
|
* @param attachmentIds
|
||
|
* The uniqueIds for the message's attachments, possibly an empty list.
|
||
|
* @param expiresInSeconds
|
||
|
* Seconds from when the message is read until it is deleted.
|
||
|
*
|
||
|
* @return initiated incoming group message
|
||
|
*/
|
||
|
- (instancetype)initWithTimestamp:(uint64_t)timestamp
|
||
9 years ago
|
inThread:(TSThread *)thread
|
||
|
authorId:(NSString *)authorId
|
||
9 years ago
|
sourceDeviceId:(uint32_t)sourceDeviceId
|
||
9 years ago
|
messageBody:(nullable NSString *)body
|
||
|
attachmentIds:(NSArray<NSString *> *)attachmentIds
|
||
|
expiresInSeconds:(uint32_t)expiresInSeconds NS_DESIGNATED_INITIALIZER;
|
||
|
|
||
|
- (instancetype)initWithCoder:(NSCoder *)coder NS_DESIGNATED_INITIALIZER;
|
||
|
|
||
|
|
||
|
/**
|
||
9 years ago
|
* For sake of a smaller API, and simplifying assumptions elsewhere, you must specify an author id for *all* incoming
|
||
9 years ago
|
* messages, even though we technically could infer the author id for a contact thread.
|
||
9 years ago
|
*/
|
||
|
- (instancetype)initWithTimestamp:(uint64_t)timestamp NS_UNAVAILABLE;
|
||
|
- (instancetype)initWithTimestamp:(uint64_t)timestamp inThread:(nullable TSThread *)thread NS_UNAVAILABLE;
|
||
|
- (instancetype)initWithTimestamp:(uint64_t)timestamp
|
||
|
inThread:(nullable TSThread *)thread
|
||
|
messageBody:(nullable NSString *)body NS_UNAVAILABLE;
|
||
|
- (instancetype)initWithTimestamp:(uint64_t)timestamp
|
||
|
inThread:(nullable TSThread *)thread
|
||
|
messageBody:(nullable NSString *)body
|
||
|
attachmentIds:(NSArray<NSString *> *)attachmentIds NS_UNAVAILABLE;
|
||
|
- (instancetype)initWithTimestamp:(uint64_t)timestamp
|
||
|
inThread:(nullable TSThread *)thread
|
||
|
messageBody:(nullable NSString *)body
|
||
|
attachmentIds:(NSArray<NSString *> *)attachmentIds
|
||
|
expiresInSeconds:(uint32_t)expiresInSeconds NS_UNAVAILABLE;
|
||
|
- (instancetype)initWithTimestamp:(uint64_t)timestamp
|
||
|
inThread:(nullable TSThread *)thread
|
||
9 years ago
|
messageBody:(nullable NSString *)body
|
||
|
attachmentIds:(NSArray<NSString *> *)attachmentIds
|
||
9 years ago
|
expiresInSeconds:(uint32_t)expiresInSeconds
|
||
|
expireStartedAt:(uint64_t)expireStartedAt NS_UNAVAILABLE;
|
||
9 years ago
|
|
||
9 years ago
|
/*
|
||
|
* Find a message matching the senderId and timestamp, if any.
|
||
|
*
|
||
|
* @param authorId
|
||
|
* Signal ID (i.e. e164) of the user who sent the message
|
||
|
* @params timestamp
|
||
|
* When the message was created in milliseconds since epoch
|
||
|
*
|
||
|
*/
|
||
|
+ (nullable instancetype)findMessageWithAuthorId:(NSString *)authorId timestamp:(uint64_t)timestamp;
|
||
|
|
||
10 years ago
|
@property (nonatomic, readonly) NSString *authorId;
|
||
9 years ago
|
|
||
|
// This will be 0 for messages created before we were tracking sourceDeviceId
|
||
9 years ago
|
@property (nonatomic, readonly) UInt32 sourceDeviceId;
|
||
10 years ago
|
|
||
|
@end
|
||
9 years ago
|
|
||
|
NS_ASSUME_NONNULL_END
|