diff --git a/lib/models/call.dart b/lib/models/call.dart index 4e23c3a..a79b9b4 100644 --- a/lib/models/call.dart +++ b/lib/models/call.dart @@ -14,7 +14,8 @@ class Call { String externalId; int founderId; int channelId; - List participants; + @JsonKey(defaultValue: []) + List? participants; Channel channel; Call({ diff --git a/lib/models/call.g.dart b/lib/models/call.g.dart index 918cbbd..ca185d7 100644 --- a/lib/models/call.g.dart +++ b/lib/models/call.g.dart @@ -19,7 +19,7 @@ Call _$CallFromJson(Map json) => Call( externalId: json['external_id'] as String, founderId: (json['founder_id'] as num).toInt(), channelId: (json['channel_id'] as num).toInt(), - participants: json['participants'] as List, + participants: json['participants'] as List? ?? [], channel: Channel.fromJson(json['channel'] as Map), ); diff --git a/lib/screens/channel/channel_chat.dart b/lib/screens/channel/channel_chat.dart index fdbef5f..1f00409 100644 --- a/lib/screens/channel/channel_chat.dart +++ b/lib/screens/channel/channel_chat.dart @@ -98,6 +98,7 @@ class _ChannelChatScreenState extends State setState(() => _ongoingCall = Call.fromJson(resp.body)); } } catch (e) { + print((e as dynamic).stackTrace); context.showErrorDialog(e); } diff --git a/lib/widgets/channel/channel_call_indicator.dart b/lib/widgets/channel/channel_call_indicator.dart index c7e2a2b..8b9beb5 100644 --- a/lib/widgets/channel/channel_call_indicator.dart +++ b/lib/widgets/channel/channel_call_indicator.dart @@ -53,11 +53,11 @@ class ChannelCallIndicator extends StatelessWidget { return Text('callOngoingJoined'.trParams({ 'duration': call.lastDuration.value, })); - } else if (ongoingCall.participants.isEmpty) { + } else if (ongoingCall.participants!.isEmpty) { return Text('callOngoingEmpty'.tr); } else { return Text('callOngoingParticipants'.trParams({ - 'count': ongoingCall.participants.length.toString(), + 'count': ongoingCall.participants!.length.toString(), })); } }), @@ -66,14 +66,14 @@ class ChannelCallIndicator extends StatelessWidget { if (call.isInitialized.value) { return const SizedBox.shrink(); } - if (ongoingCall.participants.isNotEmpty) { + if (ongoingCall.participants!.isNotEmpty) { return Container( height: 28, constraints: const BoxConstraints(maxWidth: 120), child: AvatarStack( height: 28, borderWidth: 0, - avatars: ongoingCall.participants.map((x) { + avatars: ongoingCall.participants!.map((x) { final userinfo = Account.fromJson(jsonDecode(x['metadata'])); return PlatformInfo.canCacheImage diff --git a/lib/widgets/navigation/app_navigation_region.dart b/lib/widgets/navigation/app_navigation_region.dart index 7ca8447..1b42ef4 100644 --- a/lib/widgets/navigation/app_navigation_region.dart +++ b/lib/widgets/navigation/app_navigation_region.dart @@ -16,7 +16,7 @@ class AppNavigationRegion extends StatelessWidget { }); void _gotoChannel(Channel item) { - AppRouter.instance.pushReplacementNamed( + AppRouter.instance.goNamed( 'channelChat', pathParameters: {'alias': item.alias}, queryParameters: {