From feb60b1ac7c7350adcef87658f7e85a478dd3ce1 Mon Sep 17 00:00:00 2001 From: littleGnAl Date: Sat, 12 Oct 2024 18:27:58 +0800 Subject: [PATCH] ++ --- .../agora_rtm_client_impl_override.dart | 5 +++-- .../agora_stream_channel_impl_override.dart | 10 +++++---- .../impl/agora_rtm_client_impl_override.dart | 22 ------------------- .../agora_rtm_client_impl_override_test.dart | 0 ...ora_stream_channel_impl_override_test.dart | 0 5 files changed, 9 insertions(+), 28 deletions(-) create mode 100644 test_shard/integration_test_app/test/agora_rtm_client_impl_override_test.dart create mode 100644 test_shard/integration_test_app/test/agora_stream_channel_impl_override_test.dart diff --git a/lib/src/bindings/agora_rtm_client_impl_override.dart b/lib/src/bindings/agora_rtm_client_impl_override.dart index a26a30a..e11ae29 100644 --- a/lib/src/bindings/agora_rtm_client_impl_override.dart +++ b/lib/src/bindings/agora_rtm_client_impl_override.dart @@ -228,10 +228,11 @@ class RtmClientImplOverride extends rtmc_binding.RtmClientImpl { required String message, required int length, required PublishOptions option}) async { + final messageUint8List = Uint8List.fromList(utf8.encode(message)); return publishBinaryMessage( channelName: channelName, - message: Uint8List.fromList(utf8.encode(message)), - length: length, + message: messageUint8List, + length: messageUint8List.length, option: option); } } diff --git a/lib/src/bindings/agora_stream_channel_impl_override.dart b/lib/src/bindings/agora_stream_channel_impl_override.dart index 81f2a7b..6e58f9b 100644 --- a/lib/src/bindings/agora_stream_channel_impl_override.dart +++ b/lib/src/bindings/agora_stream_channel_impl_override.dart @@ -44,10 +44,11 @@ class StreamChannelImpl extends sci_binding.StreamChannelImpl required String message, required int length, required TopicMessageOptions option}) async { + final messageUint8List = Uint8List.fromList(utf8.encode(message)); return publishBinaryMessage( topic: topic, - message: Uint8List.fromList(utf8.encode(message)), - length: length, + message: messageUint8List, + length: messageUint8List.length, option: option); } @@ -57,10 +58,11 @@ class StreamChannelImpl extends sci_binding.StreamChannelImpl required String message, required int length, required TopicMessageOptions option}) { + final messageUint8List = Uint8List.fromList(utf8.encode(message)); return publishBinaryMessage( topic: topic, - message: Uint8List.fromList(utf8.encode(message)), - length: length, + message: messageUint8List, + length: messageUint8List.length, option: option); } } diff --git a/lib/src/impl/agora_rtm_client_impl_override.dart b/lib/src/impl/agora_rtm_client_impl_override.dart index eb9fb46..ada31be 100644 --- a/lib/src/impl/agora_rtm_client_impl_override.dart +++ b/lib/src/impl/agora_rtm_client_impl_override.dart @@ -222,17 +222,6 @@ class RtmClientImplOverride extends rtm_client_impl.RtmClientImpl { String channelName, String message, {RtmChannelType channelType = RtmChannelType.message, String? customType}) async { - // final option = PublishOptions( - // channelType: channelType, - // messageType: RtmMessageType.string, - // customType: customType); - // final requestId = await nativeBindingRtmClientImpl.publish( - // channelName: channelName, - // message: message, - // length: message.length, - // option: option); - // return rtmResultHandler.request(requestId); - final option = PublishOptions( channelType: channelType, messageType: RtmMessageType.string, @@ -260,17 +249,6 @@ class RtmClientImplOverride extends rtm_client_impl.RtmClientImpl { String channelName, Uint8List message, {RtmChannelType channelType = RtmChannelType.message, String? customType}) async { - // final option = PublishOptions( - // channelType: channelType, - // messageType: RtmMessageType.binary, - // customType: customType); - // final requestId = await nativeBindingRtmClientImpl.publishBinaryMessage( - // channelName: channelName, - // message: message, - // length: message.length, - // option: option); - // return rtmResultHandler.request(requestId); - final option = PublishOptions( channelType: channelType, messageType: RtmMessageType.binary, diff --git a/test_shard/integration_test_app/test/agora_rtm_client_impl_override_test.dart b/test_shard/integration_test_app/test/agora_rtm_client_impl_override_test.dart new file mode 100644 index 0000000..e69de29 diff --git a/test_shard/integration_test_app/test/agora_stream_channel_impl_override_test.dart b/test_shard/integration_test_app/test/agora_stream_channel_impl_override_test.dart new file mode 100644 index 0000000..e69de29