import Flutter import UIKit import ComPDFKit_Conversion public class ConversionSDKFlutterPlugin : NSObject, FlutterPlugin { public static func register(with registrar: FlutterPluginRegistrar) { let channel = FlutterMethodChannel(name: "com.compdfkit.conversion.flutter.convert.sdk.info", binaryMessenger: registrar.messenger()) let instance = ConversionSDKFlutterPlugin() ConverFilePlugin(messenger: registrar.messenger()) registrar.addMethodCallDelegate(instance, channel: channel) } public func handle(_ call: FlutterMethodCall, result: @escaping FlutterResult) { print("method:\(call.method)"); if (call.method == "conversion_init"){ let initInfo = call.arguments as! [String: String]; let key = initInfo["key"] ?? ""; let secret = initInfo["secret"] ?? ""; print("conversion metthod channel init") print("init key:\(key)"); print("init secret:\(secret)"); ComPDFKit_Conversion.CPDFConvertKit.setLicenseKey( key, secret: secret); result("true") } else if (call.method == "sdk_build_tag"){ result(ComPDFKit_Conversion.CPDFConvertKit().versionString) } else if (call.method == "request_convert_output_path") { result(NSHomeDirectory() + "/Documents/ConversionDemo") } else if (call.method == "sdk_version"){ result(ComPDFKit_Conversion.CPDFConvertKit().versionString) } } }