Skip to content
This repository was archived by the owner on Oct 29, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
67fb5ce
Removed the guides link
bwoskow-ld Feb 3, 2021
b6a113c
V4.0 (#68)
torchhound Apr 1, 2021
a193441
merge from public after release
LaunchDarklyCI Apr 1, 2021
510e581
Update iOS SDK dependency to fix Throttler behavior (#69)
torchhound Apr 7, 2021
0afc773
merge from public after release
LaunchDarklyCI Apr 7, 2021
9df202f
V4.1.0 (#72)
torchhound Apr 14, 2021
17e2d75
merge from public after release
LaunchDarklyCI Apr 14, 2021
35b61e1
Fixed jsonVariationDetail parsing on Android and fixed a typo in json…
torchhound Apr 16, 2021
fceade3
Merge branch 'master' of github.com:launchdarkly/react-native-client-sdk
bwoskow-ld Apr 23, 2021
82ba5fe
Releasing version 4.0.2
bwoskow-ld Apr 23, 2021
5489162
Merge branch 'v4.0.x-squashed' of github.com:launchdarkly/react-nativ…
bwoskow-ld Apr 23, 2021
ccc28c3
Merge branch 'master' of github.com:launchdarkly/react-native-client-sdk
bwoskow-ld Apr 24, 2021
c4a2891
Merge branch 'master' of github.com:launchdarkly/react-native-client-sdk
bwoskow-ld Apr 24, 2021
cae667b
Removes Typescript enums and replaces them with types that extend str…
torchhound Apr 28, 2021
f975de3
Releasing version 4.0.3
bwoskow-ld Apr 28, 2021
881c2fb
Merge branch 'v4.0.x-squashed'
bwoskow-ld Apr 28, 2021
b23e1c0
Merge branch 'master' of github.com:launchdarkly/react-native-client-…
bwoskow-ld Apr 28, 2021
c261c78
Merge branch 'master' of github.com:launchdarkly/react-native-client-sdk
bwoskow-ld Apr 28, 2021
5ad0499
Multi Environment (#65)
torchhound May 11, 2021
4ca1a1f
Add secondary user attribute (#76)
torchhound May 11, 2021
4a9530e
Merge branch 'master' of github.com:launchdarkly/react-native-client-sdk
bwoskow-ld May 11, 2021
81ae48d
Fix multi environment on restwrapper (#77)
torchhound May 19, 2021
0029ba5
merge from public after release
LaunchDarklyCI May 19, 2021
83640b7
[ch109800] Await Android client initialization. (#78)
gwhelanLD May 28, 2021
2668c2a
Update iOS method signature to match implementation (#79)
bwoskow-ld Jun 1, 2021
9703765
Merge remote-tracking branch 'public/master'
gwhelanLD Jun 1, 2021
b1a94ca
merge from public after release
LaunchDarklyCI Jun 1, 2021
8399a02
Releasing version 4.0.4
bwoskow-ld Jun 2, 2021
14c3993
Merge tag '4.0.4'
bwoskow-ld Jun 2, 2021
4d003c0
[ch110474] Fixes for undeclared variables and other callback issues. …
gwhelanLD Jun 15, 2021
36516d0
Merge remote-tracking branch 'public/master'
gwhelanLD Jun 15, 2021
093d62d
Changes for Android 3. (#82)
gwhelanLD Jun 15, 2021
894de0f
Add unit tests for JS native bridge wrapper. (#83)
gwhelanLD Jun 16, 2021
3da41af
Docs improvements (#84)
gwhelanLD Jun 16, 2021
493d554
[ch94513] Add aliasing support (#85)
gwhelanLD Jun 16, 2021
a735bab
Requiring default values to be specified. Remove intVariation. (#86)
gwhelanLD Jun 29, 2021
0364d51
Safer and cleaner configuration on iOS (#87)
gwhelanLD Jul 1, 2021
eb1aecb
Cleanup Android variation implementation (#88)
gwhelanLD Jul 1, 2021
9f8dbc9
Merge remote-tracking branch 'public/master'
gwhelanLD Aug 19, 2021
cbad402
Use latest iOS and Android SDKs (#89)
gwhelanLD Aug 19, 2021
f0ade3f
Fix issue with numeric variation calls. (#90)
gwhelanLD Aug 20, 2021
89668aa
merge from public after release
Aug 20, 2021
db3ca38
Add consumer Proguard file to Android build configuration. (#91)
gwhelanLD Sep 3, 2021
d631ea9
Merge remote-tracking branch 'public/master'
gwhelanLD Sep 3, 2021
cb9aab3
Update Android SDK to 3.1.1 (#92)
gwhelanLD Sep 3, 2021
33187c2
merge from public after release
Sep 3, 2021
c4a98d7
Fix for absolute paths in cocoapods generated build files by running …
gwhelanLD Sep 17, 2021
4511f91
Re-introduce compatibility for React Native 0.63 (#94)
bwoskow-ld Sep 20, 2021
1f314a8
Merge branch 'master' of github.com:launchdarkly/react-native-client-sdk
bwoskow-ld Sep 22, 2021
432605c
Updates docs URLs
ember-stevens Sep 26, 2021
714ab09
Merge pull request #95 from launchdarkly/emberstevens/sc-118589/url-a…
ember-stevens Sep 29, 2021
51504f9
Add configuration option `inlineUsersInEvents` and typescript definit…
gwhelanLD Sep 29, 2021
595c3c2
Merge branch 'master' of github.com:launchdarkly/react-native-client-sdk
bwoskow-ld Sep 29, 2021
b2104a2
minor doc improvement (#97)
bwoskow-ld Sep 30, 2021
2fc3cac
Update version in README to match what version we'll actually be rele…
gwhelanLD Sep 30, 2021
aa880bc
merge from public after release
Sep 30, 2021
17275e7
Merge branch 'master' of github.com:launchdarkly/react-native-client-…
louis-launchdarkly Sep 30, 2021
addc762
Invert isOffline on iOS. (#99)
gwhelanLD Oct 14, 2021
038017e
Fixes and improvements for CI configuration (#100)
gwhelanLD Dec 22, 2021
329b094
[SC-130395] Allow native SDKs to generate anonymous user when user ke…
gwhelanLD Dec 22, 2021
77d7b11
See will this work without adding the mavenCentral
louis-launchdarkly Jan 13, 2022
9f55e81
Adding MavenCentral
louis-launchdarkly Jan 13, 2022
f62cab3
Fix RN0.63 builds
louis-launchdarkly Jan 19, 2022
adeac7c
Merge pull request #102 from launchdarkly/lc/sc-137578/remove-jcenter
louis-launchdarkly Jan 19, 2022
eb26b57
Fix outdated sed CI expression preventing actually testing against th…
gwhelanLD Jan 21, 2022
d3385b5
Update Android native SDK dependency and gradle config. (#104)
gwhelanLD Jan 21, 2022
aa39b22
Update iOS SDK native dependency in podspec. (#105)
gwhelanLD Jan 21, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
103 changes: 59 additions & 44 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,63 +1,79 @@
version: 2.1

orbs:
android: circleci/[email protected]
node: circleci/[email protected]

aliases:
- &use_local_sdk
name: Set hello application to use local SDK and RN version
command: |
cd ../hello-react-native
TEMP_FILE=`mktemp -u` || exit 1
sed 's/"launchdarkly-react-native-client-sdk" *: *"[^"]*" *, *$/"launchdarkly-react-native-client-sdk": "file:..\/project"\,/' 'package.json' > $TEMP_FILE
mv $TEMP_FILE 'package.json'

jobs:
android:
parameters:
hello-app-branch:
type: string
docker:
- image: circleci/android@sha256:9d2e4571898fd9b1dc97bfb9da942aaeea46859eb5b1e4cfc85a44c42733643c
environment:
QEMU_AUDIO_DRV: none
_JAVA_OPTIONS: "-XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap -Xms2048m -Xmx4096m"
GRADLE_OPTS: "-Dorg.gradle.daemon=false"

executor:
name: android/android-machine
resource-class: large

steps:
- checkout

- setup_remote_docker:
docker_layer_caching: true
reusable: true # Deprecated version of above

- run: mkdir -p ~/.gradle && echo "org.gradle.daemon=false" >> ~/.gradle/gradle.properties
- run: sdkmanager "system-images;android-24;default;armeabi-v7a"
- run: sdkmanager --licenses
- run: sudo apt-get update && sudo apt-get install libpulse0
- run: echo no | avdmanager create avd -n rn-android -f -k "system-images;android-24;default;armeabi-v7a"
- run:
command: emulator -avd rn-android -netdelay none -netspeed full -no-audio -no-window -no-snapshot -use-system-libs -no-boot-anim
background: true
timeout: 1200
no_output_timeout: 20m
- run: sudo npm install -g react-native-cli
- run: cd .. && git clone https://github.com/launchdarkly/hello-react-native.git
- run: cd ../hello-react-native && git checkout <<parameters.hello-app-branch>> && npm install
- run: cp -r ../project/ ../hello-react-native/node_modules/launchdarkly-react-native-client-sdk/
- run: circle-android wait-for-boot
- run:
command: cd ../hello-react-native && react-native run-android
background: true
timeout: 1200
- run: cd .. && git clone --depth 1 https://github.com/launchdarkly/hello-react-native.git -b <<parameters.hello-app-branch>>
- run: *use_local_sdk
- node/install:
lts: true
install-yarn: true
- run:
name: Build bundle
command: |
cd ../hello-react-native
npx yarn install
npx react-native bundle --entry-file index.js --platform android --bundle-output android/main.jsbundle --assets-dest android
- run:
name: Setup debug keystore
command: |
keytool -genkey -v -keystore debug.keystore -storepass android -alias androiddebugkey -keypass android -keyalg RSA -keysize 2048 -validity 10000 -dname "cn=Unknown, ou=Unknown, o=Unknown, c=Unknown"
cp debug.keystore ../hello-react-native/android/app/
mkdir -p ~/.android
cp debug.keystore ~/.android/
- run: cd ../hello-react-native/android && ./gradlew packageDebug

ios:
parameters:
hello-app-branch:
type: string
macos:
xcode: "11.4"
xcode: "12.4.0"
steps:
- checkout

- run: xcrun simctl create rn-ios com.apple.CoreSimulator.SimDeviceType.iPhone-X com.apple.CoreSimulator.SimRuntime.iOS-12-2
- run: xcrun simctl boot rn-ios
- run: cd .. && git clone https://github.com/launchdarkly/hello-react-native.git
- run: cd ../hello-react-native && git checkout <<parameters.hello-app-branch>> && npm install
- run: sudo npm install -g react-native-cli
- run: cp -r ../project/ ../hello-react-native/node_modules/launchdarkly-react-native-client-sdk/
# Newer cocoapods required for following pod install
- run: sudo gem install cocoapods
# RN 0.64 has an issue with embedding absolute paths in the cocoapods generated build files, so must regenerate.
# https://github.com/facebook/react-native/issues/31121
- run: cd ../hello-react-native/ios && pod update && pod install
- run: cd ../hello-react-native && react-native run-ios --configuration Release --simulator rn-ios
- run: cd .. && git clone --depth 1 https://github.com/launchdarkly/hello-react-native.git -b <<parameters.hello-app-branch>>
- run: *use_local_sdk
- run: cd ../hello-react-native && npx yarn install
- run:
name: Build bundle
command: |
cd ../hello-react-native
npx yarn install
npx react-native bundle --entry-file index.js --platform ios --bundle-output ios/main.jsbundle --assets-dest ios
- run:
name: Build application
command: |
cd ../hello-react-native/ios
# Newer cocoapods required for following pod install
sudo gem install cocoapods
# RN 0.64 has an issue with embedding absolute paths in the cocoapods generated build files, so must regenerate.
# https://github.com/facebook/react-native/issues/31121
pod update
pod install
xcodebuild build -workspace HelloReactNative.xcworkspace -configuration Release -scheme HelloReactNative -sdk iphonesimulator -arch x86_64 CODE_SIGN_IDENTITY=

common:
docker:
Expand Down Expand Up @@ -102,4 +118,3 @@ workflows:
hello-app-branch: rn-0.64
requires:
- common

30 changes: 11 additions & 19 deletions android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,32 +1,25 @@
buildscript {
ext {
buildToolsVersion = "28.0.2"
minSdkVersion = 21
compileSdkVersion = 28
targetSdkVersion = 28
supportLibVersion = "28.0.0"
}
repositories {
jcenter()
mavenCentral()
google()
}

dependencies {
classpath 'com.android.tools.build:gradle:4.1.3'
classpath 'com.android.tools.build:gradle:4.2.2'
}
}

apply plugin: 'com.android.library'

android {
compileSdkVersion 28
buildToolsVersion "28.0.3"
compileSdkVersion = 31
buildToolsVersion = "30.0.3"

defaultConfig {
minSdkVersion 21
targetSdkVersion 26
versionCode 1
versionName "1.0"
minSdkVersion(21)
targetSdkVersion(31)
versionCode = 1
versionName = "1.0"
consumerProguardFiles("consumer-proguard-rules.pro")
}
lintOptions {
Expand All @@ -42,7 +35,6 @@ allprojects {
repositories {
mavenLocal()
google()
jcenter()
mavenCentral()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
Expand All @@ -53,8 +45,8 @@ allprojects {

dependencies {
implementation("com.facebook.react:react-native:+")
implementation("com.launchdarkly:launchdarkly-android-client-sdk:3.1.1")
implementation("com.jakewharton.timber:timber:4.7.1")
implementation("com.google.code.gson:gson:2.8.6")
implementation("com.launchdarkly:launchdarkly-android-client-sdk:3.1.2")
implementation("com.jakewharton.timber:timber:5.0.1")
implementation("com.google.code.gson:gson:2.8.9")
}

2 changes: 1 addition & 1 deletion android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-all.zip
Original file line number Diff line number Diff line change
Expand Up @@ -215,17 +215,7 @@ private void internalConfigure(ReadableMap config, ReadableMap user, final Integ
}

final LDConfig.Builder ldConfigBuilder = configBuild(config);
final LDUser.Builder userBuilder = userBuild(user);

if (ldConfigBuilder == null) {
promise.reject(ERROR_INIT, "Client could not be built using supplied configuration");
return;
}

if (userBuilder == null) {
promise.reject(ERROR_INIT, "User could not be built using supplied configuration");
return;
}
final LDUser ldUser = userBuild(user).build();

if (config.hasKey("allUserAttributesPrivate")
&& config.getType("allUserAttributesPrivate").equals(ConfigEntryType.Boolean.getReadableType())
Expand All @@ -240,10 +230,10 @@ private void internalConfigure(ReadableMap config, ReadableMap user, final Integ
@Override
public void run() {
if (timeout != null) {
LDClient.init(application, ldConfigBuilder.build(), userBuilder.build(), timeout);
LDClient.init(application, ldConfigBuilder.build(), ldUser, timeout);
} else {
try {
LDClient.init(application, ldConfigBuilder.build(), userBuilder.build()).get();
LDClient.init(application, ldConfigBuilder.build(), ldUser).get();
} catch (ExecutionException | InterruptedException e) {
Timber.e(e, "Exception during Client initialization");
}
Expand All @@ -270,13 +260,12 @@ private LDConfig.Builder configBuild(ReadableMap options) {
}

private LDUser.Builder userBuild(ReadableMap options) {
if (!options.hasKey("key")) {
return null;
String userKey = null;
if (options.hasKey("key") && options.getType("key") == ReadableType.String) {
userKey = options.getString("key");
}

String key = options.getString("key");
LDUser.Builder userBuilder = new LDUser.Builder(key);

LDUser.Builder userBuilder = new LDUser.Builder(userKey);
Set<String> privateAttrs = new HashSet<>();

if (options.hasKey("privateAttributeNames") &&
Expand Down Expand Up @@ -612,16 +601,12 @@ public void close(Promise promise) {

@ReactMethod
public void identify(ReadableMap options, final Promise promise) {
final LDUser.Builder userBuilder = userBuild(options);
if (userBuilder == null) {
promise.reject(ERROR_IDENTIFY, "User could not be built using supplied configuration");
return;
}
final LDUser user = userBuild(options).build();
Thread background = new Thread(new Runnable() {
@Override
public void run() {
try {
LDClient.get().identify(userBuilder.build()).get();
LDClient.get().identify(user).get();
promise.resolve(null);
} catch (InterruptedException e) {
Timber.w(e);
Expand All @@ -640,20 +625,15 @@ public void run() {

@ReactMethod
public void alias(String environment, ReadableMap user, ReadableMap previousUser) {
LDUser.Builder userBuilder = userBuild(user);
LDUser.Builder previousUserBuilder = userBuild(previousUser);
if (userBuilder == null || previousUserBuilder == null) {
return;
}
try {
LDClient.getForMobileKey(environment).alias(userBuilder.build(), previousUserBuilder.build());
LDClient.getForMobileKey(environment).alias(userBuild(user).build(), userBuild(previousUser).build());
} catch (LaunchDarklyException e) {
Timber.w("LaunchDarkly alias called with invalid environment");
}
}

@ReactMethod
public void getConnectionMode(String environment,Promise promise) {
public void getConnectionMode(String environment, Promise promise) {
try {
promise.resolve(LDClient.getForMobileKey(environment).getConnectionInformation().getConnectionMode().name());
} catch (Exception e) {
Expand All @@ -662,7 +642,7 @@ public void getConnectionMode(String environment,Promise promise) {
}

@ReactMethod
public void getLastSuccessfulConnection(String environment,Promise promise) {
public void getLastSuccessfulConnection(String environment, Promise promise) {
try {
promise.resolve(LDClient.getForMobileKey(environment).getConnectionInformation().getLastSuccessfulConnection().intValue());
} catch (Exception e) {
Expand All @@ -671,7 +651,7 @@ public void getLastSuccessfulConnection(String environment,Promise promise) {
}

@ReactMethod
public void getLastFailedConnection(String environment,Promise promise) {
public void getLastFailedConnection(String environment, Promise promise) {
try {
promise.resolve(LDClient.getForMobileKey(environment).getConnectionInformation().getLastFailedConnection().intValue());
} catch (Exception e) {
Expand All @@ -680,7 +660,7 @@ public void getLastFailedConnection(String environment,Promise promise) {
}

@ReactMethod
public void getLastFailure(String environment,Promise promise) {
public void getLastFailure(String environment, Promise promise) {
try {
promise.resolve(LDClient.getForMobileKey(environment).getConnectionInformation().getLastFailure().getFailureType().name());
} catch (Exception e) {
Expand Down
9 changes: 8 additions & 1 deletion index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,15 @@ declare module 'launchdarkly-react-native-client-sdk' {

/**
* A unique string identifying a user.
*
* If this value is not provided, a key will be generated automatically and the `anonymous`
* property of the user will be set to `true`. The SDK will provide a key value that is
* non-identifying, unique between devices, but usually stable between launches of the
* application on a specific device. The SDK cannot guarantee the value will not change
* between launches as the platform may change identifiers provided to the application or
* remove the locally stored application data.
*/
key: string;
key?: string;

/**
* The secondary key for the user. See the
Expand Down
2 changes: 1 addition & 1 deletion ios/LaunchdarklyReactNativeClient.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ Pod::Spec.new do |s|
s.swift_version = "5.0"

s.dependency "React"
s.dependency "LaunchDarkly", "5.4.3"
s.dependency "LaunchDarkly", "5.4.4"

end
Loading