diff --git a/app/build.gradle b/app/build.gradle index 3e20c364b..652a86bcd 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -170,7 +170,7 @@ dependencies { testImplementation 'androidx.test.espresso:espresso-core:3.3.0' testImplementation 'androidx.test.espresso:espresso-contrib:3.3.0' testImplementation 'androidx.fragment:fragment-testing:1.3.5' - testImplementation 'org.robolectric:robolectric:4.4.0' + testImplementation 'org.robolectric:robolectric:4.4' testImplementation 'androidx.test.ext:junit:1.1.2' testImplementation 'io.mockk:mockk:1.11.0' diff --git a/app/src/main/java/dev/lucasnlm/antimine/di/AppModule.kt b/app/src/main/java/dev/lucasnlm/antimine/di/AppModule.kt index 3c49ff514..3bdf9fd45 100644 --- a/app/src/main/java/dev/lucasnlm/antimine/di/AppModule.kt +++ b/app/src/main/java/dev/lucasnlm/antimine/di/AppModule.kt @@ -10,6 +10,7 @@ import dev.lucasnlm.antimine.support.AppVersionManagerImpl import dev.lucasnlm.antimine.support.IapHandler import dev.lucasnlm.external.ExternalAnalyticsWrapper import dev.lucasnlm.external.IAnalyticsManager +import org.koin.android.ext.koin.androidApplication import org.koin.dsl.bind import org.koin.dsl.module @@ -18,7 +19,7 @@ val AppModule = module { single { CloudSaveManagerImpl(get(), get(), get(), get()) } bind CloudSaveManager::class - single { AppVersionManagerImpl(BuildConfig.DEBUG, BuildConfig.VERSION_NAME) } bind IAppVersionManager::class + single { AppVersionManagerImpl(BuildConfig.DEBUG, androidApplication()) } bind IAppVersionManager::class single { if (BuildConfig.DEBUG) { diff --git a/app/src/main/java/dev/lucasnlm/antimine/support/AppVersionManagerImpl.kt b/app/src/main/java/dev/lucasnlm/antimine/support/AppVersionManagerImpl.kt index d017b77ca..2e24e825c 100644 --- a/app/src/main/java/dev/lucasnlm/antimine/support/AppVersionManagerImpl.kt +++ b/app/src/main/java/dev/lucasnlm/antimine/support/AppVersionManagerImpl.kt @@ -1,12 +1,14 @@ package dev.lucasnlm.antimine.support +import android.app.Application import dev.lucasnlm.antimine.core.IAppVersionManager class AppVersionManagerImpl( private val debug: Boolean, - private val id: String, + private val application: Application, ) : IAppVersionManager { private val valid by lazy { + val id = application.packageName debug || id == "com.logical.minato" || id == "dev.lucasnlm.antimine" || id == "dev.lucanlm.antimine" }