|
|
|
@ -20,6 +20,7 @@ import io.flutter.plugins.GeneratedPluginRegistrant
|
|
|
|
class MainActivity : FlutterFragmentActivity(), MethodChannel.MethodCallHandler, VideoCallResponseListener {
|
|
|
|
class MainActivity : FlutterFragmentActivity(), MethodChannel.MethodCallHandler, VideoCallResponseListener {
|
|
|
|
|
|
|
|
|
|
|
|
private val CHANNEL = "Dr.cloudSolution/videoCall"
|
|
|
|
private val CHANNEL = "Dr.cloudSolution/videoCall"
|
|
|
|
|
|
|
|
private lateinit var methodChannel: MethodChannel
|
|
|
|
private var result: MethodChannel.Result? = null
|
|
|
|
private var result: MethodChannel.Result? = null
|
|
|
|
private var call: MethodCall? = null
|
|
|
|
private var call: MethodCall? = null
|
|
|
|
private val LAUNCH_VIDEO: Int = 1
|
|
|
|
private val LAUNCH_VIDEO: Int = 1
|
|
|
|
@ -29,15 +30,10 @@ class MainActivity : FlutterFragmentActivity(), MethodChannel.MethodCallHandler,
|
|
|
|
override fun configureFlutterEngine(@NonNull flutterEngine: FlutterEngine) {
|
|
|
|
override fun configureFlutterEngine(@NonNull flutterEngine: FlutterEngine) {
|
|
|
|
GeneratedPluginRegistrant.registerWith(flutterEngine)
|
|
|
|
GeneratedPluginRegistrant.registerWith(flutterEngine)
|
|
|
|
|
|
|
|
|
|
|
|
MethodChannel(flutterEngine.dartExecutor.binaryMessenger, CHANNEL).setMethodCallHandler(this)
|
|
|
|
methodChannel = MethodChannel(flutterEngine.dartExecutor.binaryMessenger, CHANNEL)
|
|
|
|
|
|
|
|
methodChannel.setMethodCallHandler(this)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
override fun onCreate(savedInstanceState: Bundle?) {
|
|
|
|
|
|
|
|
super.onCreate(savedInstanceState)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
override fun onMethodCall(call: MethodCall, result: MethodChannel.Result) {
|
|
|
|
override fun onMethodCall(call: MethodCall, result: MethodChannel.Result) {
|
|
|
|
|
|
|
|
|
|
|
|
this.result = result
|
|
|
|
this.result = result
|
|
|
|
@ -154,7 +150,6 @@ class MainActivity : FlutterFragmentActivity(), MethodChannel.MethodCallHandler,
|
|
|
|
} else if (resultCode == Activity.RESULT_CANCELED) {
|
|
|
|
} else if (resultCode == Activity.RESULT_CANCELED) {
|
|
|
|
val callResponse: HashMap<String, String> = HashMap()
|
|
|
|
val callResponse: HashMap<String, String> = HashMap()
|
|
|
|
callResponse["callResponse"] = "CallEnd"
|
|
|
|
callResponse["callResponse"] = "CallEnd"
|
|
|
|
|
|
|
|
|
|
|
|
result?.success(callResponse)
|
|
|
|
result?.success(callResponse)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -164,5 +159,12 @@ class MainActivity : FlutterFragmentActivity(), MethodChannel.MethodCallHandler,
|
|
|
|
// Toast.makeText(this, message, Toast.LENGTH_LONG).show()
|
|
|
|
// Toast.makeText(this, message, Toast.LENGTH_LONG).show()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
override fun minimizeVideoEvent(isMinimize: Boolean) {
|
|
|
|
|
|
|
|
if (isMinimize)
|
|
|
|
|
|
|
|
methodChannel.invokeMethod("onCallConnected", null)
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
methodChannel.invokeMethod("onCallDisconnected", null)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|