Fix ios stats
This commit is contained in:
@@ -28,7 +28,7 @@ public class StatsEventHandler: NSObject, FlutterPlugin, FlutterStreamHandler, L
|
||||
self.events = events
|
||||
let opts = LibboxCommandClientOptions()
|
||||
opts.command = LibboxCommandStatus
|
||||
opts.statusInterval = 300
|
||||
opts.statusInterval = Int64(NSEC_PER_SEC)
|
||||
commandClient = LibboxCommandClient(self, options: opts)
|
||||
try? commandClient?.connect()
|
||||
return nil
|
||||
@@ -51,11 +51,7 @@ public class StatsEventHandler: NSObject, FlutterPlugin, FlutterStreamHandler, L
|
||||
"uplink-total": message.uplinkTotal,
|
||||
"downlink-total": message.downlinkTotal
|
||||
] as [String:Any]
|
||||
guard
|
||||
let json = try? JSONSerialization.data(withJSONObject: data),
|
||||
let json = String(data: json, encoding: .utf8)
|
||||
else { return }
|
||||
events?(json)
|
||||
events?(data)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -194,7 +194,9 @@ class PlatformSingboxService with InfraLogger implements SingboxService {
|
||||
if (event case Map<String, dynamic> _) {
|
||||
return SingboxStats.fromJson(event);
|
||||
}
|
||||
loggy.error("[stats client] unexpected type, msg: $event");
|
||||
loggy.error(
|
||||
"[stats client] unexpected type(${event.runtimeType}), msg: $event",
|
||||
);
|
||||
throw "invalid type";
|
||||
},
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user