mirror of
https://github.com/GopeedLab/gopeed.git
synced 2026-11-16 13:23:41 +00:00
feat: move native communication to FFI (#1457)
This commit is contained in:
86 files changed
+4558
-886
No files matched your search
@@ -19,6 +19,7 @@ import UIKit
|
||||
name: "gopeed.com/libgopeed",
|
||||
binaryMessenger: messenger
|
||||
)
|
||||
let taskEventForwarder = GopeedTaskEventForwarder(channel: libgopeedChannel)
|
||||
libgopeedChannel.setMethodCallHandler { call, result in
|
||||
switch call.method {
|
||||
case "start":
|
||||
@@ -41,6 +42,26 @@ import UIKit
|
||||
case "stop":
|
||||
LibgopeedStop()
|
||||
result(nil)
|
||||
case "getApiServerState":
|
||||
result(LibgopeedGetAPIServerState())
|
||||
case "startApiServer":
|
||||
result(LibgopeedStartAPIServer())
|
||||
case "stopApiServer":
|
||||
result(LibgopeedStopAPIServer())
|
||||
case "restartApiServer":
|
||||
result(LibgopeedRestartAPIServer())
|
||||
case "invoke":
|
||||
let arguments = call.arguments as? [String: Any]
|
||||
let method = arguments?["method"] as? String ?? ""
|
||||
let path = arguments?["path"] as? String ?? ""
|
||||
let query = arguments?["query"] as? String ?? ""
|
||||
let body = arguments?["body"] as? String ?? ""
|
||||
result(LibgopeedInvoke(method, path, query, body))
|
||||
case "subscribeTaskEvents":
|
||||
let arguments = call.arguments as? [String: Any]
|
||||
let mask = (arguments?["mask"] as? NSNumber)?.int64Value ?? 0
|
||||
GopeedSubscribeTaskEventsWithForwarder(mask, mask == 0 ? nil : taskEventForwarder)
|
||||
result(nil)
|
||||
default:
|
||||
result(FlutterMethodNotImplemented)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user