pull/267/head
Sultan khan 15 hours ago
parent 5374110bff
commit 8a41b5716f

@ -58,6 +58,10 @@ _incomingCall(Map<String, dynamic> data) async {
String roomID = data['session_id'] ?? ''; String roomID = data['session_id'] ?? '';
String callTypeID = data['AppointmentNo'] ?? ''; String callTypeID = data['AppointmentNo'] ?? '';
print('🔍 Extracted from notification data:');
print(' - roomID (session_id): "$roomID"');
print(' - callTypeID (AppointmentNo): "$callTypeID"');
// Generate unique call ID // Generate unique call ID
var _currentUuid = Uuid().v4(); var _currentUuid = Uuid().v4();
_currentCallId = _currentUuid; _currentCallId = _currentUuid;
@ -70,6 +74,11 @@ _incomingCall(Map<String, dynamic> data) async {
await Utils.saveStringFromPrefs(CacheConst.callTypeID, callTypeID); await Utils.saveStringFromPrefs(CacheConst.callTypeID, callTypeID);
await Utils.saveBoolFromPrefs(CacheConst.isAppOpenedFromCall, true); await Utils.saveBoolFromPrefs(CacheConst.isAppOpenedFromCall, true);
print('💾 Saved to cache:');
print(' - CacheConst.zoomRoomID: "$roomID"');
print(' - CacheConst.callTypeID: "$callTypeID"');
print(' - CacheConst.isAppOpenedFromCall: true');
WidgetsFlutterBinding.ensureInitialized(); WidgetsFlutterBinding.ensureInitialized();
int callKitType = callTypeID == '2' ? 0 : 1; int callKitType = callTypeID == '2' ? 0 : 1;

@ -1120,7 +1120,7 @@ class AuthenticationViewModel extends ChangeNotifier {
_dialogService.showPhoneNumberPickerSheet( _dialogService.showPhoneNumberPickerSheet(
// label: "Where would you like to receive OTP?", // label: "Where would you like to receive OTP?",
label: LocaleKeys.receiveOtpToast.tr(), label: LocaleKeys.receiveOtpToast.tr(),
message: _appState.isArabic() ? "يرجى الاختيار من الخيارات أدناه لاستلام رمز التحقق." "Please select from the below options to receive OTP.", message: _appState.isArabic() ? "يرجى الاختيار من الخيارات أدناه لاستلام رمز التحقق.": "Please select from the below options to receive OTP.",
onSMSPress: () { onSMSPress: () {
checkUserAuthentication(otpTypeEnum: OTPTypeEnum.sms); checkUserAuthentication(otpTypeEnum: OTPTypeEnum.sms);
}, },

@ -1767,6 +1767,10 @@ abstract class LocaleKeys {
static const locationServicesDisabled = 'locationServicesDisabled'; static const locationServicesDisabled = 'locationServicesDisabled';
static const selectDateTimeKey = 'selectDateTimeKey'; static const selectDateTimeKey = 'selectDateTimeKey';
static const medicalKey = 'medicalKey'; static const medicalKey = 'medicalKey';
static const doctors2 = 'doctors2';
static const illurgyInfomation = 'illurgyInfomation';
static const vaccineInfomation = 'vaccineInfomation';
static const approvals1 = 'approvals1';
static const convertBloodcholesterolInfo = 'convertBloodcholesterolInfo'; static const convertBloodcholesterolInfo = 'convertBloodcholesterolInfo';
static const carbsAlert = 'carbsAlert'; static const carbsAlert = 'carbsAlert';
static const bodyFatAlert = 'bodyFatAlert'; static const bodyFatAlert = 'bodyFatAlert';
@ -1783,9 +1787,5 @@ abstract class LocaleKeys {
static const selectBloodDonationCity = 'selectBloodDonationCity'; static const selectBloodDonationCity = 'selectBloodDonationCity';
static const selectBloodDonationGender = 'selectBloodDonationGender'; static const selectBloodDonationGender = 'selectBloodDonationGender';
static const selectBloodType = 'selectBloodType'; static const selectBloodType = 'selectBloodType';
static const doctors2 = 'doctors2';
static const illurgyInfomation = 'illurgyInfomation';
static const vaccineInfomation = 'vaccineInfomation';
static const approvals1 = 'approvals1';
} }

@ -185,13 +185,28 @@ class _SplashScreenState extends State<SplashPage> {
case Event.actionCallDecline: case Event.actionCallDecline:
print('actionCallDecline Event Received: ------->'); print('actionCallDecline Event Received: ------->');
// Get session ID from cache // Try to get session ID from event data first
String sessionId = await Utils.getStringFromPrefs(CacheConst.zoomRoomID); String? sessionIdFromEvent = event.body['extra']?['roomID'];
//
// // Update session status to 3 (declined by patient) // Get session ID from cache as backup
// if (sessionId.isNotEmpty) { String sessionIdFromCache = await Utils.getStringFromPrefs(CacheConst.zoomRoomID);
// Use event data if available, otherwise use cache
String sessionId = (sessionIdFromEvent != null && sessionIdFromEvent.isNotEmpty)
? sessionIdFromEvent
: sessionIdFromCache;
print('🔍 Session ID from event: "$sessionIdFromEvent"');
print('🔍 Session ID from cache: "$sessionIdFromCache"');
print('🔍 Final session ID to use: "$sessionId"');
// Update session status to 3 (declined by patient)
if (sessionId.isNotEmpty) {
print('✅ Session ID found, calling API...');
await _updateSessionStatus(sessionId, 3, 'Patient'); await _updateSessionStatus(sessionId, 3, 'Patient');
// } } else {
print('⚠️ Session ID is empty, skipping API call');
}
await FlutterCallkitIncoming.endAllCalls(); await FlutterCallkitIncoming.endAllCalls();
GetIt.instance<CacheService>().remove(key: CacheConst.isAppOpenedFromCall); GetIt.instance<CacheService>().remove(key: CacheConst.isAppOpenedFromCall);
@ -243,9 +258,9 @@ class _SplashScreenState extends State<SplashPage> {
print('📡 Updating session status - SessionID: $sessionId, Status: $sessionStatus, EndedBy: $sessionEndedBy'); print('📡 Updating session status - SessionID: $sessionId, Status: $sessionStatus, EndedBy: $sessionEndedBy');
final apiClient = getIt.get<ApiClient>(); final apiClient = getIt.get<ApiClient>();
String sessionID = await Utils.getStringFromPrefs(CacheConst.zoomRoomID);
Map<String, dynamic> requestBody = { Map<String, dynamic> requestBody = {
"Open_SessionID": sessionID, "Open_SessionID": sessionId,
"SessionStatus": sessionStatus, "SessionStatus": sessionStatus,
"SessionEndedBy": sessionEndedBy "SessionEndedBy": sessionEndedBy
}; };

Loading…
Cancel
Save