Skip to content

Commit 36153b1

Browse files
feat: generate code (#220)
Generate code with the following content: base branch: dev_2109 public headers: rtm_2.2.5 > This pull request is trigger by bot, you can checkout this branch and update it. --------- Co-authored-by: ZGaopeng <ZGaopeng@users.noreply.github.com> Co-authored-by: Gopein <z_gaopeng@sina.com>
1 parent 41afe08 commit 36153b1

File tree

46 files changed

+1871
-1219
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+1871
-1219
lines changed

.github/workflows/on_pr_closed.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
# 3. The PR has `ci:prepare_release` label
1313
release_if_merged:
1414
if: ${{ github.event.pull_request.merged == true &&
15-
(github.event.pull_request.base.ref == 'main' || github.event.pull_request.base.ref == 'master') &&
15+
github.event.pull_request.base.ref == 'main' &&
1616
contains(github.event.pull_request.labels.*.name, 'ci:prepare_release') }}
1717
outputs:
1818
release_version: ${{steps.release.outputs.version}}

android/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ dependencies {
6868
println("Include libs/*jar for debugging.")
6969
api fileTree(dir: "libs", include: ["*.jar"])
7070
} else {
71-
api 'io.agora.rtm:iris-rtm:2.2.1-build.1'
72-
api 'io.agora:agora-rtm:2.2.1'
71+
api 'io.agora.rtm:iris-rtm:2.2.5-build.2'
72+
api 'io.agora:agora-rtm:2.2.5'
7373
}
7474
}
7575

example/lib/src/rtm_api_demo.dart

Lines changed: 81 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ class _RtmApiDemoState extends State<RtmApiDemo> {
3535

3636
bool _isWhoNowIncludeUserId = true;
3737
bool _isWhoNowIncludeState = false;
38+
bool _ispPolicyEnabled = false;
3839
late TextEditingController _isWhoNowPageController;
3940

4041
late TextEditingController _rtmClientMessageController;
@@ -46,6 +47,10 @@ class _RtmApiDemoState extends State<RtmApiDemo> {
4647

4748
late RtmClient _rtmClient;
4849
late RtcEngine _rtcEngine;
50+
bool _publishStoreInHistory = true;
51+
late TextEditingController _historyCountController;
52+
late TextEditingController _historyStartController;
53+
late TextEditingController _historyEndController;
4954

5055
@override
5156
void initState() {
@@ -60,6 +65,11 @@ class _RtmApiDemoState extends State<RtmApiDemo> {
6065
_isWhoNowPageController = TextEditingController();
6166
_rtmClientPublishCustomTypeController = TextEditingController();
6267
_keyValueInputGroupWidgetController = KeyValueInputGroupWidgetController();
68+
69+
_historyCountController = TextEditingController(text: '100');
70+
_historyStartController = TextEditingController(text: '0');
71+
_historyEndController = TextEditingController(text: '0');
72+
6373
}
6474

6575
@override
@@ -73,6 +83,9 @@ class _RtmApiDemoState extends State<RtmApiDemo> {
7383
_isWhoNowPageController.dispose();
7484
_rtmClientPublishCustomTypeController.dispose();
7585
_keyValueInputGroupWidgetController.dispose();
86+
_historyCountController.dispose();
87+
_historyStartController.dispose();
88+
_historyEndController.dispose();
7689
super.dispose();
7790
}
7891

@@ -158,8 +171,12 @@ class _RtmApiDemoState extends State<RtmApiDemo> {
158171
children: [
159172
_textField(_userIdController, 'Input user id'),
160173
_button('create RTM', () async {
161-
final (status, client) =
162-
await RTM(config.appId, _userIdController.text);
174+
final (status, client) = _ispPolicyEnabled
175+
? await RTM(config.appId, _userIdController.text,
176+
config: RtmConfig(
177+
ispPolicyEnabled: _ispPolicyEnabled,
178+
))
179+
: await RTM(config.appId, _userIdController.text);
163180
if (status.error) {
164181
logSink.log(
165182
'[error] errorCode: ${status.errorCode}, operation: ${status.operation}, reason: ${status.reason}');
@@ -193,6 +210,12 @@ class _RtmApiDemoState extends State<RtmApiDemo> {
193210
);
194211
await _rtmClient.setParameters('{"rtm.log_filter":2063}');
195212
}),
213+
_switch('ispPolicyEnabled', _ispPolicyEnabled, (v) {
214+
setState(() {
215+
_ispPolicyEnabled = v;
216+
});
217+
}),
218+
196219
_textField(_channelNameController, 'Input channel name'),
197220
_button('RtmClient.login', () async {
198221
final (status, _) = await _rtmClient.login(config.token);
@@ -406,25 +429,70 @@ class _RtmApiDemoState extends State<RtmApiDemo> {
406429
_rtmClientPublishCustomTypeController, 'Input customType'),
407430
_button('RtmClient.publish', () async {
408431
final (status, _) = await _rtmClient.publish(
409-
_channelNameController.text,
410-
_rtmClientMessageController.text,
411-
channelType: _rtmChannelType,
412-
customType: _rtmClientPublishCustomTypeController.text);
413-
432+
_channelNameController.text,
433+
_rtmClientMessageController.text,
434+
channelType: _rtmChannelType,
435+
customType: _rtmClientPublishCustomTypeController.text,
436+
storeInHistory: _publishStoreInHistory,
437+
);
414438
logSink.log('[PublishResult] errorCode: ${status.errorCode}');
415439
}),
416440
_button('RtmClient.publishBinaryMessage', () async {
417441
final (status, _) = await _rtmClient.publishBinaryMessage(
418-
_channelNameController.text,
419-
Uint8List.fromList(
420-
utf8.encode(_rtmClientMessageController.text)),
421-
channelType: _rtmChannelType,
422-
customType: _rtmClientPublishCustomTypeController.text);
423-
442+
_channelNameController.text,
443+
Uint8List.fromList(
444+
utf8.encode(_rtmClientMessageController.text)),
445+
channelType: _rtmChannelType,
446+
customType: _rtmClientPublishCustomTypeController.text,
447+
storeInHistory: _publishStoreInHistory,
448+
);
424449
logSink.log('[PublishResult] errorCode: ${status.errorCode}');
425450
}),
426451
],
427452
),
453+
_card(
454+
[
455+
Wrap(
456+
children: [
457+
_switch('storeInHistory', _publishStoreInHistory, (v) {
458+
setState(() => _publishStoreInHistory = v);
459+
}),
460+
],
461+
),
462+
_textField(_historyCountController, 'Input messageCount'),
463+
_textField(_historyStartController, 'Input start'),
464+
_textField(_historyEndController, 'Input end'),
465+
_button('RtmHistory.getMessages', () async {
466+
final history = _rtmClient.getHistory();
467+
468+
final (s2, result) = await history.getMessages(
469+
_channelNameController.text,
470+
_rtmChannelType,
471+
messageCount:
472+
int.tryParse(_historyCountController.text) ?? 100,
473+
start: int.tryParse(_historyStartController.text) ?? 0,
474+
end: int.tryParse(_historyEndController.text) ?? 0,
475+
);
476+
logSink.log('[getMessages] errorCode: ${s2.errorCode}, '
477+
'count: ${result?.count}, newStart: ${result?.newStart}');
478+
479+
for (final event in (result?.messageList ?? [])) {
480+
logSink.log('[history] publisher=${event.publisher}, '
481+
'type=${event.messageType}, customType=${event.customType}, '
482+
'ts=${event.timestamp}, message=${event.message}');
483+
if (event.messageType == RtmMessageType.string) {
484+
final messageText = utf8.decode(event.message!);
485+
logSink.log(
486+
'event : ${event.toJson()} \nmessage: $messageText');
487+
} else if (event.messageType == RtmMessageType.binary) {
488+
final binaryData = event.message;
489+
logSink.log(
490+
'event : ${event.toJson()} \n binaryData length: ${binaryData?.length}');
491+
}
492+
}
493+
}),
494+
],
495+
),
428496
_card(
429497
[
430498
const Text('Work with Agora Rtc Engine'),

ios/agora_rtm.podspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ Pod::Spec.new do |s|
2525
puts '[plugin_dev] Found .plugin_dev file, use vendored_frameworks instead.'
2626
s.vendored_frameworks = 'libs/*.xcframework'
2727
else
28-
s.dependency 'AgoraIrisRTM_iOS', '2.2.1-build.1'
29-
s.dependency 'AgoraRtm', '2.2.1'
28+
s.dependency 'AgoraIrisRTM_iOS', '2.2.5-build.2'
29+
s.dependency 'AgoraRtm', '2.2.5'
3030
end
3131

3232
# Flutter.framework does not contain a i386 slice.

0 commit comments

Comments
 (0)