mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2025-11-17 02:48:49 +00:00
35 lines
1.1 KiB
Swift
35 lines
1.1 KiB
Swift
import Flutter
|
|
import UIKit
|
|
|
|
public class SwiftFlowyInfraUiPlugin: NSObject, FlutterPlugin {
|
|
|
|
enum Constant {
|
|
static let infraUIMethodChannelName = "flowy_infra_ui_method"
|
|
static let infraUIKeyboardEventChannelName = "flowy_infra_ui_event/keyboard"
|
|
}
|
|
|
|
public static func register(with registrar: FlutterPluginRegistrar) {
|
|
let instance = SwiftFlowyInfraUiPlugin()
|
|
|
|
let methodChannel = FlutterMethodChannel(
|
|
name: Constant.infraUIMethodChannelName,
|
|
binaryMessenger: registrar.messenger())
|
|
registrar.addMethodCallDelegate(instance, channel: methodChannel)
|
|
|
|
let keyboardEventChannel = FlutterEventChannel(
|
|
name: Constant.infraUIKeyboardEventChannelName,
|
|
binaryMessenger: registrar.messenger())
|
|
keyboardEventChannel.setStreamHandler(KeyboardEventHandler())
|
|
}
|
|
|
|
// MARK: - Method Channel
|
|
|
|
public func handle(_ call: FlutterMethodCall, result: @escaping FlutterResult) {
|
|
switch call.method {
|
|
default:
|
|
assertionFailure("Unsupported method \(call.method)")
|
|
}
|
|
}
|
|
|
|
}
|