no message

videocall_popup
Zohaib Iqbal Kambrani 5 years ago
parent 1b4988e5f0
commit f60ff85e31

@ -49,7 +49,6 @@ import OpenTok
navVC.modalPresentationStyle = .fullScreen navVC.modalPresentationStyle = .fullScreen
window.rootViewController?.present(navVC, animated: true, completion: nil) window.rootViewController?.present(navVC, animated: true, completion: nil)
} }
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 175 B

After

Width:  |  Height:  |  Size: 906 B

@ -41,13 +41,6 @@
<rect key="frame" x="0.0" y="0.0" width="428" height="926"/> <rect key="frame" x="0.0" y="0.0" width="428" height="926"/>
<color key="backgroundColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> <color key="backgroundColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</view> </view>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="videoMutedIndicator" translatesAutoresizingMaskIntoConstraints="NO" id="CL1-2v-m1L" userLabel="remoteVideoMutedIndicator">
<rect key="frame" x="154" y="413" width="120" height="100"/>
<constraints>
<constraint firstAttribute="width" constant="120" id="eon-3Z-74P"/>
<constraint firstAttribute="height" constant="100" id="iyK-hL-H3m"/>
</constraints>
</imageView>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="O5s-CJ-RFv" userLabel="DragableBoundryDefiner"> <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="O5s-CJ-RFv" userLabel="DragableBoundryDefiner">
<rect key="frame" x="0.0" y="100" width="428" height="731"/> <rect key="frame" x="0.0" y="100" width="428" height="731"/>
<subviews> <subviews>
@ -114,6 +107,13 @@
<constraint firstItem="XHG-Db-3Px" firstAttribute="top" secondItem="O5s-CJ-RFv" secondAttribute="top" constant="10" id="nM8-B7-soj"/> <constraint firstItem="XHG-Db-3Px" firstAttribute="top" secondItem="O5s-CJ-RFv" secondAttribute="top" constant="10" id="nM8-B7-soj"/>
</constraints> </constraints>
</view> </view>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="videoMutedIndicator" translatesAutoresizingMaskIntoConstraints="NO" id="CL1-2v-m1L" userLabel="remoteVideoMutedIndicator">
<rect key="frame" x="154" y="413" width="120" height="100"/>
<constraints>
<constraint firstAttribute="width" constant="120" id="eon-3Z-74P"/>
<constraint firstAttribute="height" constant="100" id="iyK-hL-H3m"/>
</constraints>
</imageView>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="sK0-tB-H9u" userLabel="controlButtons"> <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="sK0-tB-H9u" userLabel="controlButtons">
<rect key="frame" x="0.0" y="831" width="428" height="95"/> <rect key="frame" x="0.0" y="831" width="428" height="95"/>
<subviews> <subviews>
@ -333,7 +333,7 @@
<image name="end_call" width="488" height="488"/> <image name="end_call" width="488" height="488"/>
<image name="expand_video" width="202" height="199"/> <image name="expand_video" width="202" height="199"/>
<image name="float_video" width="202" height="202"/> <image name="float_video" width="202" height="202"/>
<image name="hide_video_icon" width="50" height="8"/> <image name="hide_video_icon" width="50" height="50"/>
<image name="mic_mute" width="198" height="199"/> <image name="mic_mute" width="198" height="199"/>
<image name="mic_unmute" width="198" height="202"/> <image name="mic_unmute" width="198" height="202"/>
<image name="videoMutedIndicator" width="153.5" height="129"/> <image name="videoMutedIndicator" width="153.5" height="129"/>

@ -35,8 +35,6 @@ class MainAppViewController: FlutterViewController{
switch call.method { switch call.method {
case "openVideoCall": case "openVideoCall":
self.startVideoCall(result: result, call: call) self.startVideoCall(result: result, call: call)
case "showVideo":
self.showVideo()
default: default:
result(FlutterMethodNotImplemented) result(FlutterMethodNotImplemented)
} }
@ -72,8 +70,10 @@ extension MainAppViewController : ICallProtocol{
} }
} }
private func showVideo(){ private func showVideo(show:Bool){
videoCallContainer.isHidden = false UIView.transition(with: view, duration: 0.5, options: .transitionCrossDissolve, animations: {
self.videoCallContainer.isHidden = !show
})
} }
private func startVideoCall(result: @escaping FlutterResult, call:FlutterMethodCall) { private func startVideoCall(result: @escaping FlutterResult, call:FlutterMethodCall) {
@ -82,17 +82,16 @@ extension MainAppViewController : ICallProtocol{
if let arguments = call.arguments as? NSDictionary{ if let arguments = call.arguments as? NSDictionary{
showVideoCallView(true) showVideoCallView(true)
videoCallViewController.onMinimize = { min in videoCallViewController.onFloat = { min in
self.minimizeVideoCall(min) self.floatVideoCallView(min)
} }
videoCallViewController.onHide = { videoCallViewController.onCallConnect = {
self.videoCallContainer.isHidden = true self.videoCallChannel?.invokeMethod("onCallConnected",arguments: nil)
self.videoCallChannel?.invokeMethod("onHide", arguments: nil)
} }
videoCallViewController.onVideoDuration = { duration in videoCallViewController.onCallDisconnect = {
self.videoCallChannel?.invokeMethod("onVideoDuration", arguments: duration) self.showVideoCallView(false)
self.videoCallChannel?.invokeMethod("onCallDisconnected",arguments: nil)
} }
videoCallViewController.onClose = videoCallClosed
videoCallViewController.callBack = self videoCallViewController.callBack = self
videoCallViewController.start(params: VideoCallRequestParameters(dictionary: arguments)) videoCallViewController.start(params: VideoCallRequestParameters(dictionary: arguments))
} }
@ -100,7 +99,7 @@ extension MainAppViewController : ICallProtocol{
} }
private func minimizeVideoCall(_ value:Bool){ private func floatVideoCallView(_ value:Bool){
videoCallContainer.enable(value) videoCallContainer.enable(value)
UIView.animate(withDuration: 0.5) { UIView.animate(withDuration: 0.5) {
@ -119,20 +118,11 @@ extension MainAppViewController : ICallProtocol{
} }
private func showVideoCallView(_ value:Bool){ private func showVideoCallView(_ value:Bool){
videoCallContainer.alpha = value ? 0.0 : 1
self.videoCallContainer.isHidden = !value
UIView.animate(withDuration: 0.5) { UIView.animate(withDuration: 0.5) {
self.videoCallContainer.alpha = value ? 1.0 : 0.0
} completion: { complete in
self.videoCallContainer.isHidden = !value self.videoCallContainer.isHidden = !value
} }
} }
private func videoCallClosed(){
showVideoCallView(false)
}
func sessionDone(res: Any) { func sessionDone(res: Any) {
videoCallFlutterResult?(res) videoCallFlutterResult?(res)
} }
@ -144,7 +134,6 @@ extension MainAppViewController : ICallProtocol{
func setVideoViewConstrints(){ func setVideoViewConstrints(){
let screen = UIScreen.main.bounds let screen = UIScreen.main.bounds
videoCallContainer.translatesAutoresizingMaskIntoConstraints = false videoCallContainer.translatesAutoresizingMaskIntoConstraints = false

@ -54,6 +54,7 @@ class ViewEmbedder {
let w = container.frame.size.width; let w = container.frame.size.width;
let h = container.frame.size.height; let h = container.frame.size.height;
child.view.frame = CGRect(x: 0, y: 0, width: w, height: h) child.view.frame = CGRect(x: 0, y: 0, width: w, height: h)
child.view.backgroundColor = UIColor.black
child.view.fill(to: container) child.view.fill(to: container)
} }

@ -34,11 +34,11 @@ class VideoCallViewController: UIViewController {
var seconds = 30 var seconds = 30
var isUserConnect : Bool = false var isUserConnect : Bool = false
var onMinimize:((Bool)->Void)? = nil var onFloat:((Bool)->Void)? = nil
var onHide:(()->Void)? = nil var onMinimize:(()->Void)? = nil
var onVideoDuration:((String)->Void)? = nil var onCallConnect:(()->Void)? = nil
var onClose:(()->Void)? = nil var onCallDisconnect:(()->Void)? = nil
@IBOutlet weak var lblRemoteUsername: UILabel! @IBOutlet weak var lblRemoteUsername: UILabel!
@ -61,6 +61,7 @@ class VideoCallViewController: UIViewController {
@IBOutlet weak var remoteVideo: UIView! @IBOutlet weak var remoteVideo: UIView!
@IBOutlet weak var localVideo: UIView!{ @IBOutlet weak var localVideo: UIView!{
didSet{ didSet{
localVideo.layer.borderColor = UIColor.white.cgColor
localVideoDraggable = localVideo?.superview as? AADraggableView localVideoDraggable = localVideo?.superview as? AADraggableView
localVideoDraggable?.reposition = .edgesOnly localVideoDraggable?.reposition = .edgesOnly
} }
@ -74,7 +75,6 @@ class VideoCallViewController: UIViewController {
@IBAction func didClickMuteButton(_ sender: UIButton) { @IBAction func didClickMuteButton(_ sender: UIButton) {
sender.isSelected = !sender.isSelected sender.isSelected = !sender.isSelected
publisher!.publishAudio = !sender.isSelected publisher!.publishAudio = !sender.isSelected
} }
@IBAction func didClickSpeakerButton(_ sender: UIButton) { @IBAction func didClickSpeakerButton(_ sender: UIButton) {
@ -113,24 +113,24 @@ class VideoCallViewController: UIViewController {
} }
@IBAction func hideVideoBtnTapped(_ sender: Any) { @IBAction func hideVideoBtnTapped(_ sender: Any) {
onHide?() onMinimize?()
} }
var minimized = false var floated = false
@IBAction func onMinimize(_ sender: UIButton) { @IBAction func onMinimize(_ sender: UIButton) {
minimized = !minimized floated = !floated
onMinimize?(minimized) onFloat?(floated)
sender.isSelected = minimized sender.isSelected = floated
NSLayoutConstraint.activate(minimized ? minimizeConstraint : maximisedConstraint) NSLayoutConstraint.activate(floated ? minimizeConstraint : maximisedConstraint)
NSLayoutConstraint.deactivate(minimized ? maximisedConstraint : minimizeConstraint) NSLayoutConstraint.deactivate(floated ? maximisedConstraint : minimizeConstraint)
localVideoDraggable?.enable(!minimized) localVideoDraggable?.enable(!floated)
lblRemoteUsername.isHidden = minimized lblRemoteUsername.isHidden = floated
hideVideoBtn.isHidden = !minimized hideVideoBtn.isHidden = !floated
lblCallDuration.superview?.isHidden = !hideVideoBtn.isHidden lblCallDuration.superview?.isHidden = !hideVideoBtn.isHidden
let min_ = minimized let min_ = floated
UIView.animate(withDuration: 0.5) { UIView.animate(withDuration: 0.5) {
self.videoMuteBtn.isHidden = min_ self.videoMuteBtn.isHidden = min_
self.micMuteBtn.isHidden = min_ self.micMuteBtn.isHidden = min_
@ -157,7 +157,6 @@ class VideoCallViewController: UIViewController {
let durationString = "\(mins):\(secs)" let durationString = "\(mins):\(secs)"
self.lblCallDuration.text = durationString self.lblCallDuration.text = durationString
self.onVideoDuration?(durationString)
} }
} }
@ -277,7 +276,8 @@ class VideoCallViewController: UIViewController {
dismiss(animated: true) dismiss(animated: true)
} }
dismiss(animated: true) dismiss(animated: true)
onClose?() onCallDisconnect?()
durationTimer?.invalidate()
} }
func requestCameraPermissionsIfNeeded() { func requestCameraPermissionsIfNeeded() {
@ -435,6 +435,7 @@ extension VideoCallViewController: OTSessionDelegate {
remoteVideo.addSubview(subscriberView) remoteVideo.addSubview(subscriberView)
startUpdateCallDuration() startUpdateCallDuration()
onCallConnect?()
} }
func setupSubscribe(_ stream: OTStream?) { func setupSubscribe(_ stream: OTStream?) {

@ -22,6 +22,7 @@ import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dar
import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart'; import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:hexcolor/hexcolor.dart'; import 'package:hexcolor/hexcolor.dart';
import 'package:quiver/async.dart';
import '../../../../routes.dart'; import '../../../../routes.dart';
@ -95,6 +96,23 @@ class _PatientProfileScreenState extends State<PatientProfileScreen>
_activeTab = 1; _activeTab = 1;
} }
StreamSubscription callTimer;
callConnected(){
callTimer = CountdownTimer(Duration(minutes: 1), Duration(seconds: 1)).listen(null)
..onDone(() {
callTimer.cancel();
})
..onData((data) {
var t = Helpers.timeFrom(duration: data.elapsed);
videoCallDurationStreamController.sink.add(t);
});
}
callDisconnected(){
callTimer.cancel();
videoCallDurationStreamController.sink.add(null);
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final screenSize = MediaQuery.of(context).size; final screenSize = MediaQuery.of(context).size;
@ -112,9 +130,6 @@ class _PatientProfileScreenState extends State<PatientProfileScreen>
PatientProfileHeaderNewDesignAppBar( PatientProfileHeaderNewDesignAppBar(
patient, arrivalType ?? '0', patientType, patient, arrivalType ?? '0', patientType,
videoCallDurationStream: videoCallDurationStream, videoCallDurationStream: videoCallDurationStream,
onVideoDurationTap: (){
VideoChannel.show();
},
isInpatient: isInpatient, isInpatient: isInpatient,
isFromLiveCare: isFromLiveCare, isFromLiveCare: isFromLiveCare,
height: (patient.patientStatusType != null && height: (patient.patientStatusType != null &&
@ -322,9 +337,7 @@ class _PatientProfileScreenState extends State<PatientProfileScreen>
onFailure: (String error) { onFailure: (String error) {
DrAppToastMsg.showErrorToast(error); DrAppToastMsg.showErrorToast(error);
}, },
onVideoDuration: (duration){ onCallConnected: callConnected,
videoCallDurationStreamController.sink.add(duration);
},
onCallEnd: () { onCallEnd: () {
var asd=""; var asd="";
// WidgetsBinding.instance.addPostFrameCallback((_) { // WidgetsBinding.instance.addPostFrameCallback((_) {

@ -12,18 +12,19 @@ class VideoChannel{
static const _channel = const MethodChannel("Dr.cloudSolution/videoCall"); static const _channel = const MethodChannel("Dr.cloudSolution/videoCall");
static openVideoCallScreen({kApiKey, kSessionId, kToken, callDuration, warningDuration,int vcId,String tokenID, static openVideoCallScreen({kApiKey, kSessionId, kToken, callDuration, warningDuration,int vcId,String tokenID,
String generalId,int doctorId, Function() onCallEnd , String generalId,int doctorId, Function() onCallEnd ,
Function(SessionStatusModel sessionStatusModel) onCallNotRespond ,Function(String error) onFailure, VoidCallback onHide, Function(String) onVideoDuration}) async { Function(SessionStatusModel sessionStatusModel) onCallNotRespond ,Function(String error) onFailure, VoidCallback onCallConnected, VoidCallback onCallDisconnected}) async {
onHide = onHide ?? (){}; onCallConnected = onCallConnected ?? (){};
onVideoDuration = onVideoDuration ?? (v){}; onCallDisconnected = onCallDisconnected ?? (){};
var result; var result;
try { try {
_channel.setMethodCallHandler((call) { _channel.setMethodCallHandler((call) {
if(call.method == 'onHide'){ if(call.method == 'onCallConnected'){
onHide(); onCallConnected();
}else if(call.method == 'onVideoDuration'){ }
onVideoDuration(call.arguments); if(call.method == 'onCallDisconnected'){
onCallDisconnected();
} }
return true as dynamic; return true as dynamic;
}); });
@ -44,7 +45,6 @@ class VideoChannel{
); );
if(result['callResponse'] == 'CallEnd') { if(result['callResponse'] == 'CallEnd') {
onCallEnd(); onCallEnd();
onVideoDuration(null);
} }
else { else {
SessionStatusModel sessionStatusModel = SessionStatusModel.fromJson(Platform.isIOS ?result['sessionStatus'] :json.decode(result['sessionStatus'])); SessionStatusModel sessionStatusModel = SessionStatusModel.fromJson(Platform.isIOS ?result['sessionStatus'] :json.decode(result['sessionStatus']));
@ -56,10 +56,6 @@ class VideoChannel{
} }
} }
static show(){
_channel.invokeMethod("showVideo");
}
} }

@ -270,4 +270,11 @@ class Helpers {
var htmlRegex = RegExp("<(“[^”]*”|'[^]*|[^'”>])*>"); var htmlRegex = RegExp("<(“[^”]*”|'[^]*|[^'”>])*>");
return htmlRegex.hasMatch(text); return htmlRegex.hasMatch(text);
} }
static String timeFrom({Duration duration}) {
String twoDigits(int n) => n.toString().padLeft(2, "0");
String twoDigitMinutes = twoDigits(duration.inMinutes.remainder(60));
String twoDigitSeconds = twoDigits(duration.inSeconds.remainder(60));
return "$twoDigitMinutes:$twoDigitSeconds";
}
} }

@ -22,10 +22,9 @@ class PatientProfileHeaderNewDesignAppBar extends StatelessWidget
final bool isFromLiveCare; final bool isFromLiveCare;
final Stream<String> videoCallDurationStream; final Stream<String> videoCallDurationStream;
final VoidCallback onVideoDurationTap;
PatientProfileHeaderNewDesignAppBar( PatientProfileHeaderNewDesignAppBar(
this.patient, this.patientType, this.arrivalType, {this.height = 0.0, this.isInpatient=false, this.isDischargedPatient=false, this.isFromLiveCare = false, this.videoCallDurationStream, this.onVideoDurationTap}); this.patient, this.patientType, this.arrivalType, {this.height = 0.0, this.isInpatient=false, this.isDischargedPatient=false, this.isFromLiveCare = false, this.videoCallDurationStream});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -94,11 +93,9 @@ class PatientProfileHeaderNewDesignAppBar extends StatelessWidget
StreamBuilder( StreamBuilder(
stream: videoCallDurationStream, stream: videoCallDurationStream,
builder: (BuildContext context, AsyncSnapshot<String> snapshot) { builder: (BuildContext context, AsyncSnapshot<String> snapshot) {
if(snapshot.hasData) if(snapshot.hasData && snapshot.data != null)
return InkWell( return InkWell(
onTap: (){ onTap: (){
if(onVideoDurationTap != null)
onVideoDurationTap();
}, },
child: Container( child: Container(
decoration: BoxDecoration(color: Colors.red, borderRadius: BorderRadius.circular(20)), decoration: BoxDecoration(color: Colors.red, borderRadius: BorderRadius.circular(20)),

@ -813,7 +813,7 @@ packages:
source: hosted source: hosted
version: "0.1.8" version: "0.1.8"
quiver: quiver:
dependency: transitive dependency: "direct main"
description: description:
name: quiver name: quiver
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"

@ -90,7 +90,7 @@ dependencies:
speech_to_text: speech_to_text:
path: speech_to_text path: speech_to_text
quiver: ^2.1.5
# Html Editor Enhanced # Html Editor Enhanced
html_editor_enhanced: ^1.3.0 html_editor_enhanced: ^1.3.0

Loading…
Cancel
Save