Skip to content
This repository has been archived by the owner on Oct 29, 2024. It is now read-only.

Update compile/target SDK versions to 28 #48

Merged
merged 12 commits into from
Apr 24, 2020
Merged
14 changes: 12 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:

ios:
macos:
xcode: "10.2.1"
xcode: "11.4"
steps:
- checkout

Expand All @@ -48,9 +48,19 @@ jobs:
- run: cp -r ../project/ ../hello-react-native/node_modules/launchdarkly-react-native-client-sdk/
- run: cd ../hello-react-native && react-native run-ios --configuration Release --simulator rn-ios

common:
docker:
- image: circleci/node:11.10.1
steps:
- checkout

- run: npm install
- run: npm run check-typescript

workflows:
version: 2
android-ios:
jobs:
- android
- ios
- ios
- common
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,14 @@ build/
.gradle
local.properties
*.iml
org.eclipse*
android/.project
android/.classpath

# BUCK
buck-out/
\.buckd/
*.keystore

# Auto-generated
test-types.js
4 changes: 4 additions & 0 deletions .ldrelease/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,9 @@ template:
skip:
- test

documentation:
githubPages: true
title: LaunchDarkly Client-Side SDK for React Native

sdk:
displayName: React Native
31 changes: 31 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,37 @@

All notable changes to the LaunchDarkly React Native SDK will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org).

## [3.1.0] - 2020-04-01
### Changed:
- The SDK is now compatible with React Native version 0.62.x and React version 16.11.x

## [3.0.2] - 2020-03-31
### Changed:
- Updated SDK code to build, run, and test on Xcode 11.4.

## [3.0.1] - 2020-02-26
### Added:
- Generated TypeDoc documentation for all types, properties, and methods is now available online at https://launchdarkly.github.io/react-native-client-sdk/. Currently this will only be for the latest released version.

### Fixed:
- Fixed some incorrect and incomplete typedoc comments.


## [3.0.0] - 2020-02-20
### Added:
- Added TypeScript type definitions (thanks, [eeynard](https://github.com/launchdarkly/react-native-client-sdk/pull/32)!)
- Added TypeDoc comments
- The SDK now specifies a uniquely identifiable request header when sending events to LaunchDarkly to ensure that events are only processed once, even if the SDK sends them two times due to a failed initial attempt.

### Changed:
- Changed the default value for the `anonymous` user property has been changed to `false`. Previously this default was inconsistent; the default value was `true` when running in iOS and `false` when running in Android.
- Changed the default value for the `backgroundPollingIntervalMillis` SDK configuration property has been changed to `3600000` (one hour). Previously this default was inconsistent; the default value was `900000` (15 minutes) when running in iOS and `3600000` (one hour) when running in Android.
- Changed the default value for the `disableBackgroundUpdating ` SDK configuration property has been changed to `false`. Previously this default was inconsistent; the default value was `true` when running in iOS and `false` when running in Android.

### Fixed:
- Fixed the `*VariationDetail` methods so that they now always return a promise containing the variation detail information. Previously, when running in Android, this promise would have instead contained just the variation value if the underlying process threw an exception.
- Fixed an issue where React Native apps could crash after reloading when running in iOS (thanks, [shercoder](https://github.com/launchdarkly/react-native-client-sdk/pull/39)!)

## [2.2.0] - 2020-01-24
### Added:
- Adds `evaluationReasons` configuration option.
Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Contributing to the LaunchDarkly Client-side SDK for React Native
Contributing to the LaunchDarkly Client-Side SDK for React Native
================================================

LaunchDarkly has published an [SDK contributor's guide](https://docs.launchdarkly.com/docs/sdk-contributors-guide) that provides a detailed explanation of how our SDKs work. See below for additional information on how to contribute to this SDK.
LaunchDarkly has published an [SDK contributor's guide](https://docs.launchdarkly.com/sdk/concepts/contributors-guide) that provides a detailed explanation of how our SDKs work. See below for additional information on how to contribute to this SDK.

Submitting bug reports and feature requests
------------------
Expand Down
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
LaunchDarkly Client-side SDK for React Native
LaunchDarkly Client-Side SDK for React Native
===========================

[![CircleCI](https://circleci.com/gh/launchdarkly/react-native-client-sdk.svg?style=svg)](https://circleci.com/gh/launchdarkly/react-native-client-sdk)

LaunchDarkly overview
-------------------------
[LaunchDarkly](https://www.launchdarkly.com) is a feature management platform that serves over 100 billion feature flags daily to help teams build better software, faster. [Get started](https://docs.launchdarkly.com/docs/getting-started) using LaunchDarkly today!
[LaunchDarkly](https://www.launchdarkly.com) is a feature management platform that serves over 100 billion feature flags daily to help teams build better software, faster. [Get started](https://docs.launchdarkly.com/home/getting-started) using LaunchDarkly today!

[![Twitter Follow](https://img.shields.io/twitter/follow/launchdarkly.svg?style=social&label=Follow&maxAge=2592000)](https://twitter.com/intent/follow?screen_name=launchdarkly)

Supported versions
-------------------------

This SDK is compatible with React Native 0.61.2 and Xcode 10.2.1 and is tested in Android 27 and iOS 12.4. Earlier versions of this SDK are compatible with prior versions of React Native, Android, and iOS.
This SDK is compatible with React Native 0.62.x and Xcode 11.4 and is tested in Android 27 and iOS 12.4. Earlier versions of this SDK are compatible with prior versions of React Native, Android, and iOS.

Getting started
---------------

Refer to the [SDK documentation](https://docs.launchdarkly.com/docs/react-native-sdk-reference#section-getting-started) for instructions on getting started with using the SDK.
Refer to the [SDK documentation](https://docs.launchdarkly.com/sdk/client-side/react-native#getting-started) for instructions on getting started with using the SDK.

Learn more
-----------

Check out our [documentation](https://docs.launchdarkly.com) for in-depth instructions on configuring and using LaunchDarkly. You can also head straight to the [complete reference guide for this SDK](https://docs.launchdarkly.com/docs/react-native-sdk-reference).
Check out our [documentation](https://docs.launchdarkly.com) for in-depth instructions on configuring and using LaunchDarkly. You can also head straight to the [complete reference guide for this SDK](https://docs.launchdarkly.com/sdk/client-side/react-native).

Testing
-------
Expand All @@ -42,10 +42,10 @@ About LaunchDarkly
* Gradually roll out a feature to an increasing percentage of users, and track the effect that the feature has on key metrics (for instance, how likely is a user to complete a purchase if they have feature A versus feature B?).
* Turn off a feature that you realize is causing performance problems in production, without needing to re-deploy, or even restart the application with a changed configuration file.
* Grant access to certain features based on user attributes, like payment plan (eg: users on the ‘gold’ plan get access to more features than users in the ‘silver’ plan). Disable parts of your application to facilitate maintenance, without taking everything offline.
* LaunchDarkly provides feature flag SDKs for a wide variety of languages and technologies. Check out [our documentation](https://docs.launchdarkly.com/docs) for a complete list.
* LaunchDarkly provides feature flag SDKs for a wide variety of languages and technologies. Check out [our documentation](https://docs.launchdarkly.com) for a complete list.
* Explore LaunchDarkly
* [launchdarkly.com](https://www.launchdarkly.com/ "LaunchDarkly Main Website") for more information
* [docs.launchdarkly.com](https://docs.launchdarkly.com/ "LaunchDarkly Documentation") for our documentation and SDK reference guides
* [apidocs.launchdarkly.com](https://apidocs.launchdarkly.com/ "LaunchDarkly API Documentation") for our API documentation
* [blog.launchdarkly.com](https://blog.launchdarkly.com/ "LaunchDarkly Blog Documentation") for the latest product updates
* [Feature Flagging Guide](https://github.com/launchdarkly/featureflags/ "Feature Flagging Guide") for best practices and strategies
* [Feature Flagging Guide](https://github.com/launchdarkly/featureflags/ "Feature Flagging Guide") for best practices and strategies
10 changes: 5 additions & 5 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ buildscript {
buildToolsVersion = "28.0.2"
minSdkVersion = 16
compileSdkVersion = 28
targetSdkVersion = 27
targetSdkVersion = 28
supportLibVersion = "28.0.0"
}
repositories {
Expand All @@ -20,8 +20,8 @@ buildscript {
apply plugin: 'com.android.library'

android {
compileSdkVersion 27
buildToolsVersion "27.0.3"
compileSdkVersion 28
buildToolsVersion "28.0.3"

defaultConfig {
minSdkVersion 16
Expand All @@ -48,8 +48,8 @@ allprojects {

dependencies {
implementation 'com.facebook.react:react-native:+'
implementation 'com.launchdarkly:launchdarkly-android-client-sdk:2.9.0'
implementation 'com.launchdarkly:launchdarkly-android-client-sdk:2.10.0'
implementation 'com.jakewharton.timber:timber:4.7.1'
implementation "com.google.code.gson:gson:2.8.5"
}


Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import com.launchdarkly.android.LDStatusListener;
import com.launchdarkly.android.LDAllFlagsListener;
import com.launchdarkly.android.EvaluationDetail;
import com.launchdarkly.android.EvaluationReason;
import com.launchdarkly.android.LDFailure;

import java.lang.reflect.InvocationTargetException;
Expand Down Expand Up @@ -565,14 +566,16 @@ public void boolVariationDetail(String flagKey, Promise promise) {

@ReactMethod
public void boolVariationDetailFallback(String flagKey, Boolean fallback, Promise promise) {
EvaluationDetail<Boolean> detailResult;
try {
EvaluationDetail<Boolean> detailResult = ldClient.boolVariationDetail(flagKey, fallback);
JsonObject jsonObject = gson.toJsonTree(detailResult).getAsJsonObject();
WritableMap detailMap = fromJsonObject(jsonObject);
promise.resolve(detailMap);
detailResult = ldClient.boolVariationDetail(flagKey, fallback);
} catch (Exception e) {
promise.resolve(fallback);
e.printStackTrace();
detailResult = new EvaluationDetail<Boolean>(EvaluationReason.error(EvaluationReason.ErrorKind.EXCEPTION), null, fallback);
}
JsonObject jsonObject = gson.toJsonTree(detailResult).getAsJsonObject();
WritableMap detailMap = fromJsonObject(jsonObject);
promise.resolve(detailMap);
}

@ReactMethod
Expand All @@ -582,14 +585,16 @@ public void intVariationDetail(String flagKey, Promise promise) {

@ReactMethod
public void intVariationDetailFallback(String flagKey, Integer fallback, Promise promise) {
EvaluationDetail<Integer> detailResult;
try {
EvaluationDetail<Integer> detailResult = ldClient.intVariationDetail(flagKey, fallback);
JsonObject jsonObject = gson.toJsonTree(detailResult).getAsJsonObject();
WritableMap detailMap = fromJsonObject(jsonObject);
promise.resolve(detailMap);
detailResult = ldClient.intVariationDetail(flagKey, fallback);
} catch (Exception e) {
promise.resolve(fallback);
e.printStackTrace();
detailResult = new EvaluationDetail<Integer>(EvaluationReason.error(EvaluationReason.ErrorKind.EXCEPTION), null, fallback);
}
JsonObject jsonObject = gson.toJsonTree(detailResult).getAsJsonObject();
WritableMap detailMap = fromJsonObject(jsonObject);
promise.resolve(detailMap);
}

@ReactMethod
Expand All @@ -599,14 +604,16 @@ public void floatVariationDetail(String flagKey, Promise promise) {

@ReactMethod
public void floatVariationDetailFallback(String flagKey, Float fallback, Promise promise) {
EvaluationDetail<Float> detailResult;
try {
EvaluationDetail<Float> detailResult = ldClient.floatVariationDetail(flagKey, fallback);
JsonObject jsonObject = gson.toJsonTree(detailResult).getAsJsonObject();
WritableMap detailMap = fromJsonObject(jsonObject);
promise.resolve(detailMap);
detailResult = ldClient.floatVariationDetail(flagKey, fallback);
} catch (Exception e) {
promise.resolve(fallback);
e.printStackTrace();
detailResult = new EvaluationDetail<Float>(EvaluationReason.error(EvaluationReason.ErrorKind.EXCEPTION), null, fallback);
}
JsonObject jsonObject = gson.toJsonTree(detailResult).getAsJsonObject();
WritableMap detailMap = fromJsonObject(jsonObject);
promise.resolve(detailMap);
}

@ReactMethod
Expand All @@ -616,14 +623,16 @@ public void stringVariationDetail(String flagKey, Promise promise) {

@ReactMethod
public void stringVariationDetailFallback(String flagKey, String fallback, Promise promise) {
EvaluationDetail<String> detailResult;
try {
EvaluationDetail<String> detailResult = ldClient.stringVariationDetail(flagKey, fallback);
JsonObject jsonObject = gson.toJsonTree(detailResult).getAsJsonObject();
WritableMap detailMap = fromJsonObject(jsonObject);
promise.resolve(detailMap);
detailResult = ldClient.stringVariationDetail(flagKey, fallback);
} catch (Exception e) {
promise.resolve(fallback);
e.printStackTrace();
detailResult = new EvaluationDetail<String>(EvaluationReason.error(EvaluationReason.ErrorKind.EXCEPTION), null, fallback);
}
JsonObject jsonObject = gson.toJsonTree(detailResult).getAsJsonObject();
WritableMap detailMap = fromJsonObject(jsonObject);
promise.resolve(detailMap);
}

@ReactMethod
Expand Down Expand Up @@ -673,12 +682,14 @@ private void jsonVariationBase(String flagKey, JsonElement fallback, Promise pro
}

private void jsonVariationDetailBase(String flagKey, JsonElement fallback, Promise promise) {
EvaluationDetail<JsonElement> jsonElementDetail;
try {
EvaluationDetail<JsonElement> jsonElementDetail = ldClient.jsonVariationDetail(flagKey, fallback);
resolveJsonElementDetail(promise, jsonElementDetail);
jsonElementDetail = ldClient.jsonVariationDetail(flagKey, fallback);
} catch (Exception e) {
resolveJsonElement(promise, fallback);
e.printStackTrace();
jsonElementDetail = new EvaluationDetail<JsonElement>(EvaluationReason.error(EvaluationReason.ErrorKind.EXCEPTION), null, fallback);
}
resolveJsonElementDetail(promise, jsonElementDetail);
}


Expand Down
Loading