Skip to content

Conversation

@zashraf1985
Copy link
Contributor

@zashraf1985 zashraf1985 commented Oct 3, 2019

Summary

React Native App shows a full screen Red Message when console.error is called. This appears to be distracting for the developers. Added a new logger for React Native which uses console.warn to log error.

Test plan

  1. Manually tested thoroughly.
  2. Added unit tests

@coveralls
Copy link

coveralls commented Oct 3, 2019

Coverage Status

Coverage increased (+0.003%) to 97.601% when pulling 6f933ce on zeeshan/add-react-native-logger into e3e2a1b on master.

Copy link
Contributor

@mjc1283 mjc1283 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we change the logging package, we have to release new versions of everything. So instead let's implement the RN logger inside the optimizely-sdk package.

* limitations under the License.
*/
var logging = require('@optimizely/js-sdk-logging');
var browserIndex = require('./index.browser');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's not make this entry point depend on another entry point. It should be independent.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This means a lot of repeated code in both the entry points. is that ok?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes that's OK. It's not that much repeated code, and we don't want the promise polyfill, the pending events dispatcher, or listening for the pagehide event.

@zashraf1985 zashraf1985 removed their assignment Oct 7, 2019
Copy link
Contributor

@mjc1283 mjc1283 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Logger and entry point LGTM!

Please add unit test coverage for index.react_native.js (similar to what we have for the other entry points, for example: https://github.com/optimizely/javascript-sdk/blob/master/packages/optimizely-sdk/lib/index.node.tests.js).

@@ -0,0 +1,38 @@
var LogLevel = require('@optimizely/js-sdk-logging').LogLevel;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add the license header comment here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please change this to 2019 only

@@ -0,0 +1,462 @@
/**
* Copyright 2016-2019, Optimizely
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please change this to 2019 only

@@ -0,0 +1,38 @@
var LogLevel = require('@optimizely/js-sdk-logging').LogLevel;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please change this to 2019 only

@@ -0,0 +1,83 @@
/**
* Copyright 2016, Optimizely
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please change this to 2019 only

@@ -0,0 +1,121 @@
/**
* Copyright 2016-2017, 2019, Optimizely
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please change this to 2019 only

assert.strictEqual(activate, 'control');
});

it('should be able to set and get a forced variation', function() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's remove all these tests related to forced variation. This isn't relevant to the react native entry point.

@mjc1283 mjc1283 merged commit d7cd22b into master Oct 9, 2019
@raju-opti raju-opti deleted the zeeshan/add-react-native-logger branch October 4, 2023 13:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants