Skip to content

Commit

Permalink
feat: support 4.4.0 (#795)
Browse files Browse the repository at this point in the history
  • Loading branch information
guoxianzhe authored Aug 29, 2024
1 parent 17f4942 commit 1fbe4c6
Show file tree
Hide file tree
Showing 55 changed files with 3,181 additions and 1,259 deletions.
13 changes: 5 additions & 8 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
{
"root": true,
"extends": [
"@react-native",
"prettier"
],
"plugins": [
"import",
"auto-import"
],
"extends": ["@react-native", "prettier"],
"env": {
"es2020": true
},
"plugins": ["import", "auto-import"],
"rules": {
"prettier/prettier": [
"error",
Expand Down
26 changes: 2 additions & 24 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,6 @@ concurrency:

on:
workflow_dispatch:
inputs:
force:
description: 'force build'
required: false
type: boolean
default: false
build_ios:
description: 'build iOS'
required: false
type: boolean
default: true

jobs:
build-android:
Expand Down Expand Up @@ -78,7 +67,7 @@ jobs:

- name: Build example for Android
run: |
yarn turbo run build:android --cache-dir="${{ env.TURBO_CACHE_DIR }}" --force="${{ inputs.force }}"
yarn turbo run build:android --cache-dir="${{ env.TURBO_CACHE_DIR }}" --force=true
- name: Upload APK
uses: actions/upload-artifact@v3
Expand All @@ -89,7 +78,6 @@ jobs:
if-no-files-found: error

build-ios:
if: ${{ inputs.build_ios }}
runs-on: macos-latest
env:
TURBO_CACHE_DIR: .turbo/ios
Expand All @@ -113,15 +101,6 @@ jobs:
restore-keys: |
${{ runner.os }}-turborepo-ios-
- name: Check turborepo cache for iOS
if: ${{ !inputs.force }}
run: |
TURBO_CACHE_STATUS=$(node -p "($(yarn turbo run build:ios --cache-dir="${{ env.TURBO_CACHE_DIR }}" --dry=json)).tasks.find(t => t.task === 'build:ios').cache.status")
if [[ $TURBO_CACHE_STATUS == "HIT" ]]; then
echo "turbo_cache_hit=1" >> $GITHUB_ENV
fi
- name: Cache cocoapods
if: env.turbo_cache_hit != 1
id: cocoapods-cache
Expand All @@ -134,7 +113,6 @@ jobs:
${{ runner.os }}-cocoapods-0-
- name: Install cocoapods
if: ${{ inputs.force }} || (env.turbo_cache_hit != 1 && steps.cocoapods-cache.outputs.cache-hit != 'true')
run: |
yarn pod-install example/ios
Expand Down Expand Up @@ -175,7 +153,7 @@ jobs:
- name: Build example for iOS
run: |
yarn turbo run build:ios --cache-dir="${{ env.TURBO_CACHE_DIR }}" --force="${{ inputs.force }}"
yarn turbo run build:ios --cache-dir="${{ env.TURBO_CACHE_DIR }}" --force=true
- name: Upload IPA
uses: actions/upload-artifact@v3
Expand Down
42 changes: 0 additions & 42 deletions .github/workflows/doc.yml

This file was deleted.

6 changes: 3 additions & 3 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -164,9 +164,9 @@ dependencies {
//noinspection GradleDynamicVersion
implementation "com.facebook.react:react-native:+"
implementation fileTree(include: ['*.jar', '*.aar'], dir: 'libs')
api 'io.agora.rtc:full-sdk:4.3.2'
implementation 'io.agora.rtc:full-screen-sharing:4.3.2'
implementation 'io.agora.rtc:iris-rtc:4.3.2-build.1'
api 'io.agora.rtc:full-sdk:4.4.1'
implementation 'io.agora.rtc:full-screen-sharing:4.4.1'
implementation 'io.agora.rtc:iris-rtc:4.4.0-build.6'
}

if (isNewArchitectureEnabled()) {
Expand Down
67 changes: 37 additions & 30 deletions android/src/main/java/io/agora/rtc/ng/react/AgoraRtcNgModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
@ReactModule(name = AgoraRtcNgModule.NAME)
public class AgoraRtcNgModule extends AgoraRtcNgSpec implements IrisEventHandler {
public static final String NAME = "AgoraRtcNg";
public final Object irisApiLock = new Object();
public IrisApiEngine irisApiEngine;

AgoraRtcNgModule(ReactApplicationContext context) {
Expand All @@ -41,49 +42,55 @@ public String getName() {

@ReactMethod(isBlockingSynchronousMethod = true)
public boolean newIrisApiEngine() {
if (irisApiEngine == null) {
IrisApiEngine.enableUseJsonArray(true);
irisApiEngine = new IrisApiEngine(getReactApplicationContext());
irisApiEngine.setEventHandler(this);
return true;
synchronized (irisApiLock) {
if (irisApiEngine == null) {
IrisApiEngine.enableUseJsonArray(true);
irisApiEngine = new IrisApiEngine(getReactApplicationContext());
irisApiEngine.setEventHandler(this);
return true;
}
}
return false;
}

@ReactMethod(isBlockingSynchronousMethod = true)
public boolean destroyIrisApiEngine() {
if (irisApiEngine != null) {
irisApiEngine.setEventHandler(null);
irisApiEngine.destroy();
irisApiEngine = null;
return true;
synchronized (irisApiLock) {
if (irisApiEngine != null) {
irisApiEngine.setEventHandler(null);
irisApiEngine.destroy();
irisApiEngine = null;
return true;
}
}
return false;
}

@ReactMethod(isBlockingSynchronousMethod = true)
public String callApi(ReadableMap args) {
String funcName = args.getString("funcName");
String params = args.getString("params");
List<byte[]> buffers = null;

ReadableArray array = args.getArray("buffers");
if (array != null) {
buffers = new ArrayList<>();
for (int i = 0; i < array.size(); i++) {
buffers.add(Base64.decode(array.getString(i), Base64.DEFAULT));
synchronized (irisApiLock) {
String funcName = args.getString("funcName");
String params = args.getString("params");
List<byte[]> buffers = null;

ReadableArray array = args.getArray("buffers");
if (array != null) {
buffers = new ArrayList<>();
for (int i = 0; i < array.size(); i++) {
buffers.add(Base64.decode(array.getString(i), Base64.DEFAULT));
}
}
}

try {
newIrisApiEngine();
return irisApiEngine.callIrisApi(funcName, params, buffers);
} catch (Exception e) {
e.printStackTrace();
try {
return new JSONObject().put("result", e.getMessage()).toString();
} catch (JSONException ex) {
throw new RuntimeException(ex);
newIrisApiEngine();
return irisApiEngine.callIrisApi(funcName, params, buffers);
} catch (Exception e) {
e.printStackTrace();
try {
return new JSONObject().put("result", e.getMessage()).toString();
} catch (JSONException ex) {
throw new RuntimeException(ex);
}
}
}
}
Expand Down Expand Up @@ -117,7 +124,7 @@ public void OnEvent(String event, String data, List<byte[]> buffers) {
map.putArray("buffers", array);
}
getReactApplicationContext()
.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
.emit("AgoraRtcNg:onEvent", map);
.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
.emit("AgoraRtcNg:onEvent", map);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,13 @@ public void setCallApi(FrameLayout view, @Nullable ReadableMap arguments) {
String funcName = arguments.getString("funcName");
String params = arguments.getString("params");
AgoraRtcNgModule module = context.getNativeModule(AgoraRtcNgModule.class);
if (module != null) {
try {
module.irisApiEngine.callIrisApi(funcName, params, view.getChildAt(0));
} catch (Exception e) {
e.printStackTrace();
synchronized (module.irisApiLock) {
if (module != null) {
try {
module.irisApiEngine.callIrisApi(funcName, params, view.getChildAt(0));
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,13 @@ public void setCallApi(TextureView view, @Nullable ReadableMap arguments) {
String funcName = arguments.getString("funcName");
String params = arguments.getString("params");
AgoraRtcNgModule module = context.getNativeModule(AgoraRtcNgModule.class);
if (module != null) {
try {
module.irisApiEngine.callIrisApi(funcName, params, view);
} catch (Exception e) {
e.printStackTrace();
synchronized (module.irisApiLock) {
if (module != null) {
try {
module.irisApiEngine.callIrisApi(funcName, params, view);
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
Expand Down
1 change: 1 addition & 0 deletions example/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ Any scene of this project can run successfully alone.

| Demo | Description |
| ------------------------------------------------------------ | ------------------------------------------------------------ |
| [AudioCallRoute](./src/examples/advanced/AudioCallRoute) | control audio call route |
| [AudioMixing](./src/examples/advanced/AudioMixing) | Starts playing the music file |
| [AudioSpectrum](./src/examples/advanced/AudioSpectrum) | Turn on audio spectrum monitoring |
| [BeautyEffect](./src/examples/advanced/BeautyEffect) | Sets the image enhancement options |
Expand Down
2 changes: 1 addition & 1 deletion example/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ android {
}

dependencies {
androidTestImplementation('com.wix:detox:+')
androidTestImplementation('com.wix:detox-legacy:+')
implementation 'androidx.appcompat:appcompat:1.1.0'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ protected List<ReactPackage> getPackages() {
List<ReactPackage> packages = new PackageList(this).getPackages();
// Packages that cannot be autolinked yet can be added manually here, for example:
// packages.add(new MyReactNativePackage());
packages.add(new VideoRawDataNativeModulePackage());
return packages;
}

Expand Down
Loading

0 comments on commit 1fbe4c6

Please sign in to comment.