🚑 Fix cannot load ongoing call
This commit is contained in:
parent
c991590b27
commit
e4a5ac9d0a
@ -14,7 +14,8 @@ class Call {
|
|||||||
String externalId;
|
String externalId;
|
||||||
int founderId;
|
int founderId;
|
||||||
int channelId;
|
int channelId;
|
||||||
List<dynamic> participants;
|
@JsonKey(defaultValue: [])
|
||||||
|
List<dynamic>? participants;
|
||||||
Channel channel;
|
Channel channel;
|
||||||
|
|
||||||
Call({
|
Call({
|
||||||
|
@ -19,7 +19,7 @@ Call _$CallFromJson(Map<String, dynamic> json) => Call(
|
|||||||
externalId: json['external_id'] as String,
|
externalId: json['external_id'] as String,
|
||||||
founderId: (json['founder_id'] as num).toInt(),
|
founderId: (json['founder_id'] as num).toInt(),
|
||||||
channelId: (json['channel_id'] as num).toInt(),
|
channelId: (json['channel_id'] as num).toInt(),
|
||||||
participants: json['participants'] as List<dynamic>,
|
participants: json['participants'] as List<dynamic>? ?? [],
|
||||||
channel: Channel.fromJson(json['channel'] as Map<String, dynamic>),
|
channel: Channel.fromJson(json['channel'] as Map<String, dynamic>),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -98,6 +98,7 @@ class _ChannelChatScreenState extends State<ChannelChatScreen>
|
|||||||
setState(() => _ongoingCall = Call.fromJson(resp.body));
|
setState(() => _ongoingCall = Call.fromJson(resp.body));
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
print((e as dynamic).stackTrace);
|
||||||
context.showErrorDialog(e);
|
context.showErrorDialog(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,11 +53,11 @@ class ChannelCallIndicator extends StatelessWidget {
|
|||||||
return Text('callOngoingJoined'.trParams({
|
return Text('callOngoingJoined'.trParams({
|
||||||
'duration': call.lastDuration.value,
|
'duration': call.lastDuration.value,
|
||||||
}));
|
}));
|
||||||
} else if (ongoingCall.participants.isEmpty) {
|
} else if (ongoingCall.participants!.isEmpty) {
|
||||||
return Text('callOngoingEmpty'.tr);
|
return Text('callOngoingEmpty'.tr);
|
||||||
} else {
|
} else {
|
||||||
return Text('callOngoingParticipants'.trParams({
|
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) {
|
if (call.isInitialized.value) {
|
||||||
return const SizedBox.shrink();
|
return const SizedBox.shrink();
|
||||||
}
|
}
|
||||||
if (ongoingCall.participants.isNotEmpty) {
|
if (ongoingCall.participants!.isNotEmpty) {
|
||||||
return Container(
|
return Container(
|
||||||
height: 28,
|
height: 28,
|
||||||
constraints: const BoxConstraints(maxWidth: 120),
|
constraints: const BoxConstraints(maxWidth: 120),
|
||||||
child: AvatarStack(
|
child: AvatarStack(
|
||||||
height: 28,
|
height: 28,
|
||||||
borderWidth: 0,
|
borderWidth: 0,
|
||||||
avatars: ongoingCall.participants.map((x) {
|
avatars: ongoingCall.participants!.map((x) {
|
||||||
final userinfo =
|
final userinfo =
|
||||||
Account.fromJson(jsonDecode(x['metadata']));
|
Account.fromJson(jsonDecode(x['metadata']));
|
||||||
return PlatformInfo.canCacheImage
|
return PlatformInfo.canCacheImage
|
||||||
|
@ -16,7 +16,7 @@ class AppNavigationRegion extends StatelessWidget {
|
|||||||
});
|
});
|
||||||
|
|
||||||
void _gotoChannel(Channel item) {
|
void _gotoChannel(Channel item) {
|
||||||
AppRouter.instance.pushReplacementNamed(
|
AppRouter.instance.goNamed(
|
||||||
'channelChat',
|
'channelChat',
|
||||||
pathParameters: {'alias': item.alias},
|
pathParameters: {'alias': item.alias},
|
||||||
queryParameters: {
|
queryParameters: {
|
||||||
|
Loading…
Reference in New Issue
Block a user