Includes leak canary only for alpha debug builds

Leak canary is only needed on alpha debug builds, as the release builds
should not have it, and beta debug is used for tests where the canary
is disturbing the test execution.

MAILAND-2688
This commit is contained in:
Maciej Surmacz 2021-12-28 12:03:31 +01:00 committed by Zorica Stojchevska
parent 7c554582a8
commit 6ce5732ea1
2 changed files with 4 additions and 12 deletions

View File

@ -72,6 +72,8 @@ val testUser3 = properties["TEST_USER3"] ?: privateProperties["TEST_USER3"]
val testUser4 = properties["TEST_USER4"] ?: privateProperties["TEST_USER4"]
val testUser5 = properties["TEST_USER5"] ?: privateProperties["TEST_USER5"]
val alphaDebugImplementation by configurations.creating
android(
appIdSuffix = "android",
minSdk = 23,
@ -233,6 +235,7 @@ tasks.withType<Test> {
// add more coroutines debug information
systemProperty("kotlinx.coroutines.debug", "on")
}
dependencies {
// Hilt
@ -362,7 +365,7 @@ dependencies {
`coil-base`
)
debugImplementation(
alphaDebugImplementation(
`leakcanary`
)

View File

@ -104,14 +104,10 @@ import ch.protonmail.android.worker.FetchContactsEmailsWorker;
import dagger.hilt.android.HiltAndroidApp;
import io.sentry.Sentry;
import io.sentry.android.AndroidSentryClientFactory;
import leakcanary.DefaultOnHeapAnalyzedListener;
import leakcanary.LeakCanary;
import me.proton.core.accountmanager.data.AccountStateHandler;
import me.proton.core.accountmanager.domain.AccountManager;
import me.proton.core.domain.entity.UserId;
import me.proton.core.util.kotlin.CoreLogger;
import shark.AndroidObjectInspectors;
import shark.AndroidReferenceMatchers;
import studio.forface.viewstatestore.ViewStateStoreConfig;
import timber.log.Timber;
@ -214,13 +210,6 @@ public class ProtonMailApplication extends Application implements androidx.work.
Timber.plant(new SentryTree());
}
if (BuildConfig.FLAVOR.equals("beta")) {
LeakCanary.setConfig(LeakCanary.getConfig().copy(false, false, 5,
AndroidReferenceMatchers.getAppDefaults(), AndroidObjectInspectors.Companion.getAppDefaults(),
DefaultOnHeapAnalyzedListener.Companion.create(), LeakCanary.getConfig().getMetadataExtractor(), true,
7, false, LeakCanary.getConfig().getLeakingObjectFinder(), false));
}
TrustKit.initializeWithNetworkSecurityConfiguration(this);
ViewStateStoreConfig.INSTANCE