crashlytics fixes

master
haroon amjad 2 days ago
parent 99dfd2cea9
commit 285287e596

@ -255,11 +255,15 @@ class ImmediateLiveCareViewModel extends ChangeNotifier {
result.fold( result.fold(
(failure) async { (failure) async {
onError!(failure.message); if (onError != null) {
onError(failure.message);
}
}, },
(apiResponse) { (apiResponse) {
if (apiResponse.messageStatus == 2) { if (apiResponse.messageStatus == 2) {
onError!(apiResponse.errorMessage ?? "Unknown error occurred"); if (onError != null) {
onError(apiResponse.errorMessage ?? "Unknown error occurred");
}
// dialogService.showErrorDialog(message: apiResponse.errorMessage!, onOkPressed: () {}); // dialogService.showErrorDialog(message: apiResponse.errorMessage!, onOkPressed: () {});
} else if (apiResponse.messageStatus == 1) { } else if (apiResponse.messageStatus == 1) {
patientLiveCareHistoryList = apiResponse.data!; patientLiveCareHistoryList = apiResponse.data!;

@ -50,7 +50,7 @@ class LoginScreenState extends State<LoginScreen> {
// Clear errors when leaving login screen // Clear errors when leaving login screen
// Use post frame callback to avoid calling notifyListeners during dispose // Use post frame callback to avoid calling notifyListeners during dispose
WidgetsBinding.instance.addPostFrameCallback((_) { WidgetsBinding.instance.addPostFrameCallback((_) {
final authVm = context.read<AuthenticationViewModel>(); final authVm = getIt.get<AuthenticationViewModel>();
authVm.clearNationalIdError(); authVm.clearNationalIdError();
authVm.clearPhoneNumberError(); authVm.clearPhoneNumberError();
}); });

@ -17,6 +17,7 @@ import 'package:flutter_zoom_videosdk/native/zoom_videosdk_event_listener.dart';
import 'package:flutter_zoom_videosdk/native/zoom_videosdk_live_transcription_message_info.dart'; import 'package:flutter_zoom_videosdk/native/zoom_videosdk_live_transcription_message_info.dart';
import 'package:flutter_zoom_videosdk/native/zoom_videosdk_share_action.dart'; import 'package:flutter_zoom_videosdk/native/zoom_videosdk_share_action.dart';
import 'package:flutter_zoom_videosdk/native/zoom_videosdk_user.dart'; import 'package:flutter_zoom_videosdk/native/zoom_videosdk_user.dart';
import 'package:get_it/get_it.dart';
import 'package:hmg_patient_app_new/core/app_export.dart'; import 'package:hmg_patient_app_new/core/app_export.dart';
import 'package:hmg_patient_app_new/core/cache_consts.dart'; import 'package:hmg_patient_app_new/core/cache_consts.dart';
import 'package:hmg_patient_app_new/core/utils/jwt.dart'; import 'package:hmg_patient_app_new/core/utils/jwt.dart';
@ -26,6 +27,7 @@ import 'package:hmg_patient_app_new/generated/locale_keys.g.dart';
import 'package:hmg_patient_app_new/presentation/home/navigation_screen.dart'; import 'package:hmg_patient_app_new/presentation/home/navigation_screen.dart';
import 'package:hmg_patient_app_new/presentation/tele_consultation/zoom/video_view.dart'; import 'package:hmg_patient_app_new/presentation/tele_consultation/zoom/video_view.dart';
import 'package:hmg_patient_app_new/services/livecare_permission_service.dart'; import 'package:hmg_patient_app_new/services/livecare_permission_service.dart';
import 'package:hmg_patient_app_new/services/navigation_service.dart';
import 'package:hmg_patient_app_new/theme/colors.dart'; import 'package:hmg_patient_app_new/theme/colors.dart';
import 'package:hmg_patient_app_new/widgets/routes/custom_page_route.dart'; import 'package:hmg_patient_app_new/widgets/routes/custom_page_route.dart';
import 'package:image_picker/image_picker.dart'; import 'package:image_picker/image_picker.dart';
@ -326,12 +328,15 @@ class _CallScreenState extends State<CallScreen> {
// If no remote users remain, the other participant has left end the session // If no remote users remain, the other participant has left end the session
if (remoteUserList == null || remoteUserList.isEmpty) { if (remoteUserList == null || remoteUserList.isEmpty) {
await zoom.leaveSession(true); await zoom.leaveSession(true);
final navContext = GetIt.instance<NavigationService>().navigatorKey.currentContext;
if (navContext != null && Navigator.canPop(navContext)) {
Navigator.pushAndRemoveUntil( Navigator.pushAndRemoveUntil(
context, navContext,
CustomPageRoute( CustomPageRoute(
page: LandingNavigation(), page: LandingNavigation(),
), ),
(r) => false); (r) => false);
}
return; return;
} }
@ -522,15 +527,15 @@ class _CallScreenState extends State<CallScreen> {
), ),
); );
if (errorType == Errors.SessionJoinFailed || errorType == Errors.SessionDisconnecting) { if (errorType == Errors.SessionJoinFailed || errorType == Errors.SessionDisconnecting) {
Timer( // Timer(
const Duration(milliseconds: 1000), // const Duration(milliseconds: 1000),
() => { // () {
Navigator.popAndPushNamed( // Navigator.popAndPushNamed(
context, // context,
"Join", // "Join",
arguments: JoinArguments(args.isJoin, sessionName.value, sessionPassword.value, args.displayName, args.sessionIdleTimeoutMins, args.role), // arguments: JoinArguments(args.isJoin, sessionName.value, sessionPassword.value, args.displayName, args.sessionIdleTimeoutMins, args.role),
), // );
}); // });
} }
}); });

@ -30,17 +30,26 @@ class VideoView extends FlutterZoomView.ZoomView {
var isMounted = useIsMounted(); var isMounted = useIsMounted();
var zoom = ZoomVideoSdk(); var zoom = ZoomVideoSdk();
var isSharing = useState(false); var isSharing = useState(false);
user?.audioStatus?.isMuted().then((muted) => isMuted.value = muted);
useEffect(() { useEffect(() {
updateVideoStatus() { updateVideoStatus() async {
if (user == null) return; if (user == null) return;
Future<void>.microtask(() async { try {
if (isMounted()) { if (isMounted()) {
isVideoOn.value = (await user!.videoStatus!.isOn()); isVideoOn.value = (await user!.videoStatus!.isOn());
isSharing.value = sharing; isSharing.value = sharing;
// Update initial audio status safely
if (user!.audioStatus != null) {
var muted = await user!.audioStatus!.isMuted();
if (isMounted()) {
isMuted.value = muted;
}
}
}
} catch (e) {
// User might have left the session, ignore error
} }
});
} }
resetAudioStatus() { resetAudioStatus() {
@ -49,11 +58,13 @@ class VideoView extends FlutterZoomView.ZoomView {
} }
updateAudioStatus() async { updateAudioStatus() async {
if (!isMounted()) return; if (!isMounted() || user?.audioStatus == null) return;
var talking = await user?.audioStatus?.isTalking(); try {
var muted = await user?.audioStatus?.isMuted(); var talking = await user!.audioStatus!.isTalking();
isMuted.value = muted!; var muted = await user!.audioStatus!.isMuted();
isTalking.value = talking!; if (isMounted()) {
isMuted.value = muted;
isTalking.value = talking;
if (talking) { if (talking) {
Timer( Timer(
const Duration(milliseconds: SHOW_TALKING_ICON_DURATION), const Duration(milliseconds: SHOW_TALKING_ICON_DURATION),
@ -65,6 +76,10 @@ class VideoView extends FlutterZoomView.ZoomView {
}); });
} }
} }
} catch (e) {
// User might have left the session, ignore error
}
}
updateVideoStatus(); updateVideoStatus();
return null; return null;

@ -5,6 +5,7 @@ import 'package:flutter/material.dart';
import 'package:get_it/get_it.dart'; import 'package:get_it/get_it.dart';
import 'package:hmg_patient_app_new/core/app_assets.dart'; import 'package:hmg_patient_app_new/core/app_assets.dart';
import 'package:hmg_patient_app_new/core/app_export.dart'; import 'package:hmg_patient_app_new/core/app_export.dart';
import 'package:hmg_patient_app_new/core/dependencies.dart';
import 'package:hmg_patient_app_new/core/utils/calender_utils_new.dart'; import 'package:hmg_patient_app_new/core/utils/calender_utils_new.dart';
import 'package:hmg_patient_app_new/core/utils/utils.dart'; import 'package:hmg_patient_app_new/core/utils/utils.dart';
import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; import 'package:hmg_patient_app_new/extensions/string_extensions.dart';
@ -149,7 +150,10 @@ void showCommonBottomSheet(BuildContext context,
builder: (BuildContext context) { builder: (BuildContext context) {
if (isAutoDismiss) { if (isAutoDismiss) {
Future.delayed(Duration(seconds: 2), () { Future.delayed(Duration(seconds: 2), () {
Navigator.of(context).pop(); final navContext = getIt.get<NavigationService>().navigatorKey.currentContext;
if (navContext != null && Navigator.canPop(navContext)) {
Navigator.of(navContext).pop();
}
if (callBackFunc != null) { if (callBackFunc != null) {
callBackFunc(null); callBackFunc(null);
} }
@ -265,7 +269,10 @@ void showCommonBottomSheetWithoutHeight(
builder: (BuildContext context) { builder: (BuildContext context) {
if (isAutoDismiss) { if (isAutoDismiss) {
Future.delayed(Duration(seconds: 2), () { Future.delayed(Duration(seconds: 2), () {
Navigator.of(GetIt.instance<NavigationService>().navigatorKey.currentContext!).pop(); final navContext = GetIt.instance<NavigationService>().navigatorKey.currentContext;
if (navContext != null && Navigator.canPop(navContext)) {
Navigator.of(navContext).pop();
}
if (callBackFunc != null) { if (callBackFunc != null) {
callBackFunc(); callBackFunc();
} }

Loading…
Cancel
Save