deprecate inconsistencies in event properties

This commit is contained in:
Hiroshi Horie
2022-01-11 00:51:16 +07:00
parent a6a4e18551
commit 7799e35c13
3 changed files with 25 additions and 16 deletions
+21 -12
View File
@@ -210,30 +210,36 @@ class TrackUnsubscribedEvent with RoomEvent, ParticipantEvent {
/// Emitted by [RemoteParticipant] and [LocalParticipant]. /// Emitted by [RemoteParticipant] and [LocalParticipant].
class TrackMutedEvent with RoomEvent, ParticipantEvent { class TrackMutedEvent with RoomEvent, ParticipantEvent {
final Participant participant; final Participant participant;
final TrackPublication track; final TrackPublication publication;
const TrackMutedEvent({ const TrackMutedEvent({
required this.participant, required this.participant,
required this.track, required this.publication,
}); });
@override @override
String toString() => '${runtimeType}' String toString() => '${runtimeType}'
'(participant: ${participant}, publication: ${track})'; '(participant: ${participant}, publication: ${publication})';
@Deprecated('Use publication instead')
TrackPublication get track => publication;
} }
/// This participant has unmuted one of their tracks /// This participant has unmuted one of their tracks
/// Emitted by [RemoteParticipant] and [LocalParticipant]. /// Emitted by [RemoteParticipant] and [LocalParticipant].
class TrackUnmutedEvent with RoomEvent, ParticipantEvent { class TrackUnmutedEvent with RoomEvent, ParticipantEvent {
final Participant participant; final Participant participant;
final TrackPublication track; final TrackPublication publication;
const TrackUnmutedEvent({ const TrackUnmutedEvent({
required this.participant, required this.participant,
required this.track, required this.publication,
}); });
@override @override
String toString() => '${runtimeType}' String toString() => '${runtimeType}'
'(participant: ${participant}, publication: ${track})'; '(participant: ${participant}, publication: ${publication})';
@Deprecated('Use publication instead')
TrackPublication get track => publication;
} }
/// The [StreamState] on the [RemoteTrackPublication] has updated by the server. /// The [StreamState] on the [RemoteTrackPublication] has updated by the server.
@@ -241,18 +247,21 @@ class TrackUnmutedEvent with RoomEvent, ParticipantEvent {
/// Emitted by [Room] and [RemoteParticipant]. /// Emitted by [Room] and [RemoteParticipant].
class TrackStreamStateUpdatedEvent with RoomEvent, ParticipantEvent { class TrackStreamStateUpdatedEvent with RoomEvent, ParticipantEvent {
final RemoteParticipant participant; final RemoteParticipant participant;
final RemoteTrackPublication trackPublication; final RemoteTrackPublication publication;
final StreamState streamState; final StreamState streamState;
const TrackStreamStateUpdatedEvent({ const TrackStreamStateUpdatedEvent({
required this.participant, required this.participant,
required this.trackPublication, required this.publication,
required this.streamState, required this.streamState,
}); });
@override @override
String toString() => '${runtimeType}' String toString() => '${runtimeType}'
'(participant: ${participant}, publication: ${trackPublication}, ' '(participant: ${participant}, publication: ${publication}, '
'streamState: ${streamState})'; 'streamState: ${streamState})';
@Deprecated('Use publication instead')
RemoteTrackPublication get trackPublication => publication;
} }
/// Participant metadata is a simple way for app-specific state to be pushed to /// Participant metadata is a simple way for app-specific state to be pushed to
@@ -324,16 +333,16 @@ class SpeakingChangedEvent with ParticipantEvent {
/// be emitted. /// be emitted.
class TrackSubscriptionPermissionChangedEvent with RoomEvent, ParticipantEvent { class TrackSubscriptionPermissionChangedEvent with RoomEvent, ParticipantEvent {
final Participant participant; final Participant participant;
final RemoteTrackPublication trackPublication; final RemoteTrackPublication publication;
final TrackSubscriptionState state; final TrackSubscriptionState state;
const TrackSubscriptionPermissionChangedEvent({ const TrackSubscriptionPermissionChangedEvent({
required this.participant, required this.participant,
required this.trackPublication, required this.publication,
required this.state, required this.state,
}); });
@override @override
String toString() => '${runtimeType}' String toString() => '${runtimeType}'
'(participant: ${participant}, publication: ${trackPublication}, ' '(participant: ${participant}, publication: ${publication}, '
'state: ${state})'; 'state: ${state})';
} }
+2 -2
View File
@@ -72,7 +72,7 @@ class RemoteTrackPublication<T extends RemoteTrack>
participant.room.events, participant.room.events,
].emit(TrackStreamStateUpdatedEvent( ].emit(TrackStreamStateUpdatedEvent(
participant: participant, participant: participant,
trackPublication: this, publication: this,
streamState: streamState, streamState: streamState,
)); ));
} }
@@ -296,7 +296,7 @@ class RemoteTrackPublication<T extends RemoteTrack>
participant.room.events, participant.room.events,
].emit(TrackSubscriptionPermissionChangedEvent( ].emit(TrackSubscriptionPermissionChangedEvent(
participant: participant, participant: participant,
trackPublication: this, publication: this,
state: subscriptionState, state: subscriptionState,
)); ));
+2 -2
View File
@@ -111,8 +111,8 @@ abstract class TrackPublication<T extends Track> extends Disposable {
} }
// emit events // emit events
final newEvent = event.muted final newEvent = event.muted
? TrackMutedEvent(participant: participant, track: this) ? TrackMutedEvent(participant: participant, publication: this)
: TrackUnmutedEvent(participant: participant, track: this); : TrackUnmutedEvent(participant: participant, publication: this);
[participant.events, participant.room.events].emit(newEvent); [participant.events, participant.room.events].emit(newEvent);
} }