mirror of https://github.com/CympleTech/ESSE.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
1.1 KiB
39 lines
1.1 KiB
import Flutter |
|
import UIKit |
|
|
|
public class SwiftEsseCorePlugin: NSObject, FlutterPlugin { |
|
public static func register(with registrar: FlutterPluginRegistrar) { |
|
let channel = FlutterMethodChannel(name: "esse_core", binaryMessenger: registrar.messenger()) |
|
let instance = SwiftEsseCorePlugin() |
|
registrar.addMethodCallDelegate(instance, channel: channel) |
|
} |
|
|
|
public func handle(_ call: FlutterMethodCall, result: @escaping FlutterResult) { |
|
let url = URL(string: "http://www.apple.com")! |
|
let task = URLSession.shared.dataTask(with: url) { data, response, error in |
|
|
|
} |
|
task.resume() |
|
|
|
switch call.method { |
|
case "getPlatformVersion": |
|
result("iOS " + UIDevice.current.systemVersion) |
|
case "daemon": |
|
guard let args = call.arguments else { |
|
return |
|
} |
|
if let myArgs = args as? [String: Any], |
|
let path = myArgs["path"] as? String |
|
{ |
|
DispatchQueue.global().async { |
|
start(path) |
|
} |
|
result("Daemon success") |
|
} else { |
|
result("Daemon path invalid") |
|
} |
|
default: |
|
result(FlutterMethodNotImplemented) |
|
} |
|
} |
|
}
|
|
|