Update code

This commit is contained in:
Lucas Lima 2020-12-30 19:45:09 -03:00 committed by Lucas Nunes
parent cfb444b8d6
commit ef819114c4

View file

@ -172,12 +172,13 @@ class EndGameDialogFragment : AppCompatDialogFragment() {
if (!preferencesRepository.isPremiumEnabled() && !instantAppManager.isEnabled(context)) { if (!preferencesRepository.isPremiumEnabled() && !instantAppManager.isEnabled(context)) {
activity?.let { activity -> activity?.let { activity ->
adsView.visibility = View.VISIBLE adsView.visibility = View.VISIBLE
removeAdsButton.visibility = View.VISIBLE
val label = context.getString(R.string.remove_ad) val label = context.getString(R.string.remove_ad)
val price = billingManager.getPrice().singleOrNull() val price = billingManager.getPrice().singleOrNull()
val unlockLabel = price?.let { "$label - $it" } ?: label val unlockLabel = price?.let { "$label - $it" } ?: label
removeAdsButton.text = unlockLabel removeAdsButton.apply {
removeAdsButton.setOnClickListener { visibility = View.VISIBLE
text = unlockLabel
setOnClickListener {
lifecycleScope.launch { lifecycleScope.launch {
billingManager.charge(activity) billingManager.charge(activity)
adsView.visibility = View.GONE adsView.visibility = View.GONE
@ -185,6 +186,7 @@ class EndGameDialogFragment : AppCompatDialogFragment() {
} }
} }
} }
}
receivedMessage.apply { receivedMessage.apply {
if (state.received > 0 && if (state.received > 0 &&