Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
85c41f8
chore: Added Storage api.
yusinto Dec 5, 2023
6c7f556
chore: replace connecting with initializing
yusinto Dec 11, 2023
7bf3327
chore: added type LDFlagChangeset. Fix storage set signature.
yusinto Dec 11, 2023
d95df72
chore: added fast-deep-equal. removed unused api methods.
yusinto Dec 11, 2023
e2f3cb4
chore: added skeleton to sync cached and put flags.
yusinto Dec 11, 2023
bc4e3de
chore: implement storage and put sync logic
yusinto Dec 11, 2023
63e6d3c
fix: export platform.Storage.
yusinto Dec 11, 2023
682e3ea
chore: implemented rn storage platform.
yusinto Dec 11, 2023
269b02f
chore: add local copy of fast-deep-equal. add storage tests.
yusinto Dec 13, 2023
8493374
fix: fixed hanging unit tests due to emits not being awaited. added m…
yusinto Dec 13, 2023
470a3fc
chore: added community rn async storage package.
yusinto Dec 13, 2023
460507a
fix: added internalOptions to configure events and diagnostic endpoin…
yusinto Dec 14, 2023
6a62c6a
fix: make internalOptions optional and fixed unit tests. removed redu…
yusinto Dec 14, 2023
ed4bb3a
chore: add unit test for internal options.
yusinto Dec 14, 2023
9f5eb03
fix: fix bug where change event emits wrong flag values. added versio…
yusinto Dec 15, 2023
b281b38
fix: when syncing only update memory cache and storage if there's cha…
yusinto Dec 15, 2023
78074fa
chore: added more patch unit tests.
yusinto Dec 15, 2023
34ad378
chore: added delete unit tests.
yusinto Dec 15, 2023
371351c
Update LDClientImpl.ts
yusinto Dec 15, 2023
30f5ace
chore: pretty print json debug output.
yusinto Dec 15, 2023
92361aa
fix: sse patch now updates react context. improved logging. TODO: fix…
yusinto Dec 16, 2023
78dc729
chore: added TODO comment.
yusinto Dec 16, 2023
7283b39
fix: remove unnecessary event listeners to fix infinite loops on errors.
yusinto Dec 18, 2023
ad0f124
chore: catch identify errors.
yusinto Dec 18, 2023
80cc003
chore: improved example.
yusinto Dec 18, 2023
6791a37
Update fetchUtils.test.ts
yusinto Dec 18, 2023
a0f916a
chore: improve npm commands.
yusinto Dec 18, 2023
8c19529
chore: remove async-storage dep from package.json
yusinto Dec 18, 2023
02f5c36
chore: added comments on how to install async-storage.
yusinto Dec 18, 2023
42c3bc6
chore: remove redundant ts-ignore
yusinto Dec 18, 2023
acd16db
chore: improved logging, cleaned up comments, added comments, removed…
yusinto Dec 19, 2023
87d09ba
chore: improve logging.
yusinto Dec 19, 2023
713221e
chore: localstorage pr feedback (#327)
yusinto Dec 20, 2023
87ca38b
chore: include example/yarn.lock because the example app is its own i…
yusinto Dec 20, 2023
c849f8c
Update .gitignore
yusinto Dec 20, 2023
c527400
chore: pitstop. 0.70.x is the last version native AsyncStorage is ava…
yusinto Dec 20, 2023
3f1d15e
chore: success! using try catch to conditionally require the correct …
yusinto Dec 20, 2023
8e9a0c1
chore: improve comments.
yusinto Dec 20, 2023
262d9f3
Merge branch 'main' into yus/sc-227636/rn-should-import-asyncstorage-…
yusinto Dec 22, 2023
38cac64
chore: fix rn peerdep version. remove duplicate comments re asyncstor…
yusinto Dec 22, 2023
4c1dfea
Update ConditionalAsyncStorage.ts
yusinto Dec 22, 2023
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
4 changes: 3 additions & 1 deletion packages/sdk/react-native/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@
"ios": "yarn && yarn ./example && yarn build && (cd example/ && yarn ios-go)"
},
"peerDependencies": {
"react": "*"
"react": "*",
"react-native": "*"
},
"dependencies": {
"@launchdarkly/js-client-sdk-common": "0.0.1",
Expand All @@ -64,6 +65,7 @@
"launchdarkly-js-test-helpers": "^2.2.0",
"prettier": "^3.0.0",
"react": "^18.2.0",
"react-native": "^0.73.1",
"rimraf": "^5.0.5",
"ts-jest": "^29.1.0",
"typedoc": "0.25.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/* eslint-disable import/no-mutable-exports,global-require */

/**
* For react-native version >= 0.71, the LaunchDarkly React-Native SDK uses
* @react-native-async-storage/async-storage for bootstrapping. This is a native
* dependency.
*
* If you are using expo, then adding the LaunchDarkly React Native
* SDK from npm and re-running pod install should suffice.
*
* If you are not using expo, you will need to explicitly add
* @react-native-async-storage/async-storage as a dependency to your project
* and re-run pod install for auto-linking to work. This is because auto-link
* does not work with transitive dependencies:
* https://github.com/react-native-community/cli/issues/1347
*
* For react-native version < 0.71, the built-in react-native AsyncStorage
* module is used.
*/
let ConditionalAsyncStorage: any;

try {
// react-native version < 0.71
ConditionalAsyncStorage = require('react-native').AsyncStorage;
} catch (e) {
// react-native version >= 0.71
ConditionalAsyncStorage = require('@react-native-async-storage/async-storage').default;
}

export default ConditionalAsyncStorage;
Original file line number Diff line number Diff line change
@@ -1,20 +1,4 @@
/* eslint-disable max-classes-per-file */

/**
* The LaunchDarkly SDK uses async-storage for bootstrapping and this is a native
* dependency.
*
* If you are using expo, then adding the LaunchDarkly React Native
* SDK from npm and re-running pod install should suffice.
*
* If you are not using expo, you will need to explicitly add
* @react-native-async-storage/async-storage as a dependency to your project
* and re-run pod install for auto-linking to work. This is because auto-link
* does not work with transitive dependencies:
* https://github.com/react-native-community/cli/issues/1347
*/
import AsyncStorage from '@react-native-async-storage/async-storage';

import type {
Crypto,
Encoding,
Expand All @@ -34,9 +18,10 @@ import type {
Storage,
} from '@launchdarkly/js-client-sdk-common';

import { name, version } from '../package.json';
import { btoa, uuidv4 } from './polyfills';
import RNEventSource from './react-native-sse';
import { name, version } from '../../package.json';
import { btoa, uuidv4 } from '../polyfills';
import RNEventSource from '../react-native-sse';
import AsyncStorage from './ConditionalAsyncStorage';

class PlatformRequests implements Requests {
createEventSource(url: string, eventSourceInitDict: EventSourceInitDict): EventSource {
Expand Down