diff --git a/CHANGELOG.md b/CHANGELOG.md index d6cd47d..0933693 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ All notable changes to the LaunchDarkly React Native SDK will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org). +## [4.0.2] - 2021-04-23 +### Fixed: +- Android: Fixed an issue where the `jsonVariationDetail` method in `LDClient` returned `Promise>` instead of the declared return type of `Promise>>`. + ## [4.1.0] - 2021-04-13 ### Added: - The SDK is now compatible with React Native version 0.64.x. ([#69](https://github.com/launchdarkly/react-native-client-sdk/issues/69)) @@ -9,7 +13,6 @@ All notable changes to the LaunchDarkly React Native SDK will be documented in t ### Removed: - The SDK no longer requires React as a peer dependency. React compatibility is dictated based on its compatibility with the React Native version. - ## [4.0.1] - 2021-04-06 ### Fixed: - iOS: Internal throttling logic would sometimes delay new poll or stream connections even when there were no recent connections. This caused switching active user contexts using `identify` to sometimes delay retrieving the most recent flags, and therefore delay the completion of the returned Promise. diff --git a/android/src/main/java/com/launchdarkly/reactnative/LaunchdarklyReactNativeClientModule.java b/android/src/main/java/com/launchdarkly/reactnative/LaunchdarklyReactNativeClientModule.java index 4190b76..610cd52 100644 --- a/android/src/main/java/com/launchdarkly/reactnative/LaunchdarklyReactNativeClientModule.java +++ b/android/src/main/java/com/launchdarkly/reactnative/LaunchdarklyReactNativeClientModule.java @@ -758,8 +758,11 @@ private void resolveJsonElement(Promise promise, JsonElement jsonElement) { } private void resolveJsonElementDetail(Promise promise, EvaluationDetail jsonElementDetail) { - JsonElement jsonElement = jsonElementDetail.getValue(); - resolveJsonElement(promise, jsonElement); + JsonObject jsonObject = new JsonObject(); + jsonObject.add("value", jsonElementDetail.getValue()); + jsonObject.addProperty("variationIndex", jsonElementDetail.getVariationIndex()); + jsonObject.add("reason", gson.toJsonTree(jsonElementDetail.getReason())); + resolveJsonElement(promise, jsonObject); } /** diff --git a/index.js b/index.js index 32464cd..b443f29 100644 --- a/index.js +++ b/index.js @@ -120,7 +120,7 @@ export default class LDClient { jsonVariationDetail(flagKey, defaultValue) { if (defaultValue == undefined) { - return LaunchdarklyReactNativeClient.jsonVariatioDetailNone(flagKey); + return LaunchdarklyReactNativeClient.jsonVariationDetailNone(flagKey); } else if (typeof defaultValue === 'number') { return LaunchdarklyReactNativeClient.jsonVariationDetailNumber(flagKey, defaultValue); } else if (typeof defaultValue === 'boolean') {