Skip to content

Commit

Permalink
feat: support native 2.1.1.12 (#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
guoxianzhe authored Jun 28, 2024
1 parent 34b3c4c commit 35cfdf3
Show file tree
Hide file tree
Showing 15 changed files with 130 additions and 84 deletions.
44 changes: 10 additions & 34 deletions .github/workflows/terra.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,49 +2,29 @@ name: Generate codes

on:
workflow_dispatch:
inputs:
terra-ref:
description: The terra repo ref
required: true
default: 'main'

jobs:
generate-codes:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}

- name: Setup
uses: ./.github/actions/setup

- name: Generate codes
id: terra
uses: AgoraIO-Extensions/actions/.github/actions/terra@main
env:
LLVM_DOWNLOAD_URL: |
https://github.com/llvm/llvm-project/releases/download/llvmorg-15.0.6/clang+llvm-15.0.6-x86_64-linux-gnu-ubuntu-18.04.tar.xz
- name: Generate code and comment by terra
uses: AgoraIO-Extensions/actions/.github/actions/generate@main
with:
github-token: ${{ secrets.GH_TOKEN }}
terra-ref: ${{ inputs.terra-ref }}
config: ci/config/terra_config.yaml
output-dir: src
export-file-path: src/index.ts

- name: Format codes
run: |
rm -rf terra
yarn lint --fix
- name: Generate ts interface
run: |
yarn
- name: Generate comments
uses: ./.github/actions/doc
with:
github-token: ${{ secrets.GH_TOKEN }}
target-path: ${{ github.workspace }}
generate-code: true
generate-comment: true
generate-code-command: |
sh generate-prepare.sh
sh generate-code.sh
- name: Create pull request
uses: AgoraIO-Extensions/actions/.github/actions/pr@main
Expand All @@ -55,8 +35,4 @@ jobs:
target-branch-name-surffix: terra-update
pull-request-title: |
[AUTO] Generate codes by terra
pull-request-body: |
Terra configuration:
${{ steps.terra.outputs.configuration }}
add-paths: src
4 changes: 2 additions & 2 deletions agora-react-native-rtm.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ Pod::Spec.new do |s|
end
end

s.dependency 'AgoraRtm_iOS', '2.1.7'
s.dependency 'AgoraIrisRTM_iOS', '2.1.7-build.1'
s.dependency 'AgoraRtm_iOS', '2.1.12'
s.dependency 'AgoraIrisRTM_iOS', '2.1.12-dev.1'
s.libraries = 'stdc++'
s.framework = 'ReplayKit'
end
4 changes: 2 additions & 2 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,8 @@ dependencies {
//noinspection GradleDynamicVersion
implementation "com.facebook.react:react-native:+"
implementation fileTree(include: ['*.jar', '*.aar'], dir: 'libs')
implementation "io.agora:agora-rtm:2.1.7"
implementation "io.agora.rtm:iris-rtm:2.1.7-build.1"
implementation "io.agora:agora-rtm:2.1.12"
implementation "io.agora.rtm:iris-rtm:2.1.12-dev.1"

}

Expand Down
16 changes: 8 additions & 8 deletions example/ios/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
PODS:
- agora-react-native-rtm (2.1.7):
- AgoraIrisRTM_iOS (= 2.1.7-build.1)
- AgoraRtm_iOS (= 2.1.7)
- agora-react-native-rtm (2.1.12):
- AgoraIrisRTM_iOS (= 2.1.12-dev.1)
- AgoraRtm_iOS (= 2.1.12)
- RCT-Folly (= 2021.07.22.00)
- React-Core
- AgoraIrisRTC_iOS (4.3.1-build.1)
- AgoraIrisRTM_iOS (2.1.7-build.1)
- AgoraIrisRTM_iOS (2.1.12-dev.1)
- AgoraRtcEngine_iOS (4.3.1):
- AgoraRtcEngine_iOS/AIAEC (= 4.3.1)
- AgoraRtcEngine_iOS/AINS (= 4.3.1)
Expand Down Expand Up @@ -41,7 +41,7 @@ PODS:
- AgoraRtcEngine_iOS/VideoCodecEnc (4.3.1)
- AgoraRtcEngine_iOS/VirtualBackground (4.3.1)
- AgoraRtcEngine_iOS/VQA (4.3.1)
- AgoraRtm_iOS (2.1.7)
- AgoraRtm_iOS (2.1.12)
- boost (1.76.0)
- CocoaAsyncSocket (7.6.5)
- DoubleConversion (1.1.6)
Expand Down Expand Up @@ -754,11 +754,11 @@ EXTERNAL SOURCES:
:path: "../node_modules/react-native/ReactCommon/yoga"

SPEC CHECKSUMS:
agora-react-native-rtm: db09801b83ccbde861b8261e00bc46a03f8f4136
agora-react-native-rtm: feac636a75ebb40a3c29072a823d8442babdc87b
AgoraIrisRTC_iOS: 7710d853202eca4900c2916aefc44abd5a139d4e
AgoraIrisRTM_iOS: 588c042feef52bb2545e3618da1e442f19e2cf5b
AgoraIrisRTM_iOS: 8333f60aeee673e88fcf02a0f627484f21731f67
AgoraRtcEngine_iOS: f64be00fdda786bb7edd84ab461c31b7b4c93534
AgoraRtm_iOS: cd26cf8a377a79934864d37e184866dbd1430eaf
AgoraRtm_iOS: 54dbd6c1f33f1d7432becf1d271713bcc35653cb
boost: 57d2868c099736d80fcd648bf211b4431e51a558
CocoaAsyncSocket: 065fd1e645c7abab64f7a6a2007a48038fdc6a99
DoubleConversion: 5189b271737e1565bdce30deb4a08d647e3f5f54
Expand Down
1 change: 1 addition & 0 deletions example/src/advanced/ChannelMetadata/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,7 @@ export default function ChannelMetadata() {
onChangeText={(text) => {
if (!text) return;
setMajorRevision(parseInt(text, 10));
metadata.current.majorRevision = parseInt(text, 10);
}}
label="majorRevision"
value={majorRevision.toString()}
Expand Down
12 changes: 10 additions & 2 deletions example/src/advanced/UseRTC/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@ import {
import React, { useCallback, useEffect, useState } from 'react';

import { KeyboardAvoidingView, Platform, ScrollView } from 'react-native';
import { ChannelProfileType, createAgoraRtcEngine } from 'react-native-agora';
import {
ChannelProfileType,
SDKBuildInfo,
createAgoraRtcEngine,
} from 'react-native-agora';

import {
AgoraButton,
Expand All @@ -24,7 +28,10 @@ import * as log from '../../utils/log';

export default function UseRTC() {
const [uid, setUid] = useState(Config.uid);
const [rtcVersion, setRtcVersion] = useState(Config.uid);
const [rtcVersion, setRtcVersion] = useState<SDKBuildInfo>({
version: '',
build: 0,
});
const [loginSuccess, setLoginSuccess] = useState(false);
const [initResult, setInitResult] = useState<number>(0);
const onLoginResult = useCallback((errorCode: RTM_ERROR_CODE) => {
Expand Down Expand Up @@ -126,6 +133,7 @@ export default function UseRTC() {

useEffect(() => {
let engine = createAgoraRtcEngine();
console.log(engine.getVersion());
engine.initialize({
appId: Config.appId,
channelProfile: ChannelProfileType.ChannelProfileLiveBroadcasting,
Expand Down
1 change: 1 addition & 0 deletions example/src/advanced/UserMetadata/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,7 @@ export default function UserMetadata() {
onChangeText={(text) => {
if (!text) return;
setMajorRevision(parseInt(text, 10));
metadata.current.majorRevision = parseInt(text, 10);
}}
label="majorRevision"
value={majorRevision.toString()}
Expand Down
31 changes: 27 additions & 4 deletions example/src/advanced/publishMessage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,38 @@ import { Buffer } from 'buffer';
import {
MessageEvent,
PublishOptions,
RTM_CHANNEL_TYPE,
RTM_CONNECTION_CHANGE_REASON,
RTM_CONNECTION_STATE,
RTM_ERROR_CODE,
RTM_MESSAGE_TYPE,
RTM_PROXY_TYPE,
} from 'agora-react-native-rtm';
import React, { useCallback, useEffect, useState } from 'react';
import { GiftedChat } from 'react-native-gifted-chat';

import BaseComponent from '../../components/BaseComponent';
import { AgoraButton, AgoraStyle, AgoraView } from '../../components/ui';
import {
AgoraButton,
AgoraDivider,
AgoraDropdown,
AgoraStyle,
AgoraView,
} from '../../components/ui';
import Config from '../../config/agora.config';
import { useRtmClient } from '../../hooks/useRtmClient';
import { AgoraMessage } from '../../types';
import * as log from '../../utils/log';
import { enumToItems } from '../../utils';

export default function PublishMessage() {
const [loginSuccess, setLoginSuccess] = useState(false);
const [subscribeSuccess, setSubscribeSuccess] = useState(false);
const [publishMessageByBuffer, setPublishMessageByBuffer] = useState(false);
const [cName, setCName] = useState<string>(Config.channelName);
const [channelType, setChannelType] = useState<number>(
RTM_CHANNEL_TYPE.RTM_CHANNEL_TYPE_MESSAGE
);
const [uid, setUid] = useState<string>(Config.uid);
const [messages, setMessages] = useState<AgoraMessage[]>([]);

Expand Down Expand Up @@ -101,7 +113,8 @@ export default function PublishMessage() {
Buffer.from(msg.text),
msg.text?.length,
new PublishOptions({
type: RTM_MESSAGE_TYPE.RTM_MESSAGE_TYPE_BINARY,
channelType: channelType,
messageType: RTM_MESSAGE_TYPE.RTM_MESSAGE_TYPE_BINARY,
})
);
} else {
Expand All @@ -110,7 +123,8 @@ export default function PublishMessage() {
msg.text,
msg.text?.length,
new PublishOptions({
type: RTM_MESSAGE_TYPE.RTM_MESSAGE_TYPE_STRING,
channelType: channelType,
messageType: RTM_MESSAGE_TYPE.RTM_MESSAGE_TYPE_STRING,
})
);
}
Expand All @@ -123,7 +137,7 @@ export default function PublishMessage() {
return;
}
},
[cName, client, publishMessageByBuffer]
[cName, client, publishMessageByBuffer, channelType]
);

const onSend = useCallback(
Expand Down Expand Up @@ -224,6 +238,15 @@ export default function PublishMessage() {
onChannelNameChanged={(v) => setCName(v)}
onUidChanged={(v) => setUid(v)}
/>
<AgoraDivider/>
<AgoraDropdown
items={enumToItems(RTM_CHANNEL_TYPE)}
onValueChange={(v) => {
setChannelType(v);
}}
title="select channelType"
value={channelType}
/>
<AgoraButton
disabled={!loginSuccess}
title={`${subscribeSuccess ? 'unsubscribe' : 'subscribe'}`}
Expand Down
9 changes: 5 additions & 4 deletions example/src/advanced/publishTopicMessage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
RTM_ERROR_CODE,
RTM_MESSAGE_TYPE,
TopicEvent,
TopicOptions,
UserList,
} from 'agora-react-native-rtm';
import React, { useCallback, useEffect, useState } from 'react';
Expand Down Expand Up @@ -218,7 +219,7 @@ export default function PublishTopicMessage() {
Buffer.from(msg.text),
msg.text?.length,
new PublishOptions({
type: RTM_MESSAGE_TYPE.RTM_MESSAGE_TYPE_BINARY,
messageType: RTM_MESSAGE_TYPE.RTM_MESSAGE_TYPE_BINARY,
})
);
} else {
Expand All @@ -227,7 +228,7 @@ export default function PublishTopicMessage() {
msg.text,
msg.text?.length,
new PublishOptions({
type: RTM_MESSAGE_TYPE.RTM_MESSAGE_TYPE_STRING,
messageType: RTM_MESSAGE_TYPE.RTM_MESSAGE_TYPE_STRING,
})
);
}
Expand Down Expand Up @@ -262,14 +263,14 @@ export default function PublishTopicMessage() {
* Step 3(optional) : subscribe topic
*/
const subscribe = () => {
streamChannel?.subscribeTopic(topicName);
streamChannel?.subscribeTopic(topicName, {});
};

/**
* Step 4 : unsubscribe topic
*/
const unsubscribe = () => {
streamChannel?.unsubscribeTopic(topicName);
streamChannel?.unsubscribeTopic(topicName, {});
setSubscribeSuccess(false);
};

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "agora-react-native-rtm",
"version": "2.1.7",
"version": "2.1.12",
"description": "React Native around the Agora RTM SDKs for Android and iOS agora",
"main": "lib/commonjs/index",
"module": "lib/module/index",
Expand Down
20 changes: 10 additions & 10 deletions scripts/terra/config/impl_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,27 @@ parsers:
package: '@agoraio-extensions/cxx-parser'
args:
includeHeaderDirs:
- '@agoraio-extensions/terra_shared_configs:headers/rtm_2.1.7/include'
- '@agoraio-extensions/terra_shared_configs:headers/rtm_2.1.12/include'
parseFiles:
include:
- '@agoraio-extensions/terra_shared_configs:headers/rtm_2.1.7/include/*.h'
- '@agoraio-extensions/terra_shared_configs:headers/rtm_2.1.12/include/*.h'
exclude:
- '@agoraio-extensions/terra_shared_configs:headers/rtm_2.1.7/include/IAgoraRtmService.h'
- '@agoraio-extensions/terra_shared_configs:headers/rtm_2.1.7/include/IAgoraService.h'
- '@agoraio-extensions/terra_shared_configs:headers/rtm_2.1.12/include/IAgoraRtmService.h'
- '@agoraio-extensions/terra_shared_configs:headers/rtm_2.1.12/include/IAgoraService.h'

- name: AddNodeParser
package: '@agoraio-extensions/terra_shared_configs'
args:
customHeaderFileNamePrefix: 'Custom'
includeHeaderDirs:
- '@agoraio-extensions/terra_shared_configs:headers/rtm_2.1.7/include'
- '@agoraio-extensions/terra_shared_configs:headers/rtm_2.1.12/include'
parseFiles:
include:
- '@agoraio-extensions/terra_shared_configs:headers/rtm_2.1.7/include/*.h'
- '@agoraio-extensions/terra_shared_configs:headers/rtm_2.1.7/custom_headers/*.h'
- '@agoraio-extensions/terra_shared_configs:headers/rtm_2.1.12/include/*.h'
- '@agoraio-extensions/terra_shared_configs:headers/rtm_2.1.12/custom_headers/*.h'
exclude:
- '@agoraio-extensions/terra_shared_configs:headers/rtm_2.1.7/include/IAgoraRtmService.h'
- '@agoraio-extensions/terra_shared_configs:headers/rtm_2.1.7/include/IAgoraService.h'
- '@agoraio-extensions/terra_shared_configs:headers/rtm_2.1.12/include/IAgoraRtmService.h'
- '@agoraio-extensions/terra_shared_configs:headers/rtm_2.1.12/include/IAgoraService.h'

- name: RemoveNodeParser
package: '@agoraio-extensions/terra_shared_configs'
Expand Down Expand Up @@ -60,4 +60,4 @@ parsers:
renderers:
- path: ../impl.ts

version: 2.1.7
version: 2.1.12
Loading

0 comments on commit 35cfdf3

Please sign in to comment.