chuck
chuck copied to clipboard
Someone can create a react native plugin for that?
Someone can create a react native plugin for that?
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.
did you guys found anything?
I Will create the bridge, guys.
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;
Hi @cp-rf , This project is not maintained. You can try one of these forks
anyone can implement this?