From a391548fbdd680fb5e60ed8d0dc5f88f230be460 Mon Sep 17 00:00:00 2001 From: HUI Date: Tue, 13 Apr 2021 15:50:00 +0800 Subject: [PATCH] feat: upgrade native SDK to 3.3.2 --- android/build.gradle | 4 +--- .../java/io/agora/rtc/react/RCTAgoraRtcChannelModule.kt | 6 ++---- .../java/io/agora/rtc/react/RCTAgoraRtcEngineModule.kt | 6 ++---- example/src/examples/component/Item.tsx | 9 +-------- react-native-agora.podspec | 2 +- 5 files changed, 7 insertions(+), 20 deletions(-) diff --git a/android/build.gradle b/android/build.gradle index c824f71f7..2b6cce7c8 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -16,7 +16,6 @@ buildscript { apply plugin: 'com.android.library' apply plugin: 'kotlin-android' -apply plugin: 'kotlin-android-extensions' def getExtOrDefault(name) { return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties['Agora_' + name] @@ -128,7 +127,6 @@ def kotlin_version = getExtOrDefault('kotlinVersion') dependencies { // noinspection GradleDynamicVersion api 'com.facebook.react:react-native:+' - api "io.agora.rtc:full-sdk:3.3.1" + api "io.agora.rtc:full-sdk:3.3.2" implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" - implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version" } diff --git a/android/src/main/java/io/agora/rtc/react/RCTAgoraRtcChannelModule.kt b/android/src/main/java/io/agora/rtc/react/RCTAgoraRtcChannelModule.kt index 4141ed832..a0bd52f49 100644 --- a/android/src/main/java/io/agora/rtc/react/RCTAgoraRtcChannelModule.kt +++ b/android/src/main/java/io/agora/rtc/react/RCTAgoraRtcChannelModule.kt @@ -8,8 +8,6 @@ import io.agora.rtc.RtcEngine import io.agora.rtc.base.RtcChannelEventHandler import io.agora.rtc.base.RtcChannelManager import io.agora.rtc.react.RCTAgoraRtcChannelModule.Companion.REACT_CLASS -import kotlin.reflect.full.declaredMemberFunctions -import kotlin.reflect.jvm.javaMethod @ReactModule(name = REACT_CLASS) class RCTAgoraRtcChannelModule( @@ -51,8 +49,8 @@ class RCTAgoraRtcChannelModule( @ReactMethod fun callMethod(methodName: String, params: ReadableMap?, callback: Promise?) { - manager::class.declaredMemberFunctions.find { it.name == methodName }?.let { function -> - function.javaMethod?.let { method -> + manager.javaClass.declaredMethods.find { it.name == methodName }?.let { function -> + function.let { method -> try { val parameters = mutableListOf() params?.toHashMap()?.toMutableMap()?.let { diff --git a/android/src/main/java/io/agora/rtc/react/RCTAgoraRtcEngineModule.kt b/android/src/main/java/io/agora/rtc/react/RCTAgoraRtcEngineModule.kt index 34bb84244..1fe1791d0 100644 --- a/android/src/main/java/io/agora/rtc/react/RCTAgoraRtcEngineModule.kt +++ b/android/src/main/java/io/agora/rtc/react/RCTAgoraRtcEngineModule.kt @@ -7,8 +7,6 @@ import io.agora.rtc.RtcEngine import io.agora.rtc.base.RtcEngineEventHandler import io.agora.rtc.base.RtcEngineManager import io.agora.rtc.react.RCTAgoraRtcEngineModule.Companion.REACT_CLASS -import kotlin.reflect.full.declaredMemberFunctions -import kotlin.reflect.jvm.javaMethod @ReactModule(name = REACT_CLASS) class RCTAgoraRtcEngineModule( @@ -46,8 +44,8 @@ class RCTAgoraRtcEngineModule( @ReactMethod fun callMethod(methodName: String, params: ReadableMap?, callback: Promise?) { - manager::class.declaredMemberFunctions.find { it.name == methodName }?.let { function -> - function.javaMethod?.let { method -> + manager.javaClass.declaredMethods.find { it.name == methodName }?.let { function -> + function.let { method -> try { val parameters = mutableListOf() params?.toHashMap()?.toMutableMap()?.let { diff --git a/example/src/examples/component/Item.tsx b/example/src/examples/component/Item.tsx index cd91583f1..aeeff35e2 100644 --- a/example/src/examples/component/Item.tsx +++ b/example/src/examples/component/Item.tsx @@ -1,12 +1,5 @@ import React, { useState } from 'react'; -import { - Button, - View, - Switch, - StyleSheet, - TouchableOpacity, - Text, -} from 'react-native'; +import { View, Switch, StyleSheet, TouchableOpacity, Text } from 'react-native'; import Slider from '@react-native-community/slider'; interface ItemProps { diff --git a/react-native-agora.podspec b/react-native-agora.podspec index e255dcb3b..d85bb201c 100644 --- a/react-native-agora.podspec +++ b/react-native-agora.podspec @@ -20,5 +20,5 @@ Pod::Spec.new do |s| s.swift_version = "4.0" s.dependency "React" - s.dependency "AgoraRtcEngine_iOS", "3.3.1" + s.dependency "AgoraRtcEngine_iOS", "3.3.2" end