mirror of
https://github.com/sudoxnym/habitica-android.git
synced 2026-07-15 02:31:57 +00:00
show correct subscription options
This commit is contained in:
parent
06cbc66f98
commit
d620dff380
4 changed files with 18 additions and 2 deletions
|
|
@ -25,6 +25,7 @@ import com.habitrpg.android.habitica.models.shops.ShopItem
|
|||
import com.habitrpg.android.habitica.models.social.Group
|
||||
import com.habitrpg.android.habitica.ui.adapter.inventory.ShopRecyclerAdapter
|
||||
import com.habitrpg.android.habitica.ui.fragments.BaseMainFragment
|
||||
import com.habitrpg.android.habitica.ui.fragments.purchases.EventOutcomeSubscriptionBottomSheetFragment
|
||||
import com.habitrpg.android.habitica.ui.fragments.purchases.SubscriptionBottomSheetFragment
|
||||
import com.habitrpg.android.habitica.ui.helpers.SafeDefaultItemAnimator
|
||||
import com.habitrpg.android.habitica.ui.viewmodels.MainUserViewModel
|
||||
|
|
@ -118,7 +119,9 @@ open class ShopFragment : BaseMainFragment<FragmentRefreshRecyclerviewBinding>()
|
|||
adapter?.onShowPurchaseDialog = { item, isPinned ->
|
||||
if (item.key == "gem" && userViewModel.user.value?.isSubscribed != true) {
|
||||
Analytics.sendEvent("View gems for gold CTA", EventCategory.BEHAVIOUR, HitType.EVENT)
|
||||
val subscriptionBottomSheet = SubscriptionBottomSheetFragment()
|
||||
val subscriptionBottomSheet = EventOutcomeSubscriptionBottomSheetFragment().apply {
|
||||
eventType = EventOutcomeSubscriptionBottomSheetFragment.EVENT_GEMS_FOR_GOLD
|
||||
}
|
||||
activity?.let { activity ->
|
||||
subscriptionBottomSheet.show(activity.supportFragmentManager, SubscriptionBottomSheetFragment.TAG)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ class EventOutcomeSubscriptionBottomSheetFragment : SubscriptionBottomSheetFragm
|
|||
when (eventType) {
|
||||
EVENT_ARMOIRE_OPENED -> setArmoireEventSubscriptionViews()
|
||||
EVENT_DEATH_SCREEN -> setDeathScreenEventSubscriptionViews()
|
||||
EVENT_GEMS_FOR_GOLD -> setGemsForGoldEventSubscriptionViews()
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -29,9 +30,17 @@ class EventOutcomeSubscriptionBottomSheetFragment : SubscriptionBottomSheetFragm
|
|||
binding.subscriberBenefits.hideDeathBenefit()
|
||||
}
|
||||
|
||||
private fun setGemsForGoldEventSubscriptionViews() {
|
||||
binding.subscriberBenefitBanner.visibility = View.GONE
|
||||
binding.subscribeBenefits.text = getString(R.string.subscribe_gems_for_gold_incentive_text)
|
||||
binding.subscriberBenefits.hideGemsForGoldBenefit()
|
||||
binding.subscription3month.visibility = View.GONE
|
||||
}
|
||||
|
||||
companion object {
|
||||
const val TAG = "EventOutcomeSubscriptionBottomSheet"
|
||||
const val EVENT_ARMOIRE_OPENED = "armoire_opened"
|
||||
const val EVENT_DEATH_SCREEN = "death_screen"
|
||||
const val EVENT_GEMS_FOR_GOLD = "gems_for_gold"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -148,7 +148,7 @@ open class SubscriptionBottomSheetFragment : BottomSheetDialogFragment() {
|
|||
private fun buttonForSku(sku: String?): SubscriptionOptionView? {
|
||||
return when (sku) {
|
||||
PurchaseTypes.Subscription1Month -> binding.subscription1month
|
||||
PurchaseTypes.Subscription3Month -> binding.subscription1month
|
||||
PurchaseTypes.Subscription3Month -> binding.subscription3month
|
||||
PurchaseTypes.Subscription12Month -> binding.subscription12month
|
||||
else -> null
|
||||
}
|
||||
|
|
|
|||
|
|
@ -70,4 +70,8 @@ class SubscriberBenefitView @JvmOverloads constructor(
|
|||
fun hideArmoireBenefit() {
|
||||
binding.benefitArmoireWrapper.isVisible = false
|
||||
}
|
||||
|
||||
fun hideGemsForGoldBenefit() {
|
||||
binding.benefitGemsForGoldWrapper.isVisible = false
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue