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

Commit

Permalink
prepare 7.0.2 release (#189)
Browse files Browse the repository at this point in the history
* [sc-190014] Merge 7.0 for u2c release (#143)

* Update swift and android sdk dependencies

* Initial commit

* TODO: comment out private attributes config and figure out later

* Remove erroneous type annotation

* TODO: fix deprecated config settings

* Added todos to map deprecated android config

* Initial refactor to move deprecated android config items

* Start implementing deprecated config options

* Implement android sdk major changes

* Removed deprecated config options

* Remove pollUri to use streaming and default endpoints

* Implemented typescript changes

* Renamed xxxUri to xxxUrl

* Implemented swift config option changes

* Fixed Reference creation for private context attributes

* Update modd.conf

* Removed jcenter

* Reinstate user.privateAttributeNames because that should stay frozen

* PR feedback

* Update test-types.ts

* Remove unnecessary stream: true config default

* [sc-188224] Adios old rn versions

* Set example app min ios target to 12.4 as mandated by rn 0.70. Improve local dev modd experience.

* Added yarn-all scripts

* Fixed broken tests by adding babel config and removing redundant transform.js

* Remove old rn versions from CI

* Force npm i to get around rn 6.3.0 still supporting old rn versions

* Increase circleci macos resource to large

* [sc-188335] Add u2c support (#140)

* Added js common sdk context helper files. First attempt to implement glue code from js to android sdk.

* Validate context in js before initializing ldclient

* Added multi context support. Dry'd context manipulation logic.

* Copy src folder to node_modules so its part of the npm package

* Added arbitrary attributes mapping logic

* Replaced src/common sdk files with actual js common sdk package

* Refactored init code to be more robust with errors. Dry'd init logic.

* Implemented identify logic for context. Changed example app to use multi context.

* Autogenerate keys for anonymous context

* Removed console logs and dry'd logic

* Added contextUtils. Refactored isContext to js.

* Initial attempt at ios context implementation

* First cut ios implementation

* Refactored helper functions to its own utils class. Added android unit tests.

* Added multicontext tests

* Added ios Podfile and fix dev build. Added swift unit tests.

* Added swift unit test scaffold

* Update Tests.swift

* Improve ios unit tests

* Speed up hot reload by replacing cp with rsync. Dry'd dir paths eliminating repetitions.

* Update Tests.swift

* Update .gitignore

* Added more context and config tests

* Add unit test for config build

* Update modd-android.conf

* Added contextUtils tests

* Added typescript support for example app to test types. Replaced cp with rsync to speed up local dev. Improved tsconfig to use out of the box rn config.

* Use common types for LDUser, LDContext and LDMultiKindContext

* Update LaunchdarklyReactNativeClient.xcscheme

* Update App.tsx

* Prettified changelog

* Updated common sdk version

* Replaced user references with context

* Use trySetValue for key, name and anonymous

* Update config.yml

* Added files property to specify only necessary files for npm publish

* Exclude android test files from npm publish

* Replace print with NSLog

* Revert prettier changes. Ignore changelog from prettier.

* Corrected misspelling of filename.

* Added newline at eof

* [sc-189696] Fix auto generation of anonymous keys (#141)

* Initial commit

* Rollback swift changes

* Swift changes.

* Updated js tests

* Don't generate keys in js and defer context validation to native sdks

* Update Tests.swift

* Add java anonymous key test

* Add github actions for tests

* Update main.yml

* Remove js tests from cicleci to github action. Prettified circleci config.

* Update config.yml

* Update config.yml

* Update config.yml

* Update config.yml

* Add ios test job

* Update main.yml

* Update main.yml

* Update main.yml

* Update main.yml

* Update main.yml

* Update main.yml

* Update main.yml

* Update main.yml

* Cache pods and quiet xcodebuild

* Update main.yml

* Update main.yml

* Update main.yml

* Update main.yml

* Restore other tests

---------

Co-authored-by: Yusinto Ngadiman <yus@launchdarkly.com>

* Fixed formatting of ga yml

---------

Co-authored-by: Yusinto Ngadiman <yus@launchdarkly.com>

* [sc-169352] Add ldClient nil guards (#142)

Update LaunchdarklyReactNativeClient.swift

* Attempt to fix broken ios tests

* Bust Pod cache

* Update config.yml

---------

Co-authored-by: Yusinto Ngadiman <yus@launchdarkly.com>

* [sc-190127] Update npm package-lock (#144)

* [sc-190127] Update npm package-lock

* Update pod cache key

* Update yarn.lock

* Update yarn.lock

* Update yarn.lock

* Update package.json

* Downgrade typescript version to fix typedoc issues

* Update main.yml

* [sc-178013] Add android null guards for LDClient (#145)

* Bump rn sdk to v7

* [sc-178013] Add null guards for LDClient

* Improved warning messages

* Update LaunchdarklyReactNativeClientModule.java

---------

Co-authored-by: Yusinto Ngadiman <yus@launchdarkly.com>

* Update yarn.lock

---------

Co-authored-by: Yusinto Ngadiman <yusinto@gmail.com>
Co-authored-by: Yusinto Ngadiman <yus@launchdarkly.com>
Co-authored-by: LaunchDarklyReleaseBot <launchdarklyreleasebot@launchdarkly.com>
  • Loading branch information
4 people authored Mar 2, 2023
1 parent 5d93caa commit 1239a42
Show file tree
Hide file tree
Showing 4 changed files with 4,352 additions and 4,800 deletions.
2 changes: 1 addition & 1 deletion ManualTestApp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
},
"dependencies": {
"@react-native-picker/picker": "^2.2.1",
"launchdarkly-react-native-client-sdk": "^6.3.0",
"launchdarkly-react-native-client-sdk": "^7.0.1",
"react": "^18.2.0",
"react-native": "0.70.7"
},
Expand Down
31 changes: 26 additions & 5 deletions ManualTestApp/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1613,7 +1613,7 @@ balanced-match@^1.0.0:
resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee"
integrity sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==

base64-js@^1.1.2, base64-js@^1.3.1:
base64-js@^1.1.2, base64-js@^1.3.0, base64-js@^1.3.1:
version "1.5.1"
resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.5.1.tgz#1b1b440160a5bf7ad40b650f095963481903930a"
integrity sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==
Expand Down Expand Up @@ -2525,6 +2525,11 @@ extglob@^2.0.4:
snapdragon "^0.8.1"
to-regex "^3.0.1"

fast-deep-equal@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz#7b05218ddf9667bf7f370bf7fdb2cb15fdd0aa49"
integrity sha512-bCK/2Z4zLidyB4ReuIsvALH6w31YfAQDmXMqMx6FyfHqvBxtjC0eRumeSu4Bs3XtXwpyIywtSTrVT99BxY1f9w==

fast-deep-equal@^3.1.1, fast-deep-equal@^3.1.3:
version "3.1.3"
resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525"
Expand Down Expand Up @@ -3549,10 +3554,21 @@ kleur@^3.0.3:
resolved "https://registry.yarnpkg.com/kleur/-/kleur-3.0.3.tgz#a79c9ecc86ee1ce3fa6206d1216c501f147fc07e"
integrity sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w==

launchdarkly-react-native-client-sdk@^6.3.0:
version "6.3.0"
resolved "https://registry.yarnpkg.com/launchdarkly-react-native-client-sdk/-/launchdarkly-react-native-client-sdk-6.3.0.tgz#a0c067732c9c6df48272a005c2ea1978497f7c79"
integrity sha512-ckrbU+h5LwmnkKRRE2ij2cw5rPSYbI9nbJVjjv3dj/sVvd7ijyeFmbqaj/FhB2kFypo5KNnJ2r0DvufRWMwquw==
launchdarkly-js-sdk-common@5.0.2:
version "5.0.2"
resolved "https://registry.yarnpkg.com/launchdarkly-js-sdk-common/-/launchdarkly-js-sdk-common-5.0.2.tgz#c1b6943a2a4038c31ee3cfdba18f347382a33529"
integrity sha512-fD4YndDUVWSyAFE2NdzeBSgpjPxyRN8+mz3p+VXKnDAPt3bdzGIEHrvusbY/K8fKZjpo4vRd7soNiA1EejkEPQ==
dependencies:
base64-js "^1.3.0"
fast-deep-equal "^2.0.1"
uuid "^8.0.0"

launchdarkly-react-native-client-sdk@^7.0.1:
version "7.0.1"
resolved "https://registry.yarnpkg.com/launchdarkly-react-native-client-sdk/-/launchdarkly-react-native-client-sdk-7.0.1.tgz#2dc19983526b08623bdb7a912d55cc81e383c29d"
integrity sha512-1TdcU2IT8gN8YiBklPnBdJsOjirAQB10r8cBItAYC0CBuWluvnn+faegLFABQAA58AOeYqfUrfPosX+LUKnR9w==
dependencies:
launchdarkly-js-sdk-common "5.0.2"

leven@^3.1.0:
version "3.1.0"
Expand Down Expand Up @@ -5536,6 +5552,11 @@ utils-merge@1.0.1:
resolved "https://registry.yarnpkg.com/utils-merge/-/utils-merge-1.0.1.tgz#9f95710f50a267947b2ccc124741c1028427e713"
integrity sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==

uuid@^8.0.0:
version "8.3.2"
resolved "https://registry.yarnpkg.com/uuid/-/uuid-8.3.2.tgz#80d5b5ced271bb9af6c445f21a1a04c606cefbe2"
integrity sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==

vary@~1.1.2:
version "1.1.2"
resolved "https://registry.yarnpkg.com/vary/-/vary-1.1.2.tgz#2299f02c6ded30d4a5961b0b9f74524a18f634fc"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ExecutionException;

import timber.log.Timber;

Expand Down Expand Up @@ -133,14 +132,6 @@ && validateConfig("debugMode", configMap, ReadableType.Boolean)
LaunchdarklyReactNativeClientModule.debugLoggingStarted = true;
}

try {
LDClient.get();
promise.reject(ERROR_INIT, "Client was already initialized");
return;
} catch (LaunchDarklyException e) {
// This exception indicates that the SDK has not been initialized yet
}

final Application application = (Application) getReactApplicationContext().getApplicationContext();

if (application != null) {
Expand Down Expand Up @@ -495,25 +486,16 @@ private ObjectBuilder objectBuilderFromDetail(EvaluationDetail<?> detail) {

@ReactMethod
public void allFlags(String environment, Promise promise) {
try {
LDClient.get();
} catch (LaunchDarklyException e) {
promise.reject(ERROR_INIT, "SDK has been not configured");
return;
}
ObjectBuilder resultBuilder = LDValue.buildObject();

try {
ObjectBuilder resultBuilder = LDValue.buildObject();
for (Map.Entry<String, LDValue> entry : LDClient.getForMobileKey(environment).allFlags().entrySet()) {
resultBuilder.put(entry.getKey(), entry.getValue());
}
promise.resolve(ldValueToBridge(resultBuilder.build()));
} catch (LaunchDarklyException e) {
// Since we confirmed the SDK has been configured, this exception should only be thrown if the env doesn't exist
promise.reject(ERROR_UNKNOWN, "SDK not configured with requested environment");
} catch (Exception e) {
promise.reject(ERROR_UNKNOWN, "Unknown exception in allFlags");
Timber.w(e);
Timber.w(e, "Warning: exception caught in allFlags");
promise.resolve(ldValueToBridge(resultBuilder.build()));
}
}

Expand Down Expand Up @@ -546,7 +528,8 @@ public void setOffline(Promise promise) {
LDClient.get().setOffline();
promise.resolve(true);
} catch (Exception e) {
promise.reject(ERROR_UNKNOWN, e);
Timber.w(e, "Warning: exception caught in setOffline");
promise.resolve(null);
}
}

Expand All @@ -556,7 +539,8 @@ public void isOffline(Promise promise) {
boolean result = LDClient.get().isOffline();
promise.resolve(result);
} catch (Exception e) {
promise.reject(ERROR_UNKNOWN, e);
Timber.w(e, "Warning: exception caught in isOffline");
promise.resolve(null);
}
}

Expand All @@ -566,7 +550,8 @@ public void setOnline(Promise promise) {
LDClient.get().setOnline();
promise.resolve(true);
} catch (Exception e) {
promise.reject(ERROR_UNKNOWN, e);
Timber.w(e, "Warning: exception caught in setOnline");
promise.resolve(null);
}
}

Expand All @@ -585,7 +570,7 @@ public void flush() {
try {
LDClient.get().flush();
} catch (Exception e) {
Timber.w(e);
Timber.w(e, "Warning: exception caught in flush");
}
}

Expand All @@ -595,7 +580,8 @@ public void close(Promise promise) {
LDClient.get().close();
promise.resolve(true);
} catch (Exception e) {
promise.reject(ERROR_CLOSE, e);
Timber.w(e, "Warning: exception caught in close");
promise.resolve(null);
}
}

Expand All @@ -609,19 +595,14 @@ public void identify(ReadableMap contextMap, boolean isContext, final Promise pr
public void run() {
try {
LDClient.get().identify(context).get();
promise.resolve(null);
} catch (InterruptedException e) {
Timber.w(e);
promise.reject(ERROR_IDENTIFY, "Identify Interrupted");
} catch (ExecutionException e) {
Timber.w(e);
promise.reject(ERROR_IDENTIFY, "Exception while executing identify");
} catch (Exception e) {
Timber.w(e);
promise.reject(ERROR_UNKNOWN, e);
Timber.w(e, "Warning: exception caught in identify");
}

promise.resolve(null);
}
});

background.start();
} else {
final LDUser user = configureLegacyUser(contextMap);
Expand All @@ -630,19 +611,14 @@ public void run() {
public void run() {
try {
LDClient.get().identify(user).get();
promise.resolve(null);
} catch (InterruptedException e) {
Timber.w(e);
promise.reject(ERROR_IDENTIFY, "Identify Interrupted");
} catch (ExecutionException e) {
Timber.w(e);
promise.reject(ERROR_IDENTIFY, "Exception while executing identify");
} catch (Exception e) {
Timber.w(e);
promise.reject(ERROR_UNKNOWN, e);
Timber.w(e, "Warning: exception caught in identify");
}

promise.resolve(null);
}
});

background.start();
}
}
Expand All @@ -652,7 +628,8 @@ public void getConnectionMode(String environment, Promise promise) {
try {
promise.resolve(LDClient.getForMobileKey(environment).getConnectionInformation().getConnectionMode().name());
} catch (Exception e) {
promise.reject(ERROR_UNKNOWN, e);
Timber.w(e, "Warning: exception caught in getConnectionMode");
promise.resolve(null);
}
}

Expand All @@ -661,7 +638,8 @@ public void getLastSuccessfulConnection(String environment, Promise promise) {
try {
promise.resolve(LDClient.getForMobileKey(environment).getConnectionInformation().getLastSuccessfulConnection().intValue());
} catch (Exception e) {
promise.reject(ERROR_UNKNOWN, e);
Timber.w(e, "Warning: exception caught in getLastSuccessfulConnection");
promise.resolve(0);
}
}

Expand All @@ -670,7 +648,8 @@ public void getLastFailedConnection(String environment, Promise promise) {
try {
promise.resolve(LDClient.getForMobileKey(environment).getConnectionInformation().getLastFailedConnection().intValue());
} catch (Exception e) {
promise.reject(ERROR_UNKNOWN, e);
Timber.w(e, "Warning: exception caught in getLastFailedConnection");
promise.resolve(0);
}
}

Expand All @@ -679,7 +658,8 @@ public void getLastFailure(String environment, Promise promise) {
try {
promise.resolve(LDClient.getForMobileKey(environment).getConnectionInformation().getLastFailure().getFailureType().name());
} catch (Exception e) {
promise.reject(ERROR_UNKNOWN, e);
Timber.w(e, "Warning: exception caught in getLastSuccessfulConnection");
promise.resolve(null);
}
}

Expand Down Expand Up @@ -707,7 +687,7 @@ public void onFeatureFlagChange(String flagKey) {
LDClient.getForMobileKey(environment).registerFeatureFlagListener(flagKey, listener);
listeners.put(flagKey, listener);
} catch (Exception e) {
Timber.w(e);
Timber.w(e, "Warning: exception caught in registerFeatureFlagListener");
}
}

Expand All @@ -720,7 +700,7 @@ public void unregisterFeatureFlagListener(String flagKey, String environment) {
listeners.remove(multiListenerId);
}
} catch (Exception e) {
Timber.w(e);
Timber.w(e, "Warning: exception caught in unregisterFeatureFlagListener");
}
}

Expand Down Expand Up @@ -748,7 +728,7 @@ public void onInternalFailure(LDFailure ldFailure) {
LDClient.getForMobileKey(environment).registerStatusListener(listener);
connectionModeListeners.put(multiListenerId, listener);
} catch (Exception e) {
Timber.w(e);
Timber.w(e, "Warning: exception caught in registerCurrentConnectionModeListener");
}
}

Expand All @@ -761,7 +741,7 @@ public void unregisterCurrentConnectionModeListener(String listenerId, String en
connectionModeListeners.remove(multiListenerId);
}
} catch (Exception e) {
Timber.w(e);
Timber.w(e, "Warning: exception caught in unregisterCurrentConnectionModeListener");
}
}

Expand All @@ -785,7 +765,7 @@ public void onChange(List<String> flagKeys) {
LDClient.getForMobileKey(environment).registerAllFlagsListener(listener);
allFlagsListeners.put(multiListenerId, listener);
} catch (Exception e) {
Timber.w(e);
Timber.w(e, "Warning: exception caught in registerAllFlagsListener");
}
}

Expand All @@ -798,7 +778,7 @@ public void unregisterAllFlagsListener(String listenerId, String environment) {
allFlagsListeners.remove(multiListenerId);
}
} catch (Exception e) {
Timber.w(e);
Timber.w(e, "Warning: exception caught in unregisterAllFlagsListener");
}
}

Expand Down
Loading

0 comments on commit 1239a42

Please sign in to comment.