From 4997ec3f0e1f756fcad48b6a7eff90eff8c0e3ad Mon Sep 17 00:00:00 2001 From: Alex Baker Date: Tue, 28 May 2019 10:38:22 -0500 Subject: [PATCH] Replace Stetho with Flipper --- app/build.gradle | 8 +++----- app/src/debug/java/org/tasks/BuildSetup.java | 20 ++++++++++++++----- .../tasks/preferences/DebugPreferences.java | 2 +- app/src/debug/res/xml/preferences_debug.xml | 4 ++-- app/src/main/res/values/keys.xml | 4 ++-- 5 files changed, 23 insertions(+), 15 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 622813602..4165384e6 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -119,7 +119,6 @@ configurations { final DAGGER_VERSION = '2.22.1' final BUTTERKNIFE_VERSION = '10.1.0' -final STETHO_VERSION = '1.5.1' final WORK_VERSION = '2.0.1' final LEAKCANARY_VERSION = '1.6.3' final ROOM_VERSION = '2.1.0-beta01' @@ -141,10 +140,9 @@ dependencies { annotationProcessor "com.jakewharton:butterknife-compiler:${BUTTERKNIFE_VERSION}" implementation "com.jakewharton:butterknife:${BUTTERKNIFE_VERSION}" - debugImplementation("com.facebook.stetho:stetho:${STETHO_VERSION}") { - exclude group: 'com.google.code.findbugs', module: 'jsr305' - } - debugImplementation "com.facebook.stetho:stetho-timber:${STETHO_VERSION}@aar" + debugImplementation 'com.facebook.flipper:flipper:0.21.0' + debugImplementation 'com.facebook.soloader:soloader:0.6.0' + debugImplementation "com.squareup.leakcanary:leakcanary-android:${LEAKCANARY_VERSION}" debugImplementation "com.squareup.leakcanary:leakcanary-support-fragment:${LEAKCANARY_VERSION}" diff --git a/app/src/debug/java/org/tasks/BuildSetup.java b/app/src/debug/java/org/tasks/BuildSetup.java index f92487e64..42da00c1a 100644 --- a/app/src/debug/java/org/tasks/BuildSetup.java +++ b/app/src/debug/java/org/tasks/BuildSetup.java @@ -3,8 +3,14 @@ package org.tasks; import android.app.Application; import android.content.Context; import android.os.StrictMode; -import com.facebook.stetho.Stetho; -import com.facebook.stetho.timber.StethoTree; +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.sharedpreferences.SharedPreferencesFlipperPlugin; +import com.facebook.soloader.SoLoader; import com.squareup.leakcanary.LeakCanary; import javax.inject.Inject; import org.tasks.injection.ForApplication; @@ -24,9 +30,13 @@ public class BuildSetup { public boolean setup() { Timber.plant(new Timber.DebugTree()); - if (preferences.getBoolean(R.string.p_stetho, false)) { - Timber.plant(new StethoTree()); - Stetho.initializeWithDefaults(context); + if (preferences.getBoolean(R.string.p_flipper, false) && FlipperUtils.shouldEnableFlipper(context)) { + SoLoader.init(context, false); + FlipperClient client = AndroidFlipperClient.getInstance(context); + client.addPlugin(new InspectorFlipperPlugin(context, DescriptorMapping.withDefaults())); + client.addPlugin(new DatabasesFlipperPlugin(context)); + client.addPlugin(new SharedPreferencesFlipperPlugin(context)); + client.start(); } Application application = (Application) context.getApplicationContext(); if (LeakCanary.isInAnalyzerProcess(context)) { diff --git a/app/src/debug/java/org/tasks/preferences/DebugPreferences.java b/app/src/debug/java/org/tasks/preferences/DebugPreferences.java index 581baa887..7228019a2 100644 --- a/app/src/debug/java/org/tasks/preferences/DebugPreferences.java +++ b/app/src/debug/java/org/tasks/preferences/DebugPreferences.java @@ -17,7 +17,7 @@ public class DebugPreferences extends InjectingPreferenceActivity { for (int pref : asList( - R.string.p_stetho, + R.string.p_flipper, R.string.p_leak_canary, R.string.p_strict_mode_vm, R.string.p_strict_mode_thread)) { diff --git a/app/src/debug/res/xml/preferences_debug.xml b/app/src/debug/res/xml/preferences_debug.xml index 4f858f655..6543e06c4 100644 --- a/app/src/debug/res/xml/preferences_debug.xml +++ b/app/src/debug/res/xml/preferences_debug.xml @@ -6,8 +6,8 @@ android:title="@string/debug_leak_canary" /> + android:key="@string/p_flipper" + android:title="@string/debug_flipper" /> Strict mode - Thread Strict mode - VM LeakCanary - Stetho + Flipper Unlock pro Buy Debug @@ -293,7 +293,7 @@ strict_mode_vm strict_mode_thread leak_canary - p_stetho + p_flipper debug_pro warned_play_services background_sync_unmetered_only