no message

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

@ -49,7 +49,6 @@ import OpenTok
navVC.modalPresentationStyle = .fullScreen
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"/>
<color key="backgroundColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</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">
<rect key="frame" x="0.0" y="100" width="428" height="731"/>
<subviews>
@ -114,6 +107,13 @@
<constraint firstItem="XHG-Db-3Px" firstAttribute="top" secondItem="O5s-CJ-RFv" secondAttribute="top" constant="10" id="nM8-B7-soj"/>
</constraints>
</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">
<rect key="frame" x="0.0" y="831" width="428" height="95"/>
<subviews>
@ -333,7 +333,7 @@
<image name="end_call" width="488" height="488"/>
<image name="expand_video" width="202" height="199"/>
<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_unmute" width="198" height="202"/>
<image name="videoMutedIndicator" width="153.5" height="129"/>

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

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

@ -34,11 +34,11 @@ class VideoCallViewController: UIViewController {
var seconds = 30
var isUserConnect : Bool = false
var onMinimize:((Bool)->Void)? = nil
var onHide:(()->Void)? = nil
var onVideoDuration:((String)->Void)? = nil
var onClose:(()->Void)? = nil
var onFloat:((Bool)->Void)? = nil
var onMinimize:(()->Void)? = nil
var onCallConnect:(()->Void)? = nil
var onCallDisconnect:(()->Void)? = nil
@IBOutlet weak var lblRemoteUsername: UILabel!
@ -61,6 +61,7 @@ class VideoCallViewController: UIViewController {
@IBOutlet weak var remoteVideo: UIView!
@IBOutlet weak var localVideo: UIView!{
didSet{
localVideo.layer.borderColor = UIColor.white.cgColor
localVideoDraggable = localVideo?.superview as? AADraggableView
localVideoDraggable?.reposition = .edgesOnly
}
@ -74,7 +75,6 @@ class VideoCallViewController: UIViewController {
@IBAction func didClickMuteButton(_ sender: UIButton) {
sender.isSelected = !sender.isSelected
publisher!.publishAudio = !sender.isSelected
}
@IBAction func didClickSpeakerButton(_ sender: UIButton) {
@ -113,24 +113,24 @@ class VideoCallViewController: UIViewController {
}
@IBAction func hideVideoBtnTapped(_ sender: Any) {
onHide?()
onMinimize?()
}
var minimized = false
var floated = false
@IBAction func onMinimize(_ sender: UIButton) {
minimized = !minimized
onMinimize?(minimized)
sender.isSelected = minimized
floated = !floated
onFloat?(floated)
sender.isSelected = floated
NSLayoutConstraint.activate(minimized ? minimizeConstraint : maximisedConstraint)
NSLayoutConstraint.deactivate(minimized ? maximisedConstraint : minimizeConstraint)
localVideoDraggable?.enable(!minimized)
NSLayoutConstraint.activate(floated ? minimizeConstraint : maximisedConstraint)
NSLayoutConstraint.deactivate(floated ? maximisedConstraint : minimizeConstraint)
localVideoDraggable?.enable(!floated)
lblRemoteUsername.isHidden = minimized
hideVideoBtn.isHidden = !minimized
lblRemoteUsername.isHidden = floated
hideVideoBtn.isHidden = !floated
lblCallDuration.superview?.isHidden = !hideVideoBtn.isHidden
let min_ = minimized
let min_ = floated
UIView.animate(withDuration: 0.5) {
self.videoMuteBtn.isHidden = min_
self.micMuteBtn.isHidden = min_
@ -157,7 +157,6 @@ class VideoCallViewController: UIViewController {
let durationString = "\(mins):\(secs)"
self.lblCallDuration.text = durationString
self.onVideoDuration?(durationString)
}
}
@ -277,7 +276,8 @@ class VideoCallViewController: UIViewController {
dismiss(animated: true)
}
dismiss(animated: true)
onClose?()
onCallDisconnect?()
durationTimer?.invalidate()
}
func requestCameraPermissionsIfNeeded() {
@ -435,6 +435,7 @@ extension VideoCallViewController: OTSessionDelegate {
remoteVideo.addSubview(subscriberView)
startUpdateCallDuration()
onCallConnect?()
}
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:flutter/material.dart';
import 'package:hexcolor/hexcolor.dart';
import 'package:quiver/async.dart';
import '../../../../routes.dart';
@ -95,6 +96,23 @@ class _PatientProfileScreenState extends State<PatientProfileScreen>
_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
Widget build(BuildContext context) {
final screenSize = MediaQuery.of(context).size;
@ -112,9 +130,6 @@ class _PatientProfileScreenState extends State<PatientProfileScreen>
PatientProfileHeaderNewDesignAppBar(
patient, arrivalType ?? '0', patientType,
videoCallDurationStream: videoCallDurationStream,
onVideoDurationTap: (){
VideoChannel.show();
},
isInpatient: isInpatient,
isFromLiveCare: isFromLiveCare,
height: (patient.patientStatusType != null &&
@ -322,9 +337,7 @@ class _PatientProfileScreenState extends State<PatientProfileScreen>
onFailure: (String error) {
DrAppToastMsg.showErrorToast(error);
},
onVideoDuration: (duration){
videoCallDurationStreamController.sink.add(duration);
},
onCallConnected: callConnected,
onCallEnd: () {
var asd="";
// WidgetsBinding.instance.addPostFrameCallback((_) {

@ -12,18 +12,19 @@ class VideoChannel{
static const _channel = const MethodChannel("Dr.cloudSolution/videoCall");
static openVideoCallScreen({kApiKey, kSessionId, kToken, callDuration, warningDuration,int vcId,String tokenID,
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 ?? (){};
onVideoDuration = onVideoDuration ?? (v){};
onCallConnected = onCallConnected ?? (){};
onCallDisconnected = onCallDisconnected ?? (){};
var result;
try {
_channel.setMethodCallHandler((call) {
if(call.method == 'onHide'){
onHide();
}else if(call.method == 'onVideoDuration'){
onVideoDuration(call.arguments);
if(call.method == 'onCallConnected'){
onCallConnected();
}
if(call.method == 'onCallDisconnected'){
onCallDisconnected();
}
return true as dynamic;
});
@ -44,7 +45,6 @@ class VideoChannel{
);
if(result['callResponse'] == 'CallEnd') {
onCallEnd();
onVideoDuration(null);
}
else {
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("<(“[^”]*”|'[^]*|[^'”>])*>");
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 Stream<String> videoCallDurationStream;
final VoidCallback onVideoDurationTap;
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
Widget build(BuildContext context) {
@ -94,11 +93,9 @@ class PatientProfileHeaderNewDesignAppBar extends StatelessWidget
StreamBuilder(
stream: videoCallDurationStream,
builder: (BuildContext context, AsyncSnapshot<String> snapshot) {
if(snapshot.hasData)
if(snapshot.hasData && snapshot.data != null)
return InkWell(
onTap: (){
if(onVideoDurationTap != null)
onVideoDurationTap();
},
child: Container(
decoration: BoxDecoration(color: Colors.red, borderRadius: BorderRadius.circular(20)),

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

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

Loading…
Cancel
Save