-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: rn sdk use localstorage for bootstrapping #326
Changes from 26 commits
85c41f8
6c7f556
7bf3327
d95df72
e2f3cb4
bc4e3de
63e6d3c
682e3ea
269b02f
8493374
470a3fc
460507a
6a62c6a
ed4bb3a
9f5eb03
b281b38
78074fa
34ad378
371351c
30f5ace
92361aa
78dc729
7283b39
ad0f124
80cc003
6791a37
a0f916a
8c19529
02f5c36
42c3bc6
acd16db
87d09ba
713221e
87ca38b
c849f8c
55e664c
f35bada
597e439
eb61ced
58f72c1
d8a4cbb
382e519
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,33 @@ | ||
import { | ||
base64UrlEncode, | ||
BasicLogger, | ||
internal, | ||
LDClientImpl, | ||
type LDContext, | ||
type LDOptions, | ||
} from '@launchdarkly/js-client-sdk-common'; | ||
|
||
import platform from './platform'; | ||
import createPlatform from './platform'; | ||
|
||
export default class ReactNativeLDClient extends LDClientImpl { | ||
constructor(sdkKey: string, options: LDOptions = {}) { | ||
const logger = | ||
options.logger ?? | ||
new BasicLogger({ | ||
level: 'info', | ||
level: 'debug', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I intentionally left this as |
||
// eslint-disable-next-line no-console | ||
destination: console.log, | ||
}); | ||
super(sdkKey, platform, { ...options, logger }); | ||
|
||
const internalOptions: internal.LDInternalOptions = { | ||
analyticsEventPath: `/mobile`, | ||
diagnosticEventPath: `/mobile/events/diagnostic`, | ||
}; | ||
|
||
super(sdkKey, createPlatform(logger), { ...options, logger }, internalOptions); | ||
} | ||
|
||
override createStreamUriPath(context: LDContext) { | ||
return `/meval/${base64UrlEncode(JSON.stringify(context), platform.encoding!)}`; | ||
return `/meval/${base64UrlEncode(JSON.stringify(context), this.platform.encoding!)}`; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
import useLDClient from './useLDClient'; | ||
import useLDDataSourceStatus from './useLDDataSourceStatus'; | ||
|
||
export * from './variation'; | ||
|
||
export { useLDDataSourceStatus, useLDClient }; | ||
export { useLDClient }; |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I used this for debugging and now it's no longer required. |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { LDFlagValue } from './LDFlagValue'; | ||
|
||
export interface LDFlagChangeset { | ||
[key: string]: { | ||
current?: LDFlagValue; | ||
previous?: LDFlagValue; | ||
}; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export interface Storage { | ||
get: (key: string) => Promise<string | null>; | ||
set: (key: string, value: string) => Promise<void>; | ||
clear: (key: string) => Promise<void>; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
export default function clone(obj: any) { | ||
return JSON.parse(JSON.stringify(obj)); | ||
export default function clone<T>(obj: any) { | ||
return JSON.parse(JSON.stringify(obj)) as T; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need this now since AsyncStorage is removed in 0.73.