diff --git a/WordPress/build.gradle b/WordPress/build.gradle index ac98ada035c5..c911d5d2c816 100644 --- a/WordPress/build.gradle +++ b/WordPress/build.gradle @@ -387,10 +387,6 @@ dependencies { } implementation "org.wordpress:persistentedittext:$wordPressPersistentEditTextVersion" - // To enable Stetho, a debug bridge that enables the Chrome Developer Tools for debug purposes. - debugImplementation "com.facebook.stetho:stetho:$stethoVersion" - debugImplementation "com.facebook.stetho:stetho-okhttp3:$stethoVersion" - implementation "androidx.arch.core:core-common:$androidxArchCoreVersion" implementation "androidx.arch.core:core-runtime:$androidxArchCoreVersion" implementation "com.google.code.gson:gson:$googleGsonVersion" @@ -558,6 +554,16 @@ dependencies { // - Jetpack Compose - UI Tests androidTestImplementation "androidx.compose.ui:ui-test-junit4" implementation "androidx.compose.material3:material3:$androidxComposeMaterial3Version" + + // - Flipper + debugImplementation ("com.facebook.flipper:flipper:$flipperVersion") { + exclude group:'org.jetbrains.kotlinx', module:'kotlinx-serialization-json-jvm' + } + debugImplementation "com.facebook.soloader:soloader:$soLoaderVersion" + debugImplementation ("com.facebook.flipper:flipper-network-plugin:$flipperVersion"){ + exclude group:'org.jetbrains.kotlinx', module:'kotlinx-serialization-json-jvm' + } + releaseImplementation "com.facebook.flipper:flipper-noop:$flipperVersion" } configurations.all { diff --git a/WordPress/src/debug/AndroidManifest.xml b/WordPress/src/debug/AndroidManifest.xml index e961d134552f..f8c9e84b0392 100644 --- a/WordPress/src/debug/AndroidManifest.xml +++ b/WordPress/src/debug/AndroidManifest.xml @@ -38,5 +38,7 @@ android:name=".ui.debug.preferences.DebugSharedPreferenceFlagsActivity" android:label="@string/debug_settings_debug_flags_screen" android:theme="@style/WordPress.NoActionBar" /> + diff --git a/WordPress/src/debug/java/org/wordpress/android/WordPressDebug.java b/WordPress/src/debug/java/org/wordpress/android/WordPressDebug.java index 18c86dd485b9..8672794c9767 100644 --- a/WordPress/src/debug/java/org/wordpress/android/WordPressDebug.java +++ b/WordPress/src/debug/java/org/wordpress/android/WordPressDebug.java @@ -2,7 +2,14 @@ import android.os.StrictMode; -import com.facebook.stetho.Stetho; +import com.facebook.flipper.android.AndroidFlipperClient; +import com.facebook.flipper.android.utils.FlipperUtils; +import com.facebook.flipper.core.FlipperClient; +import com.facebook.flipper.plugins.databases.DatabasesFlipperPlugin; +import com.facebook.flipper.plugins.inspector.DescriptorMapping; +import com.facebook.flipper.plugins.inspector.InspectorFlipperPlugin; +import com.facebook.flipper.plugins.network.NetworkFlipperPlugin; +import com.facebook.soloader.SoLoader; import org.wordpress.android.util.AppLog; import org.wordpress.android.util.AppLog.T; @@ -11,14 +18,23 @@ @HiltAndroidApp public class WordPressDebug extends WordPressApp { + public static final NetworkFlipperPlugin NETWORK_FLIPPER_PLUGIN = new NetworkFlipperPlugin(); @Override public void onCreate() { super.onCreate(); // enableStrictMode() - // Init Stetho - Stetho.initializeWithDefaults(this); + // init Flipper + SoLoader.init(this, false); + + if (BuildConfig.DEBUG && FlipperUtils.shouldEnableFlipper(this)) { + final FlipperClient client = AndroidFlipperClient.getInstance(this); + client.addPlugin(new InspectorFlipperPlugin(this, DescriptorMapping.withDefaults())); + client.addPlugin(NETWORK_FLIPPER_PLUGIN); + client.addPlugin(new DatabasesFlipperPlugin(this)); + client.start(); + } } /** diff --git a/WordPress/src/debug/java/org/wordpress/android/modules/InterceptorModule.java b/WordPress/src/debug/java/org/wordpress/android/modules/InterceptorModule.java index cba40b8795c0..a3fff589ff72 100644 --- a/WordPress/src/debug/java/org/wordpress/android/modules/InterceptorModule.java +++ b/WordPress/src/debug/java/org/wordpress/android/modules/InterceptorModule.java @@ -1,6 +1,8 @@ package org.wordpress.android.modules; -import com.facebook.stetho.okhttp3.StethoInterceptor; +import com.facebook.flipper.plugins.network.FlipperOkhttpInterceptor; + +import org.wordpress.android.WordPressDebug; import javax.inject.Named; @@ -11,11 +13,12 @@ import dagger.multibindings.IntoSet; import okhttp3.Interceptor; + @InstallIn(SingletonComponent.class) @Module public class InterceptorModule { @Provides @IntoSet @Named("network-interceptors") - public Interceptor provideStethoInterceptor() { - return new StethoInterceptor(); + public Interceptor provideFlipperInterceptor() { + return new FlipperOkhttpInterceptor(WordPressDebug.NETWORK_FLIPPER_PLUGIN); } } diff --git a/build.gradle b/build.gradle index 949cd82ae741..b909a47e97fc 100644 --- a/build.gradle +++ b/build.gradle @@ -32,7 +32,8 @@ ext { indexosMediaForMobileVersion = '43a9026f0973a2f0a74fa813132f6a16f7499c3a' // debug - stethoVersion = '1.6.0' + flipperVersion = '0.245.0' + soLoaderVersion = '0.10.5' // main androidInstallReferrerVersion = '2.2'