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