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

Someone can create a react native plugin for that? #87

Open
ebellumat opened this issue Jun 1, 2019 · 6 comments
Open

Someone can create a react native plugin for that? #87

ebellumat opened this issue Jun 1, 2019 · 6 comments

Comments

@ebellumat
Copy link

Someone can create a react native plugin for that?

@XingtianXin
Copy link

Someone can create a react native plugin for that?

Yes~
That's very useful
i'm trying to add it to rn-fetch-blob for android projects, but it not work.

@blikenoother
Copy link

did you guys found anything?

@ebellumat
Copy link
Author

I Will create the bridge, guys.

@cp-rf
Copy link

cp-rf commented Sep 23, 2020

After adding chuck plugin to your build.gradle.
Go to your MainApplication.java's onCreate or Constructor and add following line :

OkHttpClientProvider.setOkHttpClientFactory(new CustomNetworkModule(this));

Also create following class, either in separate file or in the MainApplication.java only.

class CustomNetworkModule implements OkHttpClientFactory {
private Context context;

public CustomNetworkModule(Context context) {
    this.context = context;
}

public OkHttpClient createNewNetworkModuleClient() {
    OkHttpClient client = new OkHttpClient.Builder()
            .addInterceptor(new ChuckInterceptor(this.context))
            .cookieJar(new ReactCookieJarContainer())
            .build();
    return client;
}

}

and start your activity : startActivity(Chuck.getLaunchIntent(this)); from MainActivity.java's onCreate.

Imports to refer :

import com.facebook.react.modules.network.OkHttpClientFactory;
import com.facebook.react.modules.network.OkHttpClientProvider;
import com.facebook.react.modules.network.ReactCookieJarContainer;
import com.readystatesoftware.chuck.ChuckInterceptor;
import okhttp3.OkHttpClient;
import com.readystatesoftware.chuck.Chuck;

@Ashok-Varma
Copy link

Hi @cp-rf , This project is not maintained. You can try one of these forks

  1. Chucker - chuck + supports debug logs ..etc
  2. Gander - lean version of chuck

@falihnaufal17
Copy link

anyone can implement this?

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

No branches or pull requests

6 participants