Fix tests
This commit is contained in:
parent
8b0f8cae1f
commit
272b76156e
6 changed files with 8 additions and 26 deletions
|
@ -96,7 +96,7 @@ class GameActivity : ThematicActivity(R.layout.activity_game), DialogInterface.O
|
|||
loadGameFragment()
|
||||
}
|
||||
|
||||
if (instantAppManager.isEnabled()) {
|
||||
if (instantAppManager.isEnabled(applicationContext)) {
|
||||
bindInstantApp()
|
||||
savesRepository.setLimit(1)
|
||||
} else {
|
||||
|
@ -185,7 +185,7 @@ class GameActivity : ThematicActivity(R.layout.activity_game), DialogInterface.O
|
|||
drawer.closeDrawer(GravityCompat.START)
|
||||
gameViewModel.resumeGame()
|
||||
}
|
||||
status == Status.Running && instantAppManager.isEnabled() -> showQuitConfirmation {
|
||||
status == Status.Running && instantAppManager.isEnabled(applicationContext) -> showQuitConfirmation {
|
||||
super.onBackPressed()
|
||||
}
|
||||
else -> super.onBackPressed()
|
||||
|
@ -344,7 +344,7 @@ class GameActivity : ThematicActivity(R.layout.activity_game), DialogInterface.O
|
|||
handled
|
||||
}
|
||||
|
||||
navigationView.menu.findItem(R.id.share_now).isVisible = !instantAppManager.isEnabled()
|
||||
navigationView.menu.findItem(R.id.share_now).isVisible = !instantAppManager.isEnabled(applicationContext)
|
||||
|
||||
if (!playGamesManager.hasGooglePlayGames()) {
|
||||
navigationView.menu.removeGroup(R.id.play_games_group)
|
||||
|
|
|
@ -68,7 +68,7 @@ class EndGameDialogFragment : AppCompatDialogFragment() {
|
|||
}
|
||||
|
||||
when {
|
||||
instantAppManager.isEnabled() -> {
|
||||
instantAppManager.isEnabled(context) -> {
|
||||
setNeutralButton(R.string.install) { _, _ ->
|
||||
activity?.run {
|
||||
instantAppManager.showInstallPrompt(this, null, 0, null)
|
||||
|
|
|
@ -15,11 +15,7 @@ import org.koin.dsl.module
|
|||
val AppModule = module {
|
||||
single {
|
||||
object : IInstantAppManager {
|
||||
override fun isEnabled(): Boolean = false
|
||||
|
||||
override fun isInstantAppSupported(context: Context): Boolean = false
|
||||
|
||||
override fun isInAppPaymentsSupported(context: Context): Boolean = false
|
||||
override fun isEnabled(context: Context): Boolean = false
|
||||
|
||||
override fun showInstallPrompt(
|
||||
activity: Activity,
|
||||
|
|
|
@ -5,8 +5,6 @@ import android.content.Context
|
|||
import android.content.Intent
|
||||
|
||||
interface IInstantAppManager {
|
||||
fun isEnabled(): Boolean
|
||||
fun isInstantAppSupported(context: Context): Boolean
|
||||
fun isInAppPaymentsSupported(context: Context): Boolean
|
||||
fun isEnabled(context: Context): Boolean
|
||||
fun showInstallPrompt(activity: Activity, intent: Intent?, requestCode: Int, referrer: String?): Boolean
|
||||
}
|
||||
|
|
|
@ -5,15 +5,7 @@ import android.content.Context
|
|||
import android.content.Intent
|
||||
|
||||
class InstantAppManager : IInstantAppManager {
|
||||
override fun isEnabled(): Boolean {
|
||||
return false
|
||||
}
|
||||
|
||||
override fun isInstantAppSupported(context: Context): Boolean {
|
||||
return false
|
||||
}
|
||||
|
||||
override fun isInAppPaymentsSupported(context: Context): Boolean {
|
||||
override fun isEnabled(context: Context): Boolean {
|
||||
return false
|
||||
}
|
||||
|
||||
|
|
|
@ -6,14 +6,10 @@ import android.content.Intent
|
|||
import com.google.android.gms.instantapps.InstantApps
|
||||
|
||||
class InstantAppManager : IInstantAppManager {
|
||||
override fun isInstantAppSupported(context: Context): Boolean {
|
||||
override fun isEnabled(context: Context): Boolean {
|
||||
return InstantApps.getPackageManagerCompat(context).isInstantApp
|
||||
}
|
||||
|
||||
override fun isInAppPaymentsSupported(context: Context): Boolean {
|
||||
return true
|
||||
}
|
||||
|
||||
override fun showInstallPrompt(activity: Activity, intent: Intent?, requestCode: Int, referrer: String?): Boolean =
|
||||
InstantApps.showInstallPrompt(activity, intent, requestCode, referrer)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue