Skip to content

Fix env vars #1645

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

Merged
merged 10 commits into from
Jun 26, 2020
Merged

Fix env vars #1645

merged 10 commits into from
Jun 26, 2020

Conversation

estebanmino
Copy link
Contributor

Description

Env vars haven't been working on debug mode for a while now, this PR fixes that so we can use all the features on debug mode.

Checklist

  • There is a related GitHub issue
  • Tests are included if applicable
  • Any added code is fully documented

Issue

Resolves #???

@estebanmino estebanmino requested a review from a team as a code owner June 18, 2020 16:52
@ibrahimtaveras00 ibrahimtaveras00 added the QA'd - Issues Found QA has been complete, however issues have been discovered that need to be addressed label Jun 22, 2020
Copy link
Contributor

@ibrahimtaveras00 ibrahimtaveras00 left a comment

Choose a reason for hiding this comment

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

Fixes look good, QA Passed 👍

@ibrahimtaveras00 ibrahimtaveras00 added QA Passed QA testing has been completed and passed and removed QA'd - Issues Found QA has been complete, however issues have been discovered that need to be addressed labels Jun 25, 2020
Comment on lines 219 to 227
if (!__DEV__) {
RCTAnalytics.trackEvent({
...event,
...params,
value,
info
});
} else {
Logger.log(`Analytics 'trackEventWithValueAndParameters' - `, event, value, info, params);
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe this could be a method? looks like we're dong the same thing 6x

Copy link
Member

@andrepimenta andrepimenta left a comment

Choose a reason for hiding this comment

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

The only recommendation I have is to put code like this:

if (!__DEV__) {
  RCTAnalytics.trackEvent(event);
} else {
  Logger.log(`Analytics 'trackEvent' - `, event);
}

On a function outside on a service or helper that would look like:

const trackEvent = event => {
  if (!__DEV__) {
    RCTAnalytics.trackEvent(event);
  } else {
    Logger.log(`Analytics 'trackEvent' - `, event);
  }
}

And then you could call trackEvent(event) everywhere so we don't repeat code. This is especially important if we need to use that function more times in the future.

And the same for !__DEV__ && RCTAnalytics.optIn(this.enabled);

Otherwise looks good to me!!

@estebanmino
Copy link
Contributor Author

@rickycodes @andrepimenta it totally makes sense, it was that way before so I didn't question it 🤦

@estebanmino estebanmino merged commit 2519b05 into develop Jun 26, 2020
@estebanmino estebanmino deleted the fix-env-vars branch June 26, 2020 18:25
rickycodes pushed a commit that referenced this pull request Jan 31, 2022
* enable-apple-pay

* analytics only on not dev

* startwatcher

* dev

* env.

* DRY analytics
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
QA Passed QA testing has been completed and passed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants