diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index 0550eac7..dcd750d8 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -13,7 +13,8 @@ 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; - 9CE61EBD24AB366E008D68DD /* ViewControlleraa.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9CE61EBC24AB366E008D68DD /* ViewControlleraa.swift */; }; + 9CE61EBD24AB366E008D68DD /* VideoViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9CE61EBC24AB366E008D68DD /* VideoViewController.swift */; }; + 9CE61ECD24ADBB4C008D68DD /* ICallProtocoll.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9CE61ECC24ADBB4C008D68DD /* ICallProtocoll.swift */; }; B650DC3076E9D70CB188286A /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 93A5F83B23AB032D1E096663 /* Pods_Runner.framework */; }; /* End PBXBuildFile section */ @@ -46,7 +47,8 @@ 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 9CE61EBC24AB366E008D68DD /* ViewControlleraa.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewControlleraa.swift; sourceTree = ""; }; + 9CE61EBC24AB366E008D68DD /* VideoViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VideoViewController.swift; sourceTree = ""; }; + 9CE61ECC24ADBB4C008D68DD /* ICallProtocoll.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ICallProtocoll.swift; sourceTree = ""; }; 9D4B7DB43C6A6C849D2387CE /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; E698D7B14B12DF768FE47A1A /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; /* End PBXFileReference section */ @@ -115,7 +117,8 @@ 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, 74858FAE1ED2DC5600515810 /* AppDelegate.swift */, 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */, - 9CE61EBC24AB366E008D68DD /* ViewControlleraa.swift */, + 9CE61EBC24AB366E008D68DD /* VideoViewController.swift */, + 9CE61ECC24ADBB4C008D68DD /* ICallProtocoll.swift */, ); path = Runner; sourceTree = ""; @@ -282,8 +285,9 @@ buildActionMask = 2147483647; files = ( 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */, - 9CE61EBD24AB366E008D68DD /* ViewControlleraa.swift in Sources */, + 9CE61EBD24AB366E008D68DD /* VideoViewController.swift in Sources */, 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, + 9CE61ECD24ADBB4C008D68DD /* ICallProtocoll.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/ios/Runner/AppDelegate.swift b/ios/Runner/AppDelegate.swift index 5e32b165..e763b11d 100644 --- a/ios/Runner/AppDelegate.swift +++ b/ios/Runner/AppDelegate.swift @@ -6,7 +6,15 @@ import OpenTok // Copyright © 2020 Cloud. All rights reserved. @UIApplicationMain -@objc class AppDelegate: FlutterAppDelegate { +@objc class AppDelegate: FlutterAppDelegate ,ICallProtocol { + + var result: FlutterResult? + + + func sessionDone() { + self.result?("Session Done") + } + override func application( _ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? @@ -17,7 +25,8 @@ import OpenTok let videoCallChannel = FlutterMethodChannel(name: "Dr.cloudSolution/videoCall", binaryMessenger: controller.binaryMessenger) videoCallChannel.setMethodCallHandler({ - (call: FlutterMethodCall, result: @escaping FlutterResult) -> Void in + (call: FlutterMethodCall, result: @escaping FlutterResult) -> Void in + self.result = result switch call.method { case "openVideoCall": do { @@ -37,6 +46,7 @@ import OpenTok return super.application(application, didFinishLaunchingWithOptions: launchOptions) } + private func openVideoChat(result: FlutterResult,kApiKey: String, kSessionId: String,kToken: String,appLang:String) { @@ -48,6 +58,7 @@ import OpenTok videoVC.kApiKey=kApiKey videoVC.kSessionId=kSessionId videoVC.kToken=kToken + videoVC.callBack = self videoVC.navigationController?.setNavigationBarHidden(true, animated: false) navVC.modalPresentationStyle = .fullScreen window.rootViewController?.present(navVC, animated: true, completion: nil) diff --git a/ios/Runner/ICallProtocoll.swift b/ios/Runner/ICallProtocoll.swift new file mode 100644 index 00000000..1e267a17 --- /dev/null +++ b/ios/Runner/ICallProtocoll.swift @@ -0,0 +1,14 @@ +// +// ICallProtocol.swift +// Runner +// +// Created by Elham Rababah && Mohammad Aljammal on 7/2/20. +// Copyright © 2020 The Chromium Authors. All rights reserved. +// + +import Foundation + +protocol ICallProtocol { + + func sessionDone() +} diff --git a/ios/Runner/ViewControlleraa.swift b/ios/Runner/VideoViewController.swift similarity index 99% rename from ios/Runner/ViewControlleraa.swift rename to ios/Runner/VideoViewController.swift index 6e7c17f3..507e3d87 100644 --- a/ios/Runner/ViewControlleraa.swift +++ b/ios/Runner/VideoViewController.swift @@ -22,6 +22,8 @@ class ViewController: UIViewController { var kToken:String = "" + var callBack: ICallProtocol? + override func viewDidLoad() { super.viewDidLoad() @@ -33,7 +35,7 @@ class ViewController: UIViewController { setupSession() // Do any additional setup after loading the view. } - + func setupButtons() { perform(#selector(hideControlButtons), with: nil, afterDelay: 3) let tapGestureRecognizer = UITapGestureRecognizer(target: self, action: #selector(remoteVideoTapped(_:))) @@ -102,6 +104,7 @@ class ViewController: UIViewController { } @IBAction func hangUp(_ sender: UIButton) { + sessionDisconnect() } @@ -110,6 +113,7 @@ class ViewController: UIViewController { if (session != nil) { print("disconnecting....") session!.disconnect(nil) + callBack?.sessionDone() dismiss(animated: true) return } diff --git a/lib/screens/dashboard_screen.dart b/lib/screens/dashboard_screen.dart index ad64d89a..f972e5d3 100644 --- a/lib/screens/dashboard_screen.dart +++ b/lib/screens/dashboard_screen.dart @@ -101,10 +101,19 @@ class _DashboardScreenState extends State { crossAxisAlignment: CrossAxisAlignment.end, children: [ InkWell( - onTap: () { - showCupertinoPicker( - context: context, - actionList: authProvider.doctorsClinicList); + onTap: () async { + + var asd = await VideoChannel.openVideoCallScreen( + kToken: "T1==cGFydG5lcl9pZD00NjgwMzIyNCZzaWc9ZTUxZGI0NGJiNjhjOGY2YzZkZGVjNTQ0M2Q5ZDJkODY2MjBlYjJjYTpzZXNzaW9uX2lkPTJfTVg0ME5qZ3dNekl5Tkg1LU1UVTVNekEzTkRrMk1qUXhOSDVRZWt3clkxb3lhSGRuYmpWU2FFTmtlbWx2TkZWcWVFSi1mZyZjcmVhdGVfdGltZT0xNTkzMDc1MDA3Jm5vbmNlPTAuNjQ2OTA2MTAwMTU0ODY3NSZyb2xlPXB1Ymxpc2hlciZleHBpcmVfdGltZT0xNTkzNjc5ODA2JmluaXRpYWxfbGF5b3V0X2NsYXNzX2xpc3Q9", + kSessionId: '2_MX40NjgwMzIyNH5-MTU5MzA3NDk2MjQxNH5QekwrY1oyaHdnbjVSaENkemlvNFVqeEJ-fg', + kApiKey: '46803224' + ); + + print(asd); + + // showCupertinoPicker( + // context: context, + // actionList: authProvider.doctorsClinicList); }, child: Container( margin: