Skip to content

Commit 8559c52

Browse files
authored
fix: Removed React Native client engine temporarily (#466)
Summary: React Native Client Engine was added to SDK but the backend does not support receiving and processing it yet. Temporarily removing it and will add it back when backend starts supporting it. Test plan: All existing tests should pass
1 parent 6876656 commit 8559c52

File tree

3 files changed

+5
-16
lines changed

3 files changed

+5
-16
lines changed

packages/optimizely-sdk/lib/index.react_native.js

+1-6
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ var createInstance = function(config) {
7878

7979
config = fns.assign(
8080
{
81-
clientEngine: enums.REACT_NATIVE_JS_CLIENT_ENGINE,
81+
clientEngine: enums.JAVASCRIPT_CLIENT_ENGINE,
8282
eventBatchSize: DEFAULT_EVENT_BATCH_SIZE,
8383
eventDispatcher: defaultEventDispatcher,
8484
eventFlushInterval: DEFAULT_EVENT_FLUSH_INTERVAL,
@@ -91,11 +91,6 @@ var createInstance = function(config) {
9191
}
9292
);
9393

94-
// If client engine is react, convert it to react native
95-
if (config.clientEngine === enums.REACT_CLIENT_ENGINE) {
96-
config.clientEngine = enums.REACT_NATIVE_CLIENT_ENGINE
97-
}
98-
9994
if (!eventProcessorConfigValidator.validateEventBatchSize(config.eventBatchSize)) {
10095
logger.warn('Invalid eventBatchSize %s, defaulting to %s', config.eventBatchSize, DEFAULT_EVENT_BATCH_SIZE);
10196
config.eventBatchSize = DEFAULT_EVENT_BATCH_SIZE;

packages/optimizely-sdk/lib/index.react_native.tests.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ describe('javascript-sdk/react-native', function() {
9292
assert.equal(optlyInstance.clientVersion, '4.0.0-rc.2');
9393
});
9494

95-
it('should set the React Native JS client engine and javascript SDK version', function() {
95+
it('should set the Javascript client engine and version', function() {
9696
var optlyInstance = optimizelyFactory.createInstance({
9797
datafile: {},
9898
errorHandler: fakeErrorHandler,
@@ -101,11 +101,11 @@ describe('javascript-sdk/react-native', function() {
101101
});
102102
// Invalid datafile causes onReady Promise rejection - catch this error
103103
optlyInstance.onReady().catch(function() {});
104-
assert.equal('react-native-js-sdk', optlyInstance.clientEngine);
104+
assert.equal('javascript-sdk', optlyInstance.clientEngine);
105105
assert.equal(packageJSON.version, optlyInstance.clientVersion);
106106
});
107107

108-
it('should allow passing of "react-sdk" as the clientEngine and convert it to "react-native-sdk"', function() {
108+
it('should allow passing of "react-sdk" as the clientEngine', function() {
109109
var optlyInstance = optimizelyFactory.createInstance({
110110
clientEngine: 'react-sdk',
111111
datafile: {},
@@ -115,7 +115,7 @@ describe('javascript-sdk/react-native', function() {
115115
});
116116
// Invalid datafile causes onReady Promise rejection - catch this error
117117
optlyInstance.onReady().catch(function() {});
118-
assert.equal('react-native-sdk', optlyInstance.clientEngine);
118+
assert.equal('react-sdk', optlyInstance.clientEngine);
119119
});
120120

121121
it('should activate with provided event dispatcher', function() {

packages/optimizely-sdk/lib/utils/enums/index.js

-6
Original file line numberDiff line numberDiff line change
@@ -173,16 +173,12 @@ export var CONTROL_ATTRIBUTES = {
173173
export var JAVASCRIPT_CLIENT_ENGINE = 'javascript-sdk';
174174
export var NODE_CLIENT_ENGINE = 'node-sdk';
175175
export var REACT_CLIENT_ENGINE = 'react-sdk';
176-
export var REACT_NATIVE_CLIENT_ENGINE = 'react-native-sdk';
177-
export var REACT_NATIVE_JS_CLIENT_ENGINE = 'react-native-js-sdk';
178176
export var NODE_CLIENT_VERSION = '4.0.0-rc.2';
179177

180178
export var VALID_CLIENT_ENGINES = [
181179
NODE_CLIENT_ENGINE,
182180
REACT_CLIENT_ENGINE,
183181
JAVASCRIPT_CLIENT_ENGINE,
184-
REACT_NATIVE_CLIENT_ENGINE,
185-
REACT_NATIVE_JS_CLIENT_ENGINE,
186182
];
187183

188184
export var NOTIFICATION_TYPES = notificationTypesEnum;
@@ -233,8 +229,6 @@ export default {
233229
JAVASCRIPT_CLIENT_ENGINE: JAVASCRIPT_CLIENT_ENGINE,
234230
NODE_CLIENT_ENGINE: NODE_CLIENT_ENGINE,
235231
REACT_CLIENT_ENGINE: REACT_CLIENT_ENGINE,
236-
REACT_NATIVE_CLIENT_ENGINE: REACT_NATIVE_CLIENT_ENGINE,
237-
REACT_NATIVE_JS_CLIENT_ENGINE: REACT_NATIVE_JS_CLIENT_ENGINE,
238232
NODE_CLIENT_VERSION: NODE_CLIENT_VERSION,
239233
VALID_CLIENT_ENGINES: VALID_CLIENT_ENGINES,
240234
NOTIFICATION_TYPES: NOTIFICATION_TYPES,

0 commit comments

Comments
 (0)