Migrate to leakcanary 2.2
This commit is contained in:
parent
38f0706855
commit
0d206f62bc
5 changed files with 11 additions and 15 deletions
|
@ -158,6 +158,8 @@ dependencies {
|
|||
implementation 'com.larswerkman:HoloColorPicker:1.5'
|
||||
implementation 'com.google.code.findbugs:jsr305:3.0.2'
|
||||
|
||||
implementation 'com.squareup.okio:okio:2.2.2'
|
||||
|
||||
implementation 'com.squareup.moshi:moshi:1.9.0'
|
||||
kapt("com.squareup.moshi:moshi-kotlin-codegen:1.9.0")
|
||||
|
||||
|
@ -174,8 +176,7 @@ dependencies {
|
|||
//noinspection GradleDependency
|
||||
implementation 'com.google.zxing:core:3.3.0'
|
||||
|
||||
debugImplementation 'com.squareup.leakcanary:leakcanary-android:1.6.3'
|
||||
releaseImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.6.3'
|
||||
debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.2'
|
||||
|
||||
// requires minSDK 16 according to docs, not sure if it causes an issue
|
||||
withAnalyticsImplementation 'com.google.android.gms:play-services-analytics:17.0.0'
|
||||
|
|
|
@ -35,8 +35,6 @@ class TestApp : App() {
|
|||
bind<EventBus>() with singleton { mock(EventBus::class.java) }
|
||||
}
|
||||
|
||||
override fun installLeakCanary() = Unit
|
||||
|
||||
companion object {
|
||||
|
||||
|
||||
|
|
|
@ -4,7 +4,6 @@ import android.app.Application
|
|||
import androidx.appcompat.app.AppCompatDelegate
|
||||
import com.github.salomonbrys.kodein.*
|
||||
import com.jakewharton.threetenabp.AndroidThreeTen
|
||||
import com.squareup.leakcanary.LeakCanary
|
||||
import com.squareup.moshi.Moshi
|
||||
import org.greenrobot.eventbus.EventBus
|
||||
import org.ligi.passandroid.json_adapter.ColorAdapter
|
||||
|
@ -27,7 +26,6 @@ open class App : Application() {
|
|||
}
|
||||
|
||||
AppCompatDelegate.setCompatVectorFromResourcesEnabled(true)
|
||||
installLeakCanary()
|
||||
AndroidThreeTen.init(this)
|
||||
initTraceDroid()
|
||||
|
||||
|
@ -47,10 +45,6 @@ open class App : Application() {
|
|||
bind<EventBus>() with singleton { EventBus.getDefault() }
|
||||
}
|
||||
|
||||
open fun installLeakCanary() {
|
||||
LeakCanary.install(this)
|
||||
}
|
||||
|
||||
private fun initTraceDroid() {
|
||||
TraceDroid.init(this)
|
||||
Log.setTAG("PassAndroid")
|
||||
|
|
|
@ -3,7 +3,9 @@ package org.ligi.passandroid.model
|
|||
import android.content.Context
|
||||
import com.squareup.moshi.JsonDataException
|
||||
import com.squareup.moshi.Moshi
|
||||
import okio.Okio
|
||||
import okio.buffer
|
||||
import okio.sink
|
||||
import okio.source
|
||||
import org.greenrobot.eventbus.EventBus
|
||||
import org.ligi.passandroid.App
|
||||
import org.ligi.passandroid.BuildConfig
|
||||
|
@ -36,7 +38,7 @@ class AndroidFileSystemPassStore(private val context: Context, settings: Setting
|
|||
pathForID.mkdirs()
|
||||
}
|
||||
|
||||
val buffer = Okio.buffer(Okio.sink(File(pathForID, "main.json")))
|
||||
val buffer = File(pathForID, "main.json").sink().buffer()
|
||||
|
||||
if (BuildConfig.DEBUG) {
|
||||
val of = com.squareup.moshi.JsonWriter.of(buffer)
|
||||
|
@ -67,7 +69,7 @@ class AndroidFileSystemPassStore(private val context: Context, settings: Setting
|
|||
val jsonAdapter = moshi.adapter(PassImpl::class.java)
|
||||
dirty = false
|
||||
try {
|
||||
result = jsonAdapter.fromJson(Okio.buffer(Okio.source(file)))
|
||||
result = jsonAdapter.fromJson(file.source().buffer())
|
||||
} catch (ignored: JsonDataException) {
|
||||
App.tracker.trackException("invalid main.json", false)
|
||||
}
|
||||
|
|
|
@ -8,7 +8,8 @@ import android.os.Build
|
|||
import android.os.ParcelFileDescriptor
|
||||
import net.lingala.zip4j.ZipFile
|
||||
import net.lingala.zip4j.exception.ZipException
|
||||
import okio.Okio
|
||||
import okio.buffer
|
||||
import okio.source
|
||||
import org.json.JSONObject
|
||||
import org.ligi.passandroid.App
|
||||
import org.ligi.passandroid.functions.createPassForImageImport
|
||||
|
@ -107,7 +108,7 @@ object UnzipPassController {
|
|||
if (Build.VERSION.SDK_INT >= 21) {
|
||||
try {
|
||||
val file = File(spec.zipFileString)
|
||||
val readUtf8 = Okio.buffer(Okio.source(file)).readUtf8(4)
|
||||
val readUtf8 = file.source().buffer().readUtf8(4)
|
||||
if (readUtf8 == "%PDF") {
|
||||
val open = ParcelFileDescriptor.open(file, ParcelFileDescriptor.MODE_READ_ONLY)
|
||||
val pdfRenderer = PdfRenderer(open)
|
||||
|
|
Loading…
Reference in a new issue