mirror of
https://github.com/vector-im/element-android.git
synced 2024-11-15 01:35:07 +08:00
Fix crash by disabling Flipper on API 22 and below (#7428)
* Disable Flipper on API 21 and below - only affects debug builds. Due to a bug: https://github.com/facebook/flipper/issues/3572 * Add jonnyandrew to PR sign-off allowlist Co-authored-by: Benoit Marty <benoit.marty@gmail.com>
This commit is contained in:
parent
e003d01ec4
commit
31811bb7e0
1
changelog.d/7428.bugfix
Normal file
1
changelog.d/7428.bugfix
Normal file
@ -0,0 +1 @@
|
||||
Fix crash by disabling Flipper on Android API 22 and below - only affects debug version of the application.
|
@ -81,6 +81,7 @@ const allowList = [
|
||||
"Florian14",
|
||||
"ganfra",
|
||||
"jmartinesp",
|
||||
"jonnyandrew",
|
||||
"langleyd",
|
||||
"MadLittleMods",
|
||||
"manuroe",
|
||||
|
@ -17,6 +17,7 @@
|
||||
package im.vector.app.flipper
|
||||
|
||||
import android.content.Context
|
||||
import android.os.Build
|
||||
import com.facebook.flipper.android.AndroidFlipperClient
|
||||
import com.facebook.flipper.android.utils.FlipperUtils
|
||||
import com.facebook.flipper.plugins.crashreporter.CrashReporterPlugin
|
||||
@ -31,6 +32,7 @@ import com.kgurgul.flipper.RealmDatabaseDriver
|
||||
import com.kgurgul.flipper.RealmDatabaseProvider
|
||||
import im.vector.app.core.debug.FlipperProxy
|
||||
import io.realm.RealmConfiguration
|
||||
import okhttp3.Interceptor
|
||||
import org.matrix.android.sdk.api.Matrix
|
||||
import javax.inject.Inject
|
||||
import javax.inject.Singleton
|
||||
@ -41,10 +43,21 @@ class VectorFlipperProxy @Inject constructor(
|
||||
) : FlipperProxy {
|
||||
private val networkFlipperPlugin = NetworkFlipperPlugin()
|
||||
|
||||
private val isEnabled: Boolean
|
||||
get() {
|
||||
// https://github.com/facebook/flipper/issues/3572
|
||||
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.LOLLIPOP_MR1) {
|
||||
return false
|
||||
}
|
||||
|
||||
return FlipperUtils.shouldEnableFlipper(context)
|
||||
}
|
||||
|
||||
override fun init(matrix: Matrix) {
|
||||
if (!isEnabled) return
|
||||
|
||||
SoLoader.init(context, false)
|
||||
|
||||
if (FlipperUtils.shouldEnableFlipper(context)) {
|
||||
val client = AndroidFlipperClient.getInstance(context)
|
||||
client.addPlugin(CrashReporterPlugin.getInstance())
|
||||
client.addPlugin(SharedPreferencesFlipperPlugin(context))
|
||||
@ -63,7 +76,10 @@ class VectorFlipperProxy @Inject constructor(
|
||||
)
|
||||
client.start()
|
||||
}
|
||||
}
|
||||
|
||||
override fun networkInterceptor() = FlipperOkhttpInterceptor(networkFlipperPlugin)
|
||||
override fun networkInterceptor(): Interceptor? {
|
||||
if (!isEnabled) return null
|
||||
|
||||
return FlipperOkhttpInterceptor(networkFlipperPlugin)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user