diff --git a/packages/stream_video/lib/src/call/state/mixins/state_lifecycle_mixin.dart b/packages/stream_video/lib/src/call/state/mixins/state_lifecycle_mixin.dart index 64fd6ce8e..783af6af0 100644 --- a/packages/stream_video/lib/src/call/state/mixins/state_lifecycle_mixin.dart +++ b/packages/stream_video/lib/src/call/state/mixins/state_lifecycle_mixin.dart @@ -274,6 +274,7 @@ extension on CallMetadata { roles: user?.roles ?? [participant.role], name: user?.name ?? '', custom: user?.custom ?? {}, + customData: user?.custom ?? {}, image: user?.image ?? '', sessionId: sessionId, isLocal: isLocal, @@ -284,6 +285,7 @@ extension on CallMetadata { roles: user?.roles ?? [participant.role], name: user?.name ?? '', custom: user?.custom ?? {}, + customData: user?.custom ?? {}, image: user?.image ?? '', sessionId: participant.userSessionId, trackIdPrefix: '', diff --git a/packages/stream_video/lib/src/call/state/mixins/state_sfu_mixin.dart b/packages/stream_video/lib/src/call/state/mixins/state_sfu_mixin.dart index 20602553f..1f15e870a 100644 --- a/packages/stream_video/lib/src/call/state/mixins/state_sfu_mixin.dart +++ b/packages/stream_video/lib/src/call/state/mixins/state_sfu_mixin.dart @@ -231,6 +231,7 @@ mixin StateSfuMixin on StateNotifier, StatePendingTracksMixin { roles: event.participant.roles, name: event.participant.userName, custom: event.participant.custom, + customData: event.participant.customData, image: event.participant.userImage, sessionId: event.participant.sessionId, trackIdPrefix: event.participant.trackLookupPrefix, @@ -274,6 +275,7 @@ mixin StateSfuMixin on StateNotifier, StatePendingTracksMixin { .copyWith( name: participant.userName, custom: participant.custom, + customData: participant.customData, image: participant.userImage, trackIdPrefix: participant.trackLookupPrefix, isSpeaking: participant.isSpeaking, diff --git a/packages/stream_video/lib/src/models/call_participant_state.dart b/packages/stream_video/lib/src/models/call_participant_state.dart index ec360347c..90852d3e0 100644 --- a/packages/stream_video/lib/src/models/call_participant_state.dart +++ b/packages/stream_video/lib/src/models/call_participant_state.dart @@ -21,6 +21,7 @@ class CallParticipantState required this.roles, required this.name, required this.custom, + this.customData = const {}, this.image, required this.sessionId, required this.trackIdPrefix, @@ -46,6 +47,7 @@ class CallParticipantState required this.roles, required this.name, required this.custom, + required this.customData, required this.image, required this.sessionId, required this.trackIdPrefix, @@ -68,7 +70,9 @@ class CallParticipantState final String userId; final List roles; final String name; + @Deprecated('Use customData instead') final Map custom; + final Map customData; final String? image; final String sessionId; final String trackIdPrefix; @@ -111,6 +115,7 @@ class CallParticipantState List? roles, String? name, Map? custom, + Map? customData, String? image, String? sessionId, String? trackIdPrefix, @@ -134,6 +139,7 @@ class CallParticipantState roles: roles ?? this.roles, name: name ?? this.name, custom: custom ?? this.custom, + customData: customData ?? this.customData, image: image ?? this.image, sessionId: sessionId ?? this.sessionId, trackIdPrefix: trackIdPrefix ?? this.trackIdPrefix, @@ -181,6 +187,7 @@ class CallParticipantState roles: roles, name: name, custom: custom, + customData: customData, image: image, sessionId: sessionId, trackIdPrefix: trackIdPrefix, @@ -213,6 +220,7 @@ class CallParticipantState roles: roles, name: name, custom: custom, + customData: customData, image: image, sessionId: sessionId, trackIdPrefix: trackIdPrefix, @@ -272,6 +280,7 @@ class CallParticipantState roles, name, custom, + customData, image, sessionId, trackIdPrefix, diff --git a/packages/stream_video/lib/src/sfu/data/events/sfu_event_mapper_extensions.dart b/packages/stream_video/lib/src/sfu/data/events/sfu_event_mapper_extensions.dart index 0594ff01b..dea94b7dd 100644 --- a/packages/stream_video/lib/src/sfu/data/events/sfu_event_mapper_extensions.dart +++ b/packages/stream_video/lib/src/sfu/data/events/sfu_event_mapper_extensions.dart @@ -255,6 +255,7 @@ extension SfuParticipantExtension on sfu_models.Participant { userImage: image, sessionId: sessionId, custom: custom.fields, + customData: (custom.toProto3Json() as Map?) ?? {}, publishedTracks: publishedTracks .map( (track) => track.toDomain(), diff --git a/packages/stream_video/lib/src/sfu/data/models/sfu_participant.dart b/packages/stream_video/lib/src/sfu/data/models/sfu_participant.dart index 0bbe28396..c9df56a76 100644 --- a/packages/stream_video/lib/src/sfu/data/models/sfu_participant.dart +++ b/packages/stream_video/lib/src/sfu/data/models/sfu_participant.dart @@ -11,6 +11,7 @@ class SfuParticipant with EquatableMixin { required this.userImage, required this.sessionId, required this.custom, + required this.customData, required this.publishedTracks, required this.joinedAt, required this.trackLookupPrefix, @@ -27,6 +28,7 @@ class SfuParticipant with EquatableMixin { final String userImage; final String sessionId; final Map custom; + final Map customData; final List publishedTracks; final DateTime joinedAt; final String trackLookupPrefix; @@ -43,6 +45,7 @@ class SfuParticipant with EquatableMixin { String? userImage, String? sessionId, Map? custom, + Map? customData, List? publishedTracks, DateTime? joinedAt, String? trackLookupPrefix, @@ -58,6 +61,7 @@ class SfuParticipant with EquatableMixin { userImage: userId ?? this.userImage, sessionId: sessionId ?? this.sessionId, custom: custom ?? this.custom, + customData: customData ?? this.customData, publishedTracks: publishedTracks ?? this.publishedTracks, joinedAt: joinedAt ?? this.joinedAt, trackLookupPrefix: trackLookupPrefix ?? this.trackLookupPrefix, @@ -87,6 +91,7 @@ class SfuParticipant with EquatableMixin { userImage, sessionId, custom, + customData, publishedTracks, joinedAt, trackLookupPrefix, diff --git a/packages/stream_video/lib/src/sfu/sfu_extensions.dart b/packages/stream_video/lib/src/sfu/sfu_extensions.dart index 954733b5c..7951393dc 100644 --- a/packages/stream_video/lib/src/sfu/sfu_extensions.dart +++ b/packages/stream_video/lib/src/sfu/sfu_extensions.dart @@ -48,6 +48,7 @@ extension SfuParticipantX on SfuParticipant { roles: roles.isNotEmpty ? roles : existingRoles, name: userName.ifEmpty(() => existingName), custom: custom, + customData: customData, image: userImage.ifEmpty(() => existingImage), sessionId: sessionId, trackIdPrefix: trackLookupPrefix, diff --git a/packages/stream_video/test/src/call/call_state_notifier_test.dart b/packages/stream_video/test/src/call/call_state_notifier_test.dart index cbe49fb8d..bb92102ef 100644 --- a/packages/stream_video/test/src/call/call_state_notifier_test.dart +++ b/packages/stream_video/test/src/call/call_state_notifier_test.dart @@ -48,6 +48,7 @@ void main() { userImage: '', sessionId: 'remote-session', custom: const {}, + customData: const {}, publishedTracks: const [], joinedAt: DateTime.now(), trackLookupPrefix: 'remote-track-123', @@ -98,6 +99,7 @@ void main() { userImage: '', sessionId: 'remote-session', custom: const {}, + customData: const {}, publishedTracks: const [], joinedAt: DateTime.now(), trackLookupPrefix: 'remote-track-123', @@ -158,6 +160,7 @@ void main() { userImage: '', sessionId: 'remote-session', custom: const {}, + customData: const {}, publishedTracks: const [], joinedAt: DateTime.now(), trackLookupPrefix: 'remote-track-123', @@ -226,6 +229,7 @@ void main() { userImage: '', sessionId: 'remote-session', custom: const {}, + customData: const {}, publishedTracks: const [], joinedAt: DateTime.now(), trackLookupPrefix: 'remote-track-123', @@ -315,6 +319,7 @@ void main() { userImage: '', sessionId: 'remote-session', custom: const {}, + customData: const {}, publishedTracks: const [], joinedAt: DateTime.now(), trackLookupPrefix: 'remote-track-123',