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
73 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
808b306
merge from public after release
Jan 21, 2022
1da708d
[sc-139041] Fix releaser typedoc generation (#106)
gwhelanLD Feb 8, 2022
a54ca2d
Have podspec retrieve version from package.json to allow using defaul…
gwhelanLD Feb 8, 2022
f38a2aa
Fix iOS jsonVariation and jsonVariationDetail when using array defaul…
gwhelanLD Feb 8, 2022
e78af59
Completely rework CI build to not use hello-react-native (#109)
gwhelanLD Feb 10, 2022
07f3c8f
Include manual testing application in repo (#110)
gwhelanLD Feb 10, 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
174 changes: 99 additions & 75 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,81 +1,117 @@
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:
# This job simulates integrating the SDK into a freshly created React Native project template and
# then builds Android and iOS applications using the template.
build-applications-using-template:
parameters:
hello-app-branch:
rn-version:
description: The React Native project template version
type: string
xcode-version:
description: The Xcode version to build with
type: string

executor:
name: android/android-machine
resource-class: large
macos:
xcode: <<parameters.xcode-version>>
resource_class: macos.x86.medium.gen2

environment:
ANDROID_SDK_ROOT: "/tmp/Android"

steps:
- checkout

- 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
name: Download Android command line tools
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
mkdir -p $ANDROID_SDK_ROOT/cmdline-tools/latest
curl https://dl.google.com/android/repository/commandlinetools-mac-8092744_latest.zip -o cmdline-tools.zip
unzip cmdline-tools.zip
mv cmdline-tools/* $ANDROID_SDK_ROOT/cmdline-tools/latest/
yes | $ANDROID_SDK_ROOT/cmdline-tools/latest/bin/sdkmanager --licenses > /dev/null || true

- run:
name: Setup debug keystore
name: Setup Android 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: "12.4.0"
steps:
- checkout
- 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
- restore_cache:
name: Restore RN project template from cache
key: v1-rn-template-cache-<<parameters.rn-version>>

- run:
name: Create CI test application for RN <<parameters.rn-version>>
command: |
[ -d "CITest" ] || npx react-native init CITest --version <<parameters.rn-version>> --skip-install

- save_cache:
name: Save RN project template to cache
key: v1-rn-template-cache-<<parameters.rn-version>>
paths:
- CITest

# See the `patches` directory
- run:
name: Build bundle
name: Do any necessary patching
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
if [ -d ".circleci/patches/<<parameters.rn-version>>" ]; then cp -r .circleci/patches/<<parameters.rn-version>>/* CITest/; fi
if [ -x "CITest/patch.sh" ] ; then cd CITest && ./patch.sh; fi

- run:
name: Add LaunchDarkly dependency
command: cd CITest && npx yarn add file:..

- restore_cache:
name: Restore gem cache
key: v1-gem-cache-<<parameters.xcode-version>>-

# Newer cocoapods fixes Swift library auto-linking errors
- run:
name: Build application
name: Update CocoaPods
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=
sudo gem cleanup
# Used as cache key to prevent storing redundant caches
gem list > /tmp/cache-key.txt

common:
- save_cache:
name: Save gem cache
key: v1-gem-cache-<<parameters.xcode-version>>-{{ checksum "/tmp/cache-key.txt" }}
paths:
- ~/.gem

- run:
name: Install iOS Pods
command: cd CITest/ios && pod install

- run:
name: Build application for iOS (Release)
command: |
mkdir -p artifacts
cd CITest/ios
xcodebuild -workspace CITest.xcworkspace -scheme CITest build -configuration Release -destination "generic/platform=iOS" CODE_SIGNING_ALLOWED=NO GCC_WARN_INHIBIT_ALL_WARNINGS=YES | tee '../../artifacts/xcb-<<parameters.rn-version>>.txt' | xcpretty

- when:
# We only care to build Android application and debug iOS Build for a single XCode version
condition:
equal: [ 13.2.1, << parameters.xcode-version >> ]
steps:
- run:
name: Build application for iOS (Debug)
command: |
cd CITest/ios
xcodebuild -workspace CITest.xcworkspace -scheme CITest build -configuration Debug -destination "generic/platform=iOS" CODE_SIGNING_ALLOWED=NO GCC_WARN_INHIBIT_ALL_WARNINGS=YES | tee '../../artifacts/xcb-<<parameters.rn-version>>.txt' | xcpretty
- run:
name: Build application for Android
command: cd CITest/android && ./gradlew packageRelease

- store_artifacts:
path: artifacts

test-javascript:
docker:
- image: cimg/node:current
steps:
Expand All @@ -95,26 +131,14 @@ jobs:

workflows:
version: 2
android-ios:
all-tests:
jobs:
- common
- android:
name: Android + RN 0.63
hello-app-branch: rn-0.63
requires:
- common
- ios:
name: iOS + RN 0.63
hello-app-branch: rn-0.63
requires:
- common
- android:
name: Android + RN 0.64
hello-app-branch: rn-0.64
requires:
- common
- ios:
name: iOS + RN 0.64
hello-app-branch: rn-0.64
- test-javascript
- build-applications-using-template:
name: rn<<matrix.rn-version>>-xc<<matrix.xcode-version>>-build-apps-using-template
matrix:
parameters:
rn-version: ["0.64.3", "0.65.2", "0.66.4", "0.67.2"]
xcode-version: ["12.2.0", "12.5.1", "13.2.1"]
requires:
- common
- test-javascript
5 changes: 5 additions & 0 deletions .circleci/patches/0.65.2/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
## Patch for React Native project template 0.65.2

After XCode 12.5, the `RCT-Folly` transitive dependency causes build errors. This patch overrides
some of `RCT-Folly`'s build configurations by patching the template's `Podfile`. See
[facebook/folly#1470](https://github.com/facebook/folly/issues/1470) for more details.
3 changes: 3 additions & 0 deletions .circleci/patches/0.65.2/patch.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

patch -p0 -u < podfile.patch
16 changes: 16 additions & 0 deletions .circleci/patches/0.65.2/podfile.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
--- ios/Podfile
+++ ios/Podfile
@@ -25,5 +25,13 @@

post_install do |installer|
react_native_post_install(installer)
+ installer.pods_project.targets.each do |target|
+ if target.name == "RCT-Folly"
+ target.build_configurations.each do |config|
+ config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '10.0'
+ config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= ['$(inherited)', 'FOLLY_HAVE_CLOCK_GETTIME=1']
+ end
+ end
+ end
end
end
14 changes: 14 additions & 0 deletions .circleci/patches/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
## Patches for running React Native application templates in CI

Some versions of the React Native project templates no longer function without modification with
newer XCode. We verify this library builds against supported versions of React Native in the
[CircleCI configuration](../.circleci/config.yml) by building the project templates with the SDK
added as a dependency. This directory contains the required files to patch each project template
that we are testing that does not work without modification.

Before installing the dependencies and integrating the SDK into the project, the CI jobs checks here
for a directory with the name of the React Native project template version that is being tested. If
the directory exists, the files are copied into the project. Then, if an executable file called
`patch.sh` now exists in the project template, it is run.

Further details of what patching is required is included in each version's subdirectory.
13 changes: 8 additions & 5 deletions .ldrelease/config.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
version: 2

repo:
public: react-native-client-sdk
private: react-native-client-sdk-private
Expand All @@ -6,13 +8,14 @@ publications:
- url: https://www.npmjs.com/package/launchdarkly-react-native-client-sdk
description: npm

template:
name: npm
skip:
- test
jobs:
- docker:
image: node:16-buster
template:
name: npm

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

sdk:
Expand Down
7 changes: 0 additions & 7 deletions .ldrelease/update-version.sh

This file was deleted.

24 changes: 17 additions & 7 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,23 @@ Build instructions

### Prerequisites

This SDK requires that you have [`npm`](https://www.npmjs.com/) and [`react-native-cli`](https://www.npmjs.com/package/react-native-cli) installed in order to develop with it.
Follow the [React Native development environment setup guide](https://reactnative.dev/docs/environment-setup) to install all required tools for contributing to the project.

### Building and running
### Building and testing

You can modify and verify changes by developing within the LaunchDarkly React Native SDK sample application (`hello-react-native`).
First, install the dependencies by running:
```
npm install
```

1. Clone and setup the [`hello-react-native`](https://github.com/launchdarkly/hello-react-native) repository.
2. In your `hello-react-native` directory, copy your `react-native-client-sdk` directory into `node_modules` as `launchdarkly-react-native-client-sdk`. Alternatively, you can use [wml](https://github.com/wix/wml) to monitor and copy files.
3. Launch your emulator (`emulator -avd <NAME>` for Android) or connect your device.
4. Test your changes in `hello-react-native` by running either `react-native run-ios` or `react-native run-android` depending on your desired runtime environment.
To run tests of the JavaScript portion of the implementation:
```
npm test
```

To validate the TypeScript module definition, run:
```
npm run check-typescript
```

Testing the native module implementation must be done by integrating the SDK into an application, such as one created with `npx react-native init`.
6 changes: 6 additions & 0 deletions ManualTestApp/.buckconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

[android]
target = Google Inc.:Google APIs:23

[maven_repositories]
central = https://repo1.maven.org/maven2
4 changes: 4 additions & 0 deletions ManualTestApp/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = {
root: true,
extends: '@react-native-community',
};
65 changes: 65 additions & 0 deletions ManualTestApp/.flowconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
[ignore]
; We fork some components by platform
.*/*[.]android.js

; Ignore "BUCK" generated dirs
<PROJECT_ROOT>/\.buckd/

; Ignore polyfills
node_modules/react-native/Libraries/polyfills/.*

; Flow doesn't support platforms
.*/Libraries/Utilities/LoadingView.js

[untyped]
.*/node_modules/@react-native-community/cli/.*/.*

[include]

[libs]
node_modules/react-native/interface.js
node_modules/react-native/flow/

[options]
emoji=true

exact_by_default=true

format.bracket_spacing=false

module.file_ext=.js
module.file_ext=.json
module.file_ext=.ios.js

munge_underscores=true

module.name_mapper='^react-native/\(.*\)$' -> '<PROJECT_ROOT>/node_modules/react-native/\1'
module.name_mapper='^@?[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> '<PROJECT_ROOT>/node_modules/react-native/Libraries/Image/RelativeImageStub'

suppress_type=$FlowIssue
suppress_type=$FlowFixMe
suppress_type=$FlowFixMeProps
suppress_type=$FlowFixMeState

[lints]
sketchy-null-number=warn
sketchy-null-mixed=warn
sketchy-number=warn
untyped-type-import=warn
nonstrict-import=warn
deprecated-type=warn
unsafe-getters-setters=warn
unnecessary-invariant=warn
signature-verification-failure=warn

[strict]
deprecated-type
nonstrict-import
sketchy-null
unclear-type
unsafe-getters-setters
untyped-import
untyped-type-import

[version]
^0.162.0
Loading