diff --git a/CHANGELOG.md b/CHANGELOG.md index 1f838bbb3..2f7f6d93a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## [3.2.2](https://github.com/AgoraIO-Community/react-native-agora/compare/v3.2.1...v3.2.2) (2020-12-28) + + +### Bug Fixes + +* process resolve value type ([d28c79d](https://github.com/AgoraIO-Community/react-native-agora/commit/d28c79d18338604cbc6e723baedd9618e8a11374)) + ## [3.2.1](https://github.com/AgoraIO-Community/react-native-agora/compare/v3.2.0...v3.2.1) (2020-12-24) ## [3.2.0](https://github.com/AgoraIO-Community/react-native-agora/compare/v3.2.0-rc.0...v3.2.0) (2020-12-23) @@ -19,6 +26,13 @@ * upgrade to 3.2.0 ([4ee51a9](https://github.com/AgoraIO-Community/react-native-agora/commit/4ee51a9b405deb17b467f5359f6717033c3961a2)) * upgrade to 3.2.0 ([680048f](https://github.com/AgoraIO-Community/react-native-agora/commit/680048f7836940f586ce7228559ba2cde9e0de62)) +## [3.1.7](https://github.com/AgoraIO-Community/react-native-agora/compare/v3.1.6...v3.1.7) (2020-12-28) + + +### Bug Fixes + +* process resolve value type ([d28c79d](https://github.com/AgoraIO-Community/react-native-agora/commit/d28c79d18338604cbc6e723baedd9618e8a11374)) + ## [3.1.6](https://github.com/AgoraIO-Community/react-native-agora/compare/v3.1.5...v3.1.6) (2020-12-21) diff --git a/android/src/main/java/io/agora/rtc/react/PromiseCallback.kt b/android/src/main/java/io/agora/rtc/react/PromiseCallback.kt index 15cf544e7..17360577b 100644 --- a/android/src/main/java/io/agora/rtc/react/PromiseCallback.kt +++ b/android/src/main/java/io/agora/rtc/react/PromiseCallback.kt @@ -8,16 +8,21 @@ class PromiseCallback( private val promise: Promise? ) : Callback() { override fun success(data: Any?) { - if (data is Map<*, *>) { - val map = mutableMapOf() - data.forEach { - if (it.key is String) { - map[it.key as String] = it.value + when (data) { + null, is Boolean, is Int, is String -> promise?.resolve(data) + is Number -> promise?.resolve(data.toDouble()) + is Array<*> -> promise?.resolve(Arguments.makeNativeArray(arrayOf(data))) + is List<*> -> promise?.resolve(Arguments.makeNativeArray(data)) + is Map<*, *> -> { + val map = mutableMapOf() + data.forEach { + if (it.key is String) { + map[it.key as String] = it.value + } } + promise?.resolve(Arguments.makeNativeMap(map)) } - promise?.resolve(Arguments.makeNativeMap(map)) - } else { - promise?.resolve(data) + else -> promise?.reject(IllegalArgumentException("Could not convert " + data.javaClass)) } } diff --git a/package.json b/package.json index 2c2bf2559..f63370549 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-native-agora", - "version": "3.2.1", + "version": "3.2.2", "description": "Agora RTC SDK For React Native", "main": "lib/commonjs/index", "module": "lib/module/index",