-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathdialog_info.dart
More file actions
77 lines (68 loc) · 2.37 KB
/
Copy pathdialog_info.dart
File metadata and controls
77 lines (68 loc) · 2.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
import 'package:equatable/equatable.dart';
enum DialogDirection { initiator, recipient }
enum DialogState { trying, proceeding, early, confirmed, terminated, unknown }
class DialogInfo extends Equatable {
const DialogInfo({
required this.id,
required this.entityNumber,
required this.state,
required this.callId,
required this.direction,
required this.localTag,
required this.localNumber,
required this.localDisplayName,
required this.remoteTag,
required this.remoteNumber,
required this.remoteDisplayName,
required this.arrivalVersion,
required this.arrivalTime,
this.hasVideo,
});
final String id;
final String entityNumber;
final DialogState state;
final String? callId;
final DialogDirection? direction;
final String? localTag;
final String? localNumber;
final String? localDisplayName;
final String? remoteTag;
final String? remoteNumber;
final String? remoteDisplayName;
final String arrivalVersion;
final DateTime arrivalTime;
/// Whether the dialog currently has an active video stream. Null when the
/// backend does not report media type yet (treated as unknown, not audio).
final bool? hasVideo;
String? get displayName => remoteDisplayName ?? remoteNumber;
bool get pullable {
if (state != DialogState.confirmed) return false;
if (remoteNumber == null || callId == null || localTag == null || remoteTag == null) return false;
// Pulling a video call offers audio-only and crashes on the answer's video
// m-line, so exclude known-video dialogs. Null (unknown) stays pullable to
// preserve current behaviour until the backend reports media type.
if (hasVideo == true) return false;
return true;
}
@override
List<Object?> get props => [
id,
entityNumber,
state,
callId,
direction,
localTag,
localNumber,
localDisplayName,
remoteTag,
remoteNumber,
remoteDisplayName,
arrivalVersion,
arrivalTime,
hasVideo,
];
@override
String toString() {
return 'DialogInfo{id: $id, entityNumber: $entityNumber, state: $state, callId: $callId, direction: $direction, localTag: $localTag, localNumber: $localNumber, localDisplayName: $localDisplayName, remoteTag: $remoteTag, remoteNumber: $remoteNumber, remoteDisplayName: $remoteDisplayName, arrivalVersion: $arrivalVersion, arrivalTime: $arrivalTime, hasVideo: $hasVideo}';
}
}