Setup Niddler

This commit is contained in:
Shinokuni 2020-07-10 21:09:22 +02:00
parent 489051b67f
commit e39c16d635
3 changed files with 26 additions and 0 deletions

View File

@ -96,4 +96,7 @@ dependencies {
debugImplementation 'com.facebook.flipper:flipper:0.30.1'
debugImplementation 'com.facebook.soloader:soloader:0.8.0'
debugImplementation 'com.facebook.flipper:flipper-network-plugin:0.30.1'
debugImplementation 'com.icapps.niddler:niddler:1.2.0'
releaseImplementation 'com.icapps.niddler:niddler-noop:1.2.0'
}

View File

@ -7,6 +7,8 @@
tools:ignore="AllowBackup,GoogleAppIndexingWarning"
tools:replace="android:name">
<meta-data android:name="com.niddler.icon" android:value="android"/>
<provider
android:name="androidx.work.impl.WorkManagerInitializer"
android:authorities="${applicationId}.workmanager-init"

View File

@ -17,6 +17,8 @@ import com.facebook.flipper.plugins.network.FlipperOkhttpInterceptor;
import com.facebook.flipper.plugins.network.NetworkFlipperPlugin;
import com.facebook.flipper.plugins.sharedpreferences.SharedPreferencesFlipperPlugin;
import com.facebook.soloader.SoLoader;
import com.icapps.niddler.core.AndroidNiddler;
import com.icapps.niddler.interceptor.okhttp.NiddlerOkHttpInterceptor;
import com.readrops.readropslibrary.utils.HttpManager;
public class ReadropsDebugApp extends ReadropsApp implements Configuration.Provider {
@ -27,6 +29,7 @@ public class ReadropsDebugApp extends ReadropsApp implements Configuration.Provi
SoLoader.init(this, false);
initFlipper();
initNiddler();
}
private void initFlipper() {
@ -53,6 +56,24 @@ public class ReadropsDebugApp extends ReadropsApp implements Configuration.Provi
}
}
private void initNiddler() {
AndroidNiddler niddler = new AndroidNiddler.Builder()
.setNiddlerInformation(AndroidNiddler.fromApplication(this))
.setPort(0)
.setMaxStackTraceSize(10)
.build();
niddler.attachToApplication(this);
HttpManager.setInstance(HttpManager.getInstance().
getOkHttpClient().
newBuilder().
addInterceptor(new NiddlerOkHttpInterceptor(niddler, "default"))
.build());
niddler.start();
}
@NonNull
@Override
public Configuration getWorkManagerConfiguration() {