diff --git a/lib/pods/activity/activity_rpc.dart b/lib/pods/activity/activity_rpc.dart index 4438a7ca..6e93a9c1 100644 --- a/lib/pods/activity/activity_rpc.dart +++ b/lib/pods/activity/activity_rpc.dart @@ -9,9 +9,11 @@ import 'package:shelf/shelf.dart'; import 'package:shelf/shelf_io.dart' as shelf_io; import 'package:shelf_web_socket/shelf_web_socket.dart'; import 'package:web_socket_channel/web_socket_channel.dart'; -import 'ipc_server.dart'; -import 'ipc_server.windows.dart'; -import 'ipc_server.unix.dart'; + +// Conditional imports for IPC server - use web stubs on web platform +import 'ipc_server.dart' if (dart.library.html) 'ipc_server.web.dart'; +import 'ipc_server.windows.dart' if (dart.library.html) 'ipc_server.web.dart'; +import 'ipc_server.unix.dart' if (dart.library.html) 'ipc_server.web.dart'; const String kRpcLogPrefix = 'arRPC.websocket'; const String kRpcIpcLogPrefix = 'arRPC.ipc'; diff --git a/lib/pods/activity/ipc_server.web.dart b/lib/pods/activity/ipc_server.web.dart new file mode 100644 index 00000000..71c50d31 --- /dev/null +++ b/lib/pods/activity/ipc_server.web.dart @@ -0,0 +1,63 @@ +// Stub implementation for web platform +// This file provides empty implementations to avoid import errors on web + +// IPC Packet Types +class IpcTypes { + static const int handshake = 0; + static const int frame = 1; + static const int close = 2; + static const int ping = 3; + static const int pong = 4; +} + +// IPC Close Codes +class IpcCloseCodes { + static const int closeNormal = 1000; + static const int closeUnsupported = 1003; + static const int closeAbnormal = 1006; +} + +// IPC Error Codes +class IpcErrorCodes { + static const int invalidClientId = 4000; + static const int invalidOrigin = 4001; + static const int rateLimited = 4002; + static const int tokenRevoked = 4003; + static const int invalidVersion = 4004; + static const int invalidEncoding = 4005; +} + +// IPC Packet structure +class IpcPacket { + final int type; + final Map data; + + IpcPacket(this.type, this.data); +} + +class IpcServer { + Future start() async {} + Future stop() async {} + void Function(dynamic, dynamic, dynamic)? handlePacket; + void addSocket(dynamic socket) {} + void removeSocket(dynamic socket) {} + List get sockets => []; +} + +class IpcSocketWrapper { + String clientId = ''; + bool handshook = false; + + void addData(List data) {} + void send(Map msg) {} + void sendPong(dynamic data) {} + void close() {} + void closeWithCode(int code, [String message = '']) {} + List readPackets() => []; +} + +class WindowsIpcServer extends IpcServer {} + +class UnixIpcServer extends IpcServer {} + +class WindowsIpcSocketWrapper extends IpcSocketWrapper {}