Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
signalapp
GitHub Repository: signalapp/Signal-iOS
Path: blob/main/SignalServiceKit/Calls/Individual/TSCall.h
1 views
1
//
2
// Copyright 2018 Signal Messenger, LLC
3
// SPDX-License-Identifier: AGPL-3.0-only
4
//
5
6
#import <SignalServiceKit/OWSReadTracking.h>
7
#import <SignalServiceKit/TSInteraction.h>
8
9
NS_ASSUME_NONNULL_BEGIN
10
11
@class TSContactThread;
12
13
typedef NS_ENUM(NSUInteger, RPRecentCallType) {
14
RPRecentCallTypeIncoming = 1,
15
RPRecentCallTypeOutgoing,
16
RPRecentCallTypeIncomingMissed,
17
// These call types are used until the call connects.
18
RPRecentCallTypeOutgoingIncomplete,
19
RPRecentCallTypeIncomingIncomplete,
20
RPRecentCallTypeIncomingMissedBecauseOfChangedIdentity,
21
RPRecentCallTypeIncomingDeclined,
22
RPRecentCallTypeOutgoingMissed,
23
RPRecentCallTypeIncomingAnsweredElsewhere,
24
RPRecentCallTypeIncomingDeclinedElsewhere,
25
RPRecentCallTypeIncomingBusyElsewhere,
26
RPRecentCallTypeIncomingMissedBecauseOfDoNotDisturb,
27
RPRecentCallTypeIncomingMissedBecauseBlockedSystemContact
28
};
29
30
typedef NS_CLOSED_ENUM(NSUInteger, TSRecentCallOfferType) {
31
TSRecentCallOfferTypeAudio,
32
TSRecentCallOfferTypeVideo
33
};
34
35
NSString *NSStringFromCallType(RPRecentCallType callType);
36
37
/// Represents a 1:1 call-related update that lives in chat history.
38
///
39
/// A ``TSCall`` is associated with a ``CallRecord``. The ``CallRecord`` helps
40
/// bridge between "call IDs" used to identify this call across devices and
41
/// ``TSCall`` instances local to this device.
42
///
43
/// Not to be confused with an ``OutgoingCallMessage``.
44
@interface TSCall : TSInteraction <OWSPreviewText>
45
46
/// Encodes both what kind of call it is, and the state of that call (pending, answered, missed, etc.)
47
/// Written to by CallKit callbacks, but also by incoming call event sync messages from linked
48
/// devices, by way of `CallRecord`.
49
@property (nonatomic) RPRecentCallType callType;
50
@property (nonatomic, readonly) TSRecentCallOfferType offerType;
51
52
/// Whether this call has been read, or is "unread".
53
/// - SeeAlso ``OWSReadTracking``
54
@property (nonatomic, getter=wasRead) BOOL read;
55
56
- (instancetype)initWithCustomUniqueId:(NSString *)uniqueId
57
timestamp:(uint64_t)timestamp
58
receivedAtTimestamp:(uint64_t)receivedAtTimestamp
59
thread:(TSThread *)thread NS_UNAVAILABLE;
60
- (instancetype)initWithTimestamp:(uint64_t)timestamp
61
receivedAtTimestamp:(uint64_t)receivedAtTimestamp
62
thread:(TSThread *)thread NS_UNAVAILABLE;
63
- (instancetype)initWithGrdbId:(int64_t)grdbId
64
uniqueId:(NSString *)uniqueId
65
receivedAtTimestamp:(uint64_t)receivedAtTimestamp
66
sortId:(uint64_t)sortId
67
timestamp:(uint64_t)timestamp
68
uniqueThreadId:(NSString *)uniqueThreadId NS_UNAVAILABLE;
69
70
- (nullable instancetype)initWithCoder:(NSCoder *)coder NS_UNAVAILABLE;
71
72
- (instancetype)initWithCallType:(RPRecentCallType)callType
73
offerType:(TSRecentCallOfferType)offerType
74
thread:(TSContactThread *)thread
75
sentAtTimestamp:(uint64_t)sentAtTimestamp NS_DESIGNATED_INITIALIZER;
76
77
// --- CODE GENERATION MARKER
78
79
// This snippet is generated by /Scripts/sds_codegen/sds_generate.py. Do not manually edit it, instead run
80
// `sds_codegen.sh`.
81
82
// clang-format off
83
84
- (instancetype)initWithGrdbId:(int64_t)grdbId
85
uniqueId:(NSString *)uniqueId
86
receivedAtTimestamp:(uint64_t)receivedAtTimestamp
87
sortId:(uint64_t)sortId
88
timestamp:(uint64_t)timestamp
89
uniqueThreadId:(NSString *)uniqueThreadId
90
callType:(RPRecentCallType)callType
91
offerType:(TSRecentCallOfferType)offerType
92
read:(BOOL)read
93
NS_DESIGNATED_INITIALIZER NS_SWIFT_NAME(init(grdbId:uniqueId:receivedAtTimestamp:sortId:timestamp:uniqueThreadId:callType:offerType:read:));
94
95
// clang-format on
96
97
// --- CODE GENERATION MARKER
98
99
@end
100
101
NS_ASSUME_NONNULL_END
102
103