From 4227bf36fb442f22b0b2de978271ab00736c5bb2 Mon Sep 17 00:00:00 2001 From: Brazol Date: Wed, 11 Sep 2024 11:27:06 +0200 Subject: [PATCH] fixed empty roles list in call participant state --- .../lib/screens/call_participants_list.dart | 16 +++++++++++++--- .../stream_video/lib/src/sfu/sfu_extensions.dart | 4 ++-- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/dogfooding/lib/screens/call_participants_list.dart b/dogfooding/lib/screens/call_participants_list.dart index d28485b79..b7677a616 100644 --- a/dogfooding/lib/screens/call_participants_list.dart +++ b/dogfooding/lib/screens/call_participants_list.dart @@ -74,9 +74,19 @@ class CallParticipantsList extends StatelessWidget { child: Padding( padding: const EdgeInsets.symmetric(horizontal: 16), - child: Text( - participant.name, - overflow: TextOverflow.ellipsis, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + participant.name, + overflow: TextOverflow.ellipsis, + ), + Text( + participant.roles.join(', '), + style: textTheme.footnoteItalic, + overflow: TextOverflow.ellipsis, + ), + ], ), ), ), diff --git a/packages/stream_video/lib/src/sfu/sfu_extensions.dart b/packages/stream_video/lib/src/sfu/sfu_extensions.dart index 599ffcd2c..a44efd98e 100644 --- a/packages/stream_video/lib/src/sfu/sfu_extensions.dart +++ b/packages/stream_video/lib/src/sfu/sfu_extensions.dart @@ -7,7 +7,7 @@ extension SfuParticipantX on SfuParticipant { CallParticipantState toParticipantState(CallState state) { final isLocal = userId == state.currentUserId; final existing = state.callParticipants.firstWhereOrNull( - (it) => it.userId == userId && it.sessionId == sessionId, + (it) => it.userId == userId, ); final existingName = existing?.name ?? ''; @@ -16,7 +16,7 @@ extension SfuParticipantX on SfuParticipant { return CallParticipantState( userId: userId, - roles: existingRoles, + roles: roles.isNotEmpty ? roles : existingRoles, name: userName.ifEmpty(() => existingName), custom: custom, image: userImage.ifEmpty(() => existingImage),