101 lines
3.9 KiB
Objective-C
101 lines
3.9 KiB
Objective-C
//
|
|
// Copyright 2018 Signal Messenger, LLC
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
//
|
|
|
|
#import <SignalServiceKit/OWSReadTracking.h>
|
|
#import <SignalServiceKit/TSInteraction.h>
|
|
|
|
NS_ASSUME_NONNULL_BEGIN
|
|
|
|
@class TSContactThread;
|
|
|
|
typedef NS_ENUM(NSUInteger, RPRecentCallType) {
|
|
RPRecentCallTypeIncoming = 1,
|
|
RPRecentCallTypeOutgoing,
|
|
RPRecentCallTypeIncomingMissed,
|
|
// These call types are used until the call connects.
|
|
RPRecentCallTypeOutgoingIncomplete,
|
|
RPRecentCallTypeIncomingIncomplete,
|
|
RPRecentCallTypeIncomingMissedBecauseOfChangedIdentity,
|
|
RPRecentCallTypeIncomingDeclined,
|
|
RPRecentCallTypeOutgoingMissed,
|
|
RPRecentCallTypeIncomingAnsweredElsewhere,
|
|
RPRecentCallTypeIncomingDeclinedElsewhere,
|
|
RPRecentCallTypeIncomingBusyElsewhere,
|
|
RPRecentCallTypeIncomingMissedBecauseOfDoNotDisturb,
|
|
RPRecentCallTypeIncomingMissedBecauseBlockedSystemContact
|
|
};
|
|
|
|
typedef NS_CLOSED_ENUM(NSUInteger, TSRecentCallOfferType) {
|
|
TSRecentCallOfferTypeAudio,
|
|
TSRecentCallOfferTypeVideo
|
|
};
|
|
|
|
NSString *NSStringFromCallType(RPRecentCallType callType);
|
|
|
|
/// Represents a 1:1 call-related update that lives in chat history.
|
|
///
|
|
/// A ``TSCall`` is associated with a ``CallRecord``. The ``CallRecord`` helps
|
|
/// bridge between "call IDs" used to identify this call across devices and
|
|
/// ``TSCall`` instances local to this device.
|
|
///
|
|
/// Not to be confused with an ``OWSOutgoingCallMessage``.
|
|
@interface TSCall : TSInteraction <OWSPreviewText>
|
|
|
|
/// Encodes both what kind of call it is, and the state of that call (pending, answered, missed, etc.)
|
|
/// Written to by CallKit callbacks, but also by incoming call event sync messages from linked
|
|
/// devices, by way of `CallRecord`.
|
|
@property (nonatomic) RPRecentCallType callType;
|
|
@property (nonatomic, readonly) TSRecentCallOfferType offerType;
|
|
|
|
/// Whether this call has been read, or is "unread".
|
|
/// - SeeAlso ``OWSReadTracking``
|
|
@property (nonatomic, getter=wasRead) BOOL read;
|
|
|
|
- (instancetype)initWithCustomUniqueId:(NSString *)uniqueId
|
|
timestamp:(uint64_t)timestamp
|
|
receivedAtTimestamp:(uint64_t)receivedAtTimestamp
|
|
thread:(TSThread *)thread NS_UNAVAILABLE;
|
|
- (instancetype)initWithTimestamp:(uint64_t)timestamp
|
|
receivedAtTimestamp:(uint64_t)receivedAtTimestamp
|
|
thread:(TSThread *)thread NS_UNAVAILABLE;
|
|
- (instancetype)initWithGrdbId:(int64_t)grdbId
|
|
uniqueId:(NSString *)uniqueId
|
|
receivedAtTimestamp:(uint64_t)receivedAtTimestamp
|
|
sortId:(uint64_t)sortId
|
|
timestamp:(uint64_t)timestamp
|
|
uniqueThreadId:(NSString *)uniqueThreadId NS_UNAVAILABLE;
|
|
|
|
- (nullable instancetype)initWithCoder:(NSCoder *)coder NS_DESIGNATED_INITIALIZER;
|
|
|
|
- (instancetype)initWithCallType:(RPRecentCallType)callType
|
|
offerType:(TSRecentCallOfferType)offerType
|
|
thread:(TSContactThread *)thread
|
|
sentAtTimestamp:(uint64_t)sentAtTimestamp NS_DESIGNATED_INITIALIZER;
|
|
|
|
// --- CODE GENERATION MARKER
|
|
|
|
// This snippet is generated by /Scripts/sds_codegen/sds_generate.py. Do not manually edit it, instead run
|
|
// `sds_codegen.sh`.
|
|
|
|
// clang-format off
|
|
|
|
- (instancetype)initWithGrdbId:(int64_t)grdbId
|
|
uniqueId:(NSString *)uniqueId
|
|
receivedAtTimestamp:(uint64_t)receivedAtTimestamp
|
|
sortId:(uint64_t)sortId
|
|
timestamp:(uint64_t)timestamp
|
|
uniqueThreadId:(NSString *)uniqueThreadId
|
|
callType:(RPRecentCallType)callType
|
|
offerType:(TSRecentCallOfferType)offerType
|
|
read:(BOOL)read
|
|
NS_DESIGNATED_INITIALIZER NS_SWIFT_NAME(init(grdbId:uniqueId:receivedAtTimestamp:sortId:timestamp:uniqueThreadId:callType:offerType:read:));
|
|
|
|
// clang-format on
|
|
|
|
// --- CODE GENERATION MARKER
|
|
|
|
@end
|
|
|
|
NS_ASSUME_NONNULL_END
|