From e486135ce48f5c05d4a0e2ddd06fb377f103b882 Mon Sep 17 00:00:00 2001 From: Alex Forcier Date: Wed, 29 Jul 2020 14:21:36 +0900 Subject: [PATCH 1/3] Add debug flavor of Loop demo app --- app/src/debug/AndroidManifest.xml | 10 ++++++++++ app/src/debug/java/com/automattic/loop/LoopDebug.kt | 7 +++++++ app/src/main/java/com/automattic/loop/Loop.kt | 2 +- 3 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 app/src/debug/AndroidManifest.xml create mode 100644 app/src/debug/java/com/automattic/loop/LoopDebug.kt diff --git a/app/src/debug/AndroidManifest.xml b/app/src/debug/AndroidManifest.xml new file mode 100644 index 000000000..2afc2c75b --- /dev/null +++ b/app/src/debug/AndroidManifest.xml @@ -0,0 +1,10 @@ + + + + + + diff --git a/app/src/debug/java/com/automattic/loop/LoopDebug.kt b/app/src/debug/java/com/automattic/loop/LoopDebug.kt new file mode 100644 index 000000000..77399a230 --- /dev/null +++ b/app/src/debug/java/com/automattic/loop/LoopDebug.kt @@ -0,0 +1,7 @@ +package com.automattic.loop + +class LoopDebug : Loop() { + override fun onCreate() { + super.onCreate() + } +} diff --git a/app/src/main/java/com/automattic/loop/Loop.kt b/app/src/main/java/com/automattic/loop/Loop.kt index 7aded8199..351f3619c 100644 --- a/app/src/main/java/com/automattic/loop/Loop.kt +++ b/app/src/main/java/com/automattic/loop/Loop.kt @@ -15,7 +15,7 @@ import com.automattic.loop.util.CrashLoggingUtils import com.wordpress.stories.compose.NotificationTrackerProvider import com.wordpress.stories.compose.frame.StoryNotificationType -class Loop : Application(), NotificationTrackerProvider { +open class Loop : Application(), NotificationTrackerProvider { private var statusBarHeight: Int = 0 override fun onCreate() { From 183e3c2fa5e72d5d8a65d2ed929510478c768e08 Mon Sep 17 00:00:00 2001 From: Alex Forcier Date: Wed, 29 Jul 2020 15:10:11 +0900 Subject: [PATCH 2/3] Add Flipper support for demo app debug builds --- app/build.gradle | 4 ++++ app/src/debug/java/com/automattic/loop/LoopDebug.kt | 13 +++++++++++++ 2 files changed, 17 insertions(+) diff --git a/app/build.gradle b/app/build.gradle index df61742dd..4f06eb5ba 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -69,6 +69,10 @@ dependencies { implementation project(path: ':stories') implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutinesVersion" + debugImplementation 'com.facebook.flipper:flipper:0.50.0' + debugImplementation 'com.facebook.soloader:soloader:0.9.0' + debugImplementation 'com.facebook.flipper:flipper-network-plugin:0.50.0' + testImplementation 'junit:junit:4.12' androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' } diff --git a/app/src/debug/java/com/automattic/loop/LoopDebug.kt b/app/src/debug/java/com/automattic/loop/LoopDebug.kt index 77399a230..97192d22d 100644 --- a/app/src/debug/java/com/automattic/loop/LoopDebug.kt +++ b/app/src/debug/java/com/automattic/loop/LoopDebug.kt @@ -1,7 +1,20 @@ package com.automattic.loop +import com.facebook.flipper.android.AndroidFlipperClient +import com.facebook.flipper.android.utils.FlipperUtils +import com.facebook.flipper.plugins.inspector.DescriptorMapping +import com.facebook.flipper.plugins.inspector.InspectorFlipperPlugin +import com.facebook.soloader.SoLoader + class LoopDebug : Loop() { override fun onCreate() { super.onCreate() + + if (FlipperUtils.shouldEnableFlipper(this)) { + SoLoader.init(this, false) + AndroidFlipperClient.getInstance(this).apply { + addPlugin(InspectorFlipperPlugin(applicationContext, DescriptorMapping.withDefaults())) + }.start() + } } } From 75fb231d6ef5d57decf67f2b595204201f8849b5 Mon Sep 17 00:00:00 2001 From: Alex Forcier Date: Fri, 31 Jul 2020 15:37:01 +0900 Subject: [PATCH 3/3] Use gradle extra property for Flipper version --- app/build.gradle | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 4f06eb5ba..f18440aa3 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -39,6 +39,10 @@ android { useLibrary 'android.test.runner' } +ext { + flipperVersion = '0.50.0' +} + dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlinVersion" @@ -69,9 +73,9 @@ dependencies { implementation project(path: ':stories') implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutinesVersion" - debugImplementation 'com.facebook.flipper:flipper:0.50.0' + debugImplementation "com.facebook.flipper:flipper:$flipperVersion" debugImplementation 'com.facebook.soloader:soloader:0.9.0' - debugImplementation 'com.facebook.flipper:flipper-network-plugin:0.50.0' + debugImplementation "com.facebook.flipper:flipper-network-plugin:$flipperVersion" testImplementation 'junit:junit:4.12' androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'