diff --git a/app/build.gradle b/app/build.gradle index fdc2347d..0d10903b 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -50,11 +50,13 @@ android { release { minifyEnabled = true proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + buildConfigField 'boolean', 'ENABLE_DEBUG_FEATURES', isSnapshot() ? 'true' : 'false' } debug { applicationIdSuffix = '.debug' versionNameSuffix = '-debug' minifyEnabled = false + buildConfigField 'boolean', 'ENABLE_DEBUG_FEATURES', 'true' } } @@ -98,6 +100,13 @@ dependencies { implementation deps.third_party.openpgp_ktx implementation deps.third_party.ssh_auth implementation deps.third_party.timber + implementation deps.third_party.whatthestack + + if (isSnapshot()) { + implementation deps.third_party.leakcanary + } else { + debugImplementation deps.third_party.leakcanary + } // Testing-only dependencies androidTestImplementation deps.testing.junit diff --git a/app/src/main/java/com/zeapo/pwdstore/Application.kt b/app/src/main/java/com/zeapo/pwdstore/Application.kt index 97b5ae69..aea46e07 100644 --- a/app/src/main/java/com/zeapo/pwdstore/Application.kt +++ b/app/src/main/java/com/zeapo/pwdstore/Application.kt @@ -4,6 +4,7 @@ */ package com.zeapo.pwdstore +import com.haroldadmin.whatthestack.WhatTheStack import timber.log.Timber @Suppress("Unused") @@ -12,5 +13,8 @@ class Application : android.app.Application() { override fun onCreate() { super.onCreate() Timber.plant(Timber.DebugTree()) + if (BuildConfig.ENABLE_DEBUG_FEATURES) { + WhatTheStack(this).init() + } } } diff --git a/dependencies.gradle b/dependencies.gradle index 43847abe..acbeb9a3 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -41,9 +41,11 @@ ext.deps = [ fastscroll: 'me.zhanghai.android.fastscroll:library:1.1.0', jsch: 'com.jcraft:jsch:0.1.55', jgit: 'org.eclipse.jgit:org.eclipse.jgit:3.7.1.201504261725-r', + leakcanary: 'com.squareup.leakcanary:leakcanary-android:2.1', openpgp_ktx: 'com.github.android-password-store:openpgp-ktx:1.2.0', ssh_auth: 'org.sufficientlysecure:sshauthentication-api:1.0', - timber: "com.jakewharton.timber:timber:4.7.1", + timber: 'com.jakewharton.timber:timber:4.7.1', + whatthestack: 'com.github.haroldadmin:WhatTheStack:0.0.1', ], testing: [