Pigeon: Removed MethodChannel
This commit is contained in:
parent
6dd7e3b8de
commit
1cf4e493d6
3 changed files with 4 additions and 30 deletions
|
|
@ -48,10 +48,6 @@ class FlutterCastFrameworkPlugin : FlutterPlugin, MethodCallHandler, ActivityAwa
|
|||
private fun onAttachedToEngine(applicationContext: Context, messenger: BinaryMessenger) {
|
||||
this.applicationContext = applicationContext
|
||||
|
||||
val methodChannel = MethodChannel(messenger, "flutter_cast_framework")
|
||||
methodChannel.setMethodCallHandler(this)
|
||||
channel = methodChannel
|
||||
|
||||
castApi = MyApi()
|
||||
HostApis.CastApi.setup(messenger, castApi)
|
||||
|
||||
|
|
@ -72,8 +68,6 @@ class FlutterCastFrameworkPlugin : FlutterPlugin, MethodCallHandler, ActivityAwa
|
|||
override fun onDetachedFromEngine(binding: FlutterPlugin.FlutterPluginBinding) {
|
||||
Log.d(TAG, "onDetachedFromEngine")
|
||||
applicationContext = null;
|
||||
channel?.setMethodCallHandler(null);
|
||||
channel = null;
|
||||
mMessageCastingChannel = null
|
||||
}
|
||||
//endregion
|
||||
|
|
@ -103,7 +97,6 @@ class FlutterCastFrameworkPlugin : FlutterPlugin, MethodCallHandler, ActivityAwa
|
|||
private lateinit var mSessionManager: SessionManager
|
||||
private val mSessionManagerListener = CastSessionManagerListener()
|
||||
|
||||
private var channel: MethodChannel? = null
|
||||
private var castApi : HostApis.CastApi? = null
|
||||
private var flutterApi: HostApis.CastFlutterApi? = null
|
||||
private var applicationContext: Context? = null
|
||||
|
|
|
|||
|
|
@ -5,11 +5,11 @@ import GoogleCast
|
|||
public class SwiftFlutterCastFrameworkPlugin: NSObject, FlutterPlugin, GCKSessionManagerListener, CastApi {
|
||||
public static func register(with registrar: FlutterPluginRegistrar) {
|
||||
let messenger : FlutterBinaryMessenger = registrar.messenger()
|
||||
|
||||
let channel = FlutterMethodChannel(name: "flutter_cast_framework", binaryMessenger: messenger)
|
||||
let flutterApi = CastFlutterApi.init(binaryMessenger: messenger)
|
||||
|
||||
let instance = SwiftFlutterCastFrameworkPlugin(channel: channel, flutterApi: flutterApi)
|
||||
let instance = SwiftFlutterCastFrameworkPlugin(flutterApi: flutterApi)
|
||||
|
||||
let channel = FlutterMethodChannel(name: "flutter_cast_framework_dummy_channel", binaryMessenger: messenger)
|
||||
registrar.addMethodCallDelegate(instance, channel: channel)
|
||||
|
||||
let api : CastApi & NSObjectProtocol = instance
|
||||
|
|
@ -18,7 +18,6 @@ public class SwiftFlutterCastFrameworkPlugin: NSObject, FlutterPlugin, GCKSessio
|
|||
|
||||
private let castContext: GCKCastContext
|
||||
private var castStateObserver: NSKeyValueObservation?
|
||||
private let channel: FlutterMethodChannel
|
||||
private let flutterApi : CastFlutterApi
|
||||
|
||||
private let sessionManager: GCKSessionManager
|
||||
|
|
@ -62,8 +61,7 @@ public class SwiftFlutterCastFrameworkPlugin: NSObject, FlutterPlugin, GCKSessio
|
|||
}
|
||||
}
|
||||
|
||||
init(channel: FlutterMethodChannel, flutterApi : CastFlutterApi) {
|
||||
self.channel = channel
|
||||
init(flutterApi : CastFlutterApi) {
|
||||
self.castContext = GCKCastContext.sharedInstance()
|
||||
self.sessionManager = GCKCastContext.sharedInstance().sessionManager
|
||||
|
||||
|
|
|
|||
|
|
@ -1,13 +1,9 @@
|
|||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_cast_framework/cast.dart';
|
||||
|
||||
import 'HostApis.dart';
|
||||
import 'cast/CastContext.dart';
|
||||
|
||||
class FlutterCastFramework {
|
||||
static const MethodChannel _channel =
|
||||
const MethodChannel('flutter_cast_framework');
|
||||
static final castApi = CastApi();
|
||||
|
||||
/// List of namespaces to listen for custom messages
|
||||
|
|
@ -17,19 +13,6 @@ class FlutterCastFramework {
|
|||
|
||||
static _init() {
|
||||
CastFlutterApi.setup(CastFlutterApiImpl());
|
||||
_channel.setMethodCallHandler((MethodCall call) async {
|
||||
String method = call.method;
|
||||
dynamic arguments = call.arguments;
|
||||
debugPrint("Method call on flutter: $method $arguments");
|
||||
|
||||
switch (method) {
|
||||
default:
|
||||
debugPrint("Method not handled: $method");
|
||||
break;
|
||||
}
|
||||
|
||||
return null;
|
||||
});
|
||||
}
|
||||
|
||||
static CastContext? _castContext;
|
||||
|
|
|
|||
Loading…
Reference in a new issue