Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Flipper support for Loop app #472

Merged
merged 3 commits into from
Jul 31, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -69,6 +73,10 @@ dependencies {
implementation project(path: ':stories')
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutinesVersion"

debugImplementation "com.facebook.flipper:flipper:$flipperVersion"
debugImplementation 'com.facebook.soloader:soloader:0.9.0'
debugImplementation "com.facebook.flipper:flipper-network-plugin:$flipperVersion"

testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}
Expand Down
10 changes: 10 additions & 0 deletions app/src/debug/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest package="com.automattic.loop"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">

<application
android:name=".LoopDebug"
tools:replace="android:name" />

</manifest>
20 changes: 20 additions & 0 deletions app/src/debug/java/com/automattic/loop/LoopDebug.kt
Original file line number Diff line number Diff line change
@@ -0,0 +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()
}
}
}
2 changes: 1 addition & 1 deletion app/src/main/java/com/automattic/loop/Loop.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down