|
|
|
@ -6,6 +6,7 @@ import 'package:firebase_messaging/firebase_messaging.dart';
|
|
|
|
import 'package:flare_flutter/flare_actor.dart';
|
|
|
|
import 'package:flare_flutter/flare_actor.dart';
|
|
|
|
import 'package:flutter/foundation.dart';
|
|
|
|
import 'package:flutter/foundation.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
|
|
|
import 'package:flutter_callkit_incoming/entities/call_kit_params.dart';
|
|
|
|
import 'package:flutter_callkit_incoming/flutter_callkit_incoming.dart';
|
|
|
|
import 'package:flutter_callkit_incoming/flutter_callkit_incoming.dart';
|
|
|
|
import 'package:local_auth/local_auth.dart';
|
|
|
|
import 'package:local_auth/local_auth.dart';
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
@ -16,6 +17,8 @@ import 'package:test_sa/controllers/notification/firebase_notification_manger.da
|
|
|
|
import 'package:test_sa/controllers/providers/api/user_provider.dart';
|
|
|
|
import 'package:test_sa/controllers/providers/api/user_provider.dart';
|
|
|
|
import 'package:test_sa/controllers/providers/settings/setting_provider.dart';
|
|
|
|
import 'package:test_sa/controllers/providers/settings/setting_provider.dart';
|
|
|
|
import 'package:test_sa/extensions/widget_extensions.dart';
|
|
|
|
import 'package:test_sa/extensions/widget_extensions.dart';
|
|
|
|
|
|
|
|
import 'package:test_sa/modules/cx_module/chat/calling/audio_call_page.dart';
|
|
|
|
|
|
|
|
import 'package:test_sa/modules/cx_module/chat/model/chat_participant_model.dart';
|
|
|
|
import 'package:test_sa/new_views/app_style/app_color.dart';
|
|
|
|
import 'package:test_sa/new_views/app_style/app_color.dart';
|
|
|
|
import 'package:test_sa/new_views/common_widgets/app_lazy_loading.dart';
|
|
|
|
import 'package:test_sa/new_views/common_widgets/app_lazy_loading.dart';
|
|
|
|
import 'package:test_sa/new_views/pages/land_page/land_page.dart';
|
|
|
|
import 'package:test_sa/new_views/pages/land_page/land_page.dart';
|
|
|
|
@ -238,27 +241,27 @@ class _SplashPageState extends State<SplashPage> {
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
checkVoipCalling() async {
|
|
|
|
Future checkVoipCalling() async {
|
|
|
|
var activeCalls = await FlutterCallkitIncoming.activeCalls();
|
|
|
|
var activeCalls = await FlutterCallkitIncoming.activeCalls();
|
|
|
|
|
|
|
|
|
|
|
|
if (activeCalls is List && activeCalls.isNotEmpty) {
|
|
|
|
if (activeCalls is List && activeCalls.isNotEmpty) {
|
|
|
|
final lastCall = activeCalls.last;
|
|
|
|
CallKitParams lastCall = activeCalls.last;
|
|
|
|
|
|
|
|
if (lastCall.isAccepted) {
|
|
|
|
|
|
|
|
final String? callerId = lastCall.extra?['callerId'];
|
|
|
|
|
|
|
|
final String? callUuid = lastCall.id;
|
|
|
|
|
|
|
|
|
|
|
|
print("lastCall:$lastCall");
|
|
|
|
await FlutterCallkitIncoming.setCallConnected(callUuid!);
|
|
|
|
|
|
|
|
await Navigator.of(context).push(MaterialPageRoute(
|
|
|
|
// // Check if the last state recorded was an accepted call
|
|
|
|
builder: (_) => AudioCallPage(
|
|
|
|
// if (lastCall['isAccepted'] == true) {
|
|
|
|
sender: Participants(employeeNumber: lastCall.extra?["calleeEmployeeNumber"]),
|
|
|
|
// final String? callerId = lastCall['extra']['callerId'];
|
|
|
|
recipient: Participants(employeeNumber: lastCall.extra?["callerEmployeeNumber"]),
|
|
|
|
// final String? callUuid = lastCall['id'];
|
|
|
|
moduleId: int.parse(lastCall.extra!["moduleId"]),
|
|
|
|
//
|
|
|
|
isAccept: true)));
|
|
|
|
// await FlutterCallkitIncoming.setCallConnected(callUuid!);
|
|
|
|
FlutterCallkitIncoming.endCall(lastCall.extra?["callId"]);
|
|
|
|
//
|
|
|
|
FlutterCallkitIncoming.endAllCalls();
|
|
|
|
// // Route user to the calling interface
|
|
|
|
}
|
|
|
|
// Navigator.push(
|
|
|
|
} else {
|
|
|
|
// context,
|
|
|
|
await FlutterCallkitIncoming.endAllCalls();
|
|
|
|
// MaterialPageRoute(builder: (context) => InAppCallScreen(callerId: callerId)),
|
|
|
|
|
|
|
|
// );
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|