Compare commits
	
		
			3 Commits
		
	
	
		
			488055955c
			...
			14d55d45a8
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 14d55d45a8 | |||
| 724391584e | |||
| 3a5e45808a | 
| @@ -9,9 +9,11 @@ import 'package:shelf/shelf.dart'; | |||||||
| import 'package:shelf/shelf_io.dart' as shelf_io; | import 'package:shelf/shelf_io.dart' as shelf_io; | ||||||
| import 'package:shelf_web_socket/shelf_web_socket.dart'; | import 'package:shelf_web_socket/shelf_web_socket.dart'; | ||||||
| import 'package:web_socket_channel/web_socket_channel.dart'; | import 'package:web_socket_channel/web_socket_channel.dart'; | ||||||
| import 'ipc_server.dart'; |  | ||||||
| import 'ipc_server.windows.dart'; | // Conditional imports for IPC server - use web stubs on web platform | ||||||
| import 'ipc_server.unix.dart'; | 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 kRpcLogPrefix = 'arRPC.websocket'; | ||||||
| const String kRpcIpcLogPrefix = 'arRPC.ipc'; | const String kRpcIpcLogPrefix = 'arRPC.ipc'; | ||||||
|   | |||||||
							
								
								
									
										63
									
								
								lib/pods/activity/ipc_server.web.dart
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										63
									
								
								lib/pods/activity/ipc_server.web.dart
									
									
									
									
									
										Normal file
									
								
							| @@ -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<String, dynamic> data; | ||||||
|  |  | ||||||
|  |   IpcPacket(this.type, this.data); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | class IpcServer { | ||||||
|  |   Future<void> start() async {} | ||||||
|  |   Future<void> stop() async {} | ||||||
|  |   void Function(dynamic, dynamic, dynamic)? handlePacket; | ||||||
|  |   void addSocket(dynamic socket) {} | ||||||
|  |   void removeSocket(dynamic socket) {} | ||||||
|  |   List<dynamic> get sockets => []; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | class IpcSocketWrapper { | ||||||
|  |   String clientId = ''; | ||||||
|  |   bool handshook = false; | ||||||
|  |  | ||||||
|  |   void addData(List<int> data) {} | ||||||
|  |   void send(Map<String, dynamic> msg) {} | ||||||
|  |   void sendPong(dynamic data) {} | ||||||
|  |   void close() {} | ||||||
|  |   void closeWithCode(int code, [String message = '']) {} | ||||||
|  |   List<dynamic> readPackets() => []; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | class WindowsIpcServer extends IpcServer {} | ||||||
|  |  | ||||||
|  | class UnixIpcServer extends IpcServer {} | ||||||
|  |  | ||||||
|  | class WindowsIpcSocketWrapper extends IpcSocketWrapper {} | ||||||
| @@ -89,8 +89,7 @@ bool get _supportsAnalytics => | |||||||
|     kIsWeb || |     kIsWeb || | ||||||
|     Platform.isAndroid || |     Platform.isAndroid || | ||||||
|     Platform.isIOS || |     Platform.isIOS || | ||||||
|     Platform.isMacOS || |     Platform.isMacOS; | ||||||
|     Platform.isWindows; |  | ||||||
|  |  | ||||||
| // Provider for the router | // Provider for the router | ||||||
| final routerProvider = Provider<GoRouter>((ref) { | final routerProvider = Provider<GoRouter>((ref) { | ||||||
|   | |||||||
| @@ -9,6 +9,11 @@ String _parseRemoteError(DioException err) { | |||||||
|   String? message; |   String? message; | ||||||
|   if (err.response?.data is String) { |   if (err.response?.data is String) { | ||||||
|     message = err.response?.data; |     message = err.response?.data; | ||||||
|  |   } else if (err.response?.data?['message'] != null) { | ||||||
|  |     message = <String?>[ | ||||||
|  |       err.response?.data?['message']?.toString(), | ||||||
|  |       err.response?.data?['detail']?.toString(), | ||||||
|  |     ].where((e) => e != null).cast<String>().map((e) => e.trim()).join('\n'); | ||||||
|   } else if (err.response?.data?['errors'] != null) { |   } else if (err.response?.data?['errors'] != null) { | ||||||
|     final errors = err.response?.data['errors'] as Map<String, dynamic>; |     final errors = err.response?.data['errors'] as Map<String, dynamic>; | ||||||
|     message = errors.values |     message = errors.values | ||||||
|   | |||||||
| @@ -8,17 +8,26 @@ import 'package:easy_localization/easy_localization.dart'; | |||||||
|  |  | ||||||
| String _parseRemoteError(DioException err) { | String _parseRemoteError(DioException err) { | ||||||
|   log('${err.requestOptions.method} ${err.requestOptions.uri} ${err.message}'); |   log('${err.requestOptions.method} ${err.requestOptions.uri} ${err.message}'); | ||||||
|   if (err.response?.data is String) return err.response?.data; |   String? message; | ||||||
|   if (err.response?.data?['errors'] != null) { |   if (err.response?.data is String) { | ||||||
|  |     message = err.response?.data; | ||||||
|  |   } else if (err.response?.data?['message'] != null) { | ||||||
|  |     message = <String?>[ | ||||||
|  |       err.response?.data?['message']?.toString(), | ||||||
|  |       err.response?.data?['detail']?.toString(), | ||||||
|  |     ].where((e) => e != null).cast<String>().map((e) => e.trim()).join('\n'); | ||||||
|  |   } else if (err.response?.data?['errors'] != null) { | ||||||
|     final errors = err.response?.data['errors'] as Map<String, dynamic>; |     final errors = err.response?.data['errors'] as Map<String, dynamic>; | ||||||
|     return errors.values |     message = errors.values | ||||||
|         .map( |         .map( | ||||||
|           (ele) => |           (ele) => | ||||||
|               (ele as List<dynamic>).map((ele) => ele.toString()).join('\n'), |               (ele as List<dynamic>).map((ele) => ele.toString()).join('\n'), | ||||||
|         ) |         ) | ||||||
|         .join('\n'); |         .join('\n'); | ||||||
|   } |   } | ||||||
|   return err.message ?? err.toString(); |   if (message == null || message.isEmpty) message = err.response?.statusMessage; | ||||||
|  |   message ??= err.message; | ||||||
|  |   return message ?? err.toString(); | ||||||
| } | } | ||||||
|  |  | ||||||
| void showErrorAlert(dynamic err) async { | void showErrorAlert(dynamic err) async { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user