Skip to content
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

Add proper Stetho debugging setup documentation #12232

Closed
wants to merge 9 commits into from

Conversation

louisgv
Copy link
Contributor

@louisgv louisgv commented Feb 6, 2017

Explain the motivation for making this change. What existing problem does the pull request solve?

Adding the proper way to setup Stetho debugging, based on this post: https://medium.com/@andr3wjack/stetho-with-react-native-87642e5d7131#.352jqqavc

with updated OkHttp API.

Test plan

  • Manual test, DYI.

Adding the proper way to setup Stetho debugging.
@louisgv louisgv changed the title Update Debugging.md Add proper Stetho debugging setup documentation Feb 6, 2017
@facebook-github-bot
Copy link
Contributor

Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla - and if you have received this in error or have any questions, please drop us a line at [email protected]. Thanks!

If you are contributing on behalf of someone else (eg your employer): the individual CLA is not sufficient - use https://developers.facebook.com/opensource/cla?type=company instead. Contact [email protected] if you have any questions.

@facebook-github-bot
Copy link
Contributor

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Feb 6, 2017
Copy link
Contributor

@AndrewJack AndrewJack left a comment

Choose a reason for hiding this comment

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

Some small improvements to the implementation. I'll update my guide at some point too.


public static void addInterceptor(OkHttpClient okHttpClient) {
OkHttpClientProvider.replaceOkHttpClient(okHttpClient);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

This can be changed to:

public static void addInterceptor() {
   OkHttpClient client = OkHttpClientProvider.getOkHttpClient()
         .newBuilder()
         .addNetworkInterceptor(new StethoInterceptor())
         .build();
   OkHttpClientProvider.replaceOkHttpClient(client);
}


public static void addInterceptor(OkHttpClient okHttpClient) {
// NO_OP
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Can change to

public static void addInterceptor() {
   // NO_OP
}

.addNetworkInterceptor(new StethoInterceptor())
.build();

StethoWrapper.addInterceptor(client);
Copy link
Contributor

Choose a reason for hiding this comment

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

replace line 160 to 186 with:

StethoWrapper.addInterceptor();

@@ -96,43 +96,87 @@ The debugger will receive a list of all project roots, separated by a space. For

### Debugging with [Stetho](http://facebook.github.io/stetho/) on Android

(Adapted from https://medium.com/@andr3wjack/stetho-with-react-native-87642e5d7131#.352jqqavc)
Copy link
Contributor

Choose a reason for hiding this comment

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

Don't worry about adding this. Blogs get out of date, hopefully docs don't 😄


```gradle
debugCompile 'com.facebook.stetho:stetho:1.4.2'
debugCompile 'com.facebook.stetho:stetho-okhttp3:1.4.2'
Copy link
Contributor

@AndrewJack AndrewJack Feb 13, 2017

Choose a reason for hiding this comment

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

Could remove this bit and specify the version to use.
The version is dependant on the version of OkHttp React native is compatible with.

Copy link
Contributor

Choose a reason for hiding this comment

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

I updated this PR prior to seeing this comment. Would you prefer we recommend a specific version that we know is compatible with RN, or is there a process we can document for people to figure out what version of OkHttp they should be using here?

Copy link
Contributor

@AndrewJack AndrewJack left a comment

Choose a reason for hiding this comment

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

Looks fine to me, one suggestion

@hramos
Copy link
Contributor

hramos commented Apr 27, 2017

Waiting for some clarification on OkHttp

@facebook-github-bot
Copy link
Contributor

@louisgv I tried to find reviewers for this pull request and wanted to ping them to take another look. However, based on the blame information for the files in this pull request I couldn't find any reviewers. This sometimes happens when the files in the pull request are new or don't exist on master anymore. Is this pull request still relevant? If yes could you please rebase? In case you know who has context on this code feel free to mention them in a comment (one person is fine). Thanks for reading and hope you will continue contributing to the project.

@pull-bot
Copy link

pull-bot commented Aug 4, 2017

📄 Thanks for your contribution to the docs!

Attention: @facebook/react-native

Generated by 🚫 dangerJS

@facebook-github-bot facebook-github-bot added GH Review: accepted Import Started This pull request has been imported. This does not imply the PR has been approved. and removed GH Review: review-needed labels Aug 4, 2017
@facebook-github-bot
Copy link
Contributor

@hramos has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Import Started This pull request has been imported. This does not imply the PR has been approved.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants