Call screen update

pull/288/head
haroon amjad 12 hours ago
parent df8ab0dab5
commit 514bf49956

@ -2,6 +2,7 @@ import 'dart:async';
import 'dart:convert';
import 'dart:io';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
@ -21,11 +22,14 @@ 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/utils.dart';
import 'package:hmg_patient_app_new/extensions/string_extensions.dart';
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/theme/colors.dart';
import 'package:hmg_patient_app_new/widgets/routes/custom_page_route.dart';
import 'package:image_picker/image_picker.dart';
import 'package:permission_handler/permission_handler.dart';
class CallScreen extends StatefulHookWidget {
const CallScreen({Key? key}) : super(key: key);
@ -607,32 +611,56 @@ class _CallScreenState extends State<CallScreen> {
}
void onPressAudio() async {
ZoomVideoSdkUser? mySelf = await zoom.session.getMySelf();
if (mySelf != null) {
final audioStatus = mySelf.audioStatus;
if (audioStatus != null) {
var muted = await audioStatus.isMuted();
if (muted) {
await zoom.audioHelper.unMuteAudio(mySelf.userId);
} else {
await zoom.audioHelper.muteAudio(mySelf.userId);
final statuses = await LiveCarePermissionService.instance.requestCameraMicAndNotification(context);
bool cameraGranted = statuses[Permission.camera]?.isGranted ?? false;
bool micGranted = statuses[Permission.microphone]?.isGranted ?? false;
if (cameraGranted && micGranted) {
ZoomVideoSdkUser? mySelf = await zoom.session.getMySelf();
if (mySelf != null) {
final audioStatus = mySelf.audioStatus;
if (audioStatus != null) {
var muted = await audioStatus.isMuted();
if (muted) {
await zoom.audioHelper.unMuteAudio(mySelf.userId);
} else {
await zoom.audioHelper.muteAudio(mySelf.userId);
}
}
}
} else {
await LiveCarePermissionService.instance.showOpenSettingsDialog(
context,
title: LocaleKeys.permissionsProfile.tr(),
message: LocaleKeys.liveCarePermissions.tr(),
);
}
}
void onPressVideo() async {
ZoomVideoSdkUser? mySelf = await zoom.session.getMySelf();
if (mySelf != null) {
final videoStatus = mySelf.videoStatus;
if (videoStatus != null) {
var videoOn = await videoStatus.isOn();
if (videoOn) {
await zoom.videoHelper.stopVideo();
} else {
await zoom.videoHelper.startVideo();
final statuses = await LiveCarePermissionService.instance.requestCameraMicAndNotification(context);
bool cameraGranted = statuses[Permission.camera]?.isGranted ?? false;
bool micGranted = statuses[Permission.microphone]?.isGranted ?? false;
if (cameraGranted && micGranted) {
ZoomVideoSdkUser? mySelf = await zoom.session.getMySelf();
if (mySelf != null) {
final videoStatus = mySelf.videoStatus;
if (videoStatus != null) {
var videoOn = await videoStatus.isOn();
if (videoOn) {
await zoom.videoHelper.stopVideo();
} else {
await zoom.videoHelper.startVideo();
}
}
}
} else {
await LiveCarePermissionService.instance.showOpenSettingsDialog(
context,
title: LocaleKeys.permissionsProfile.tr(),
message: LocaleKeys.liveCarePermissions.tr(),
);
}
}

Loading…
Cancel
Save