Browse Source

feat(call): 支持语音通话邀请弹框显示

- 扩展通话类型支持,同时处理视频和语音通话
- 添加通话类型参数传递到邀请弹框组件
- 根据通话类型动态显示相应的邀请文案
- 优化通话页面中邀请文字的判断逻辑
master
Jolie 3 months ago
parent
commit
0ec1631eee
3 changed files with 7 additions and 4 deletions
  1. 2
      lib/im/im_manager.dart
  2. 5
      lib/pages/message/video_call_page.dart
  3. 4
      lib/widget/message/video_call_invite_dialog.dart

2
lib/im/im_manager.dart

@ -1453,7 +1453,7 @@ class IMManager {
// //
if (callInfo != null && callType != null && callStatus != null) { if (callInfo != null && callType != null && callStatus != null) {
// missed calling // missed calling
if (callType == 'video' && (callStatus == 'missed' || callStatus == 'calling')) {
if ((callType == 'video' || callType == 'voice') && (callStatus == 'missed' || callStatus == 'calling')) {
// //
Map<String, dynamic>? attributes; Map<String, dynamic>? attributes;
try { try {

5
lib/pages/message/video_call_page.dart

@ -19,12 +19,14 @@ import '../../model/home/marriage_data.dart';
/// ///
class VideoCallPage extends StatefulWidget { class VideoCallPage extends StatefulWidget {
final String targetUserId; final String targetUserId;
final String? callType;
final MarriageData? userData; final MarriageData? userData;
final bool isInitiator; // final bool isInitiator; //
const VideoCallPage({ const VideoCallPage({
super.key, super.key,
required this.targetUserId, required this.targetUserId,
this.callType,
this.userData, this.userData,
this.isInitiator = true, this.isInitiator = true,
}); });
@ -401,8 +403,7 @@ class _VideoCallPageState extends State<VideoCallPage> {
Widget _buildCallDuration() { Widget _buildCallDuration() {
// //
if (!widget.isInitiator && !_isCallConnected) { if (!widget.isInitiator && !_isCallConnected) {
final callSession = _callController.currentCall.value;
final isVideoCall = callSession != null && callSession.callType == CallType.video;
final isVideoCall = widget.callType == 'video';
final inviteText = isVideoCall ? '邀请你视频通话' : '邀请你语音通话'; final inviteText = isVideoCall ? '邀请你视频通话' : '邀请你语音通话';
return Positioned( return Positioned(

4
lib/widget/message/video_call_invite_dialog.dart

@ -7,6 +7,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
class VideoCallInviteDialog extends StatelessWidget { class VideoCallInviteDialog extends StatelessWidget {
final String avatarUrl; final String avatarUrl;
final String nickName; final String nickName;
final String? callType;
final VoidCallback? onTap; // final VoidCallback? onTap; //
final VoidCallback? onAccept; // final VoidCallback? onAccept; //
final VoidCallback? onReject; // final VoidCallback? onReject; //
@ -15,6 +16,7 @@ class VideoCallInviteDialog extends StatelessWidget {
super.key, super.key,
required this.avatarUrl, required this.avatarUrl,
required this.nickName, required this.nickName,
this.callType,
this.onTap, this.onTap,
this.onAccept, this.onAccept,
this.onReject, this.onReject,
@ -93,7 +95,7 @@ class VideoCallInviteDialog extends StatelessWidget {
SizedBox(height: 4.h), SizedBox(height: 4.h),
// //
Text( Text(
'邀请你视频通话',
'邀请你${callType == 'video' ? '视频' : '语音'}通话',
style: TextStyle( style: TextStyle(
fontSize: 13.sp, fontSize: 13.sp,
color: Colors.white.withOpacity(0.8), color: Colors.white.withOpacity(0.8),

Loading…
Cancel
Save