crashlytics fixes

master
haroon amjad 19 hours ago
parent 99dfd2cea9
commit 285287e596

@ -255,11 +255,15 @@ class ImmediateLiveCareViewModel extends ChangeNotifier {
result.fold(
(failure) async {
onError!(failure.message);
if (onError != null) {
onError(failure.message);
}
},
(apiResponse) {
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: () {});
} else if (apiResponse.messageStatus == 1) {
patientLiveCareHistoryList = apiResponse.data!;

@ -50,7 +50,7 @@ class LoginScreenState extends State<LoginScreen> {
// Clear errors when leaving login screen
// Use post frame callback to avoid calling notifyListeners during dispose
WidgetsBinding.instance.addPostFrameCallback((_) {
final authVm = context.read<AuthenticationViewModel>();
final authVm = getIt.get<AuthenticationViewModel>();
authVm.clearNationalIdError();
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_share_action.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/cache_consts.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/tele_consultation/zoom/video_view.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/widgets/routes/custom_page_route.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 (remoteUserList == null || remoteUserList.isEmpty) {
await zoom.leaveSession(true);
Navigator.pushAndRemoveUntil(
context,
CustomPageRoute(
page: LandingNavigation(),
),
(r) => false);
final navContext = GetIt.instance<NavigationService>().navigatorKey.currentContext;
if (navContext != null && Navigator.canPop(navContext)) {
Navigator.pushAndRemoveUntil(
navContext,
CustomPageRoute(
page: LandingNavigation(),
),
(r) => false);
}
return;
}
@ -522,15 +527,15 @@ class _CallScreenState extends State<CallScreen> {
),
);
if (errorType == Errors.SessionJoinFailed || errorType == Errors.SessionDisconnecting) {
Timer(
const Duration(milliseconds: 1000),
() => {
Navigator.popAndPushNamed(
context,
"Join",
arguments: JoinArguments(args.isJoin, sessionName.value, sessionPassword.value, args.displayName, args.sessionIdleTimeoutMins, args.role),
),
});
// Timer(
// const Duration(milliseconds: 1000),
// () {
// Navigator.popAndPushNamed(
// context,
// "Join",
// 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 zoom = ZoomVideoSdk();
var isSharing = useState(false);
user?.audioStatus?.isMuted().then((muted) => isMuted.value = muted);
useEffect(() {
updateVideoStatus() {
updateVideoStatus() async {
if (user == null) return;
Future<void>.microtask(() async {
try {
if (isMounted()) {
isVideoOn.value = (await user!.videoStatus!.isOn());
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() {
@ -49,20 +58,26 @@ class VideoView extends FlutterZoomView.ZoomView {
}
updateAudioStatus() async {
if (!isMounted()) return;
var talking = await user?.audioStatus?.isTalking();
var muted = await user?.audioStatus?.isMuted();
isMuted.value = muted!;
isTalking.value = talking!;
if (talking) {
Timer(
const Duration(milliseconds: SHOW_TALKING_ICON_DURATION),
() => {
if (isMounted())
{
isTalking.value = false,
}
});
if (!isMounted() || user?.audioStatus == null) return;
try {
var talking = await user!.audioStatus!.isTalking();
var muted = await user!.audioStatus!.isMuted();
if (isMounted()) {
isMuted.value = muted;
isTalking.value = talking;
if (talking) {
Timer(
const Duration(milliseconds: SHOW_TALKING_ICON_DURATION),
() => {
if (isMounted())
{
isTalking.value = false,
}
});
}
}
} catch (e) {
// User might have left the session, ignore error
}
}

@ -5,6 +5,7 @@ import 'package:flutter/material.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_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/utils.dart';
import 'package:hmg_patient_app_new/extensions/string_extensions.dart';
@ -149,7 +150,10 @@ void showCommonBottomSheet(BuildContext context,
builder: (BuildContext context) {
if (isAutoDismiss) {
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) {
callBackFunc(null);
}
@ -265,7 +269,10 @@ void showCommonBottomSheetWithoutHeight(
builder: (BuildContext context) {
if (isAutoDismiss) {
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) {
callBackFunc();
}

Loading…
Cancel
Save