From 2bb168e0afa94305d3eff89ebab345eebca7cf6a Mon Sep 17 00:00:00 2001 From: Hafizzle Date: Thu, 21 Sep 2023 14:09:23 -0400 Subject: [PATCH] mystic hourglass benefit sub screen - mystic hourglass benefit sub screen variant added - Show bottom sheet when time traveler page viewed --- Habitica/res/layout/subscription_benefits.xml | 1 + Habitica/res/values/strings.xml | 1 + .../ui/fragments/inventory/shops/ShopFragment.kt | 7 ++++++- .../EventOutcomeSubscriptionBottomSheetFragment.kt | 9 +++++++++ .../ui/views/subscriptions/SubscriberBenefitView.kt | 4 ++++ 5 files changed, 21 insertions(+), 1 deletion(-) diff --git a/Habitica/res/layout/subscription_benefits.xml b/Habitica/res/layout/subscription_benefits.xml index 9d1e8076ee..e75725d490 100644 --- a/Habitica/res/layout/subscription_benefits.xml +++ b/Habitica/res/layout/subscription_benefits.xml @@ -77,6 +77,7 @@ diff --git a/Habitica/res/values/strings.xml b/Habitica/res/values/strings.xml index 9e97429f0a..c8825b435f 100644 --- a/Habitica/res/values/strings.xml +++ b/Habitica/res/values/strings.xml @@ -1465,6 +1465,7 @@ You got a second chance with 1HP! Your %s broke Subscribe to buy Gems with Gold and receive these other exclusive benefits! + Subscribers get Mystic Hourglasses to buy items in the Time Travelers Shop and these other exclusive benefits! diff --git a/Habitica/src/main/java/com/habitrpg/android/habitica/ui/fragments/inventory/shops/ShopFragment.kt b/Habitica/src/main/java/com/habitrpg/android/habitica/ui/fragments/inventory/shops/ShopFragment.kt index 39731946f1..7b72907e82 100644 --- a/Habitica/src/main/java/com/habitrpg/android/habitica/ui/fragments/inventory/shops/ShopFragment.kt +++ b/Habitica/src/main/java/com/habitrpg/android/habitica/ui/fragments/inventory/shops/ShopFragment.kt @@ -35,7 +35,6 @@ import com.habitrpg.android.habitica.ui.views.dialogs.HabiticaProgressDialog import com.habitrpg.android.habitica.ui.views.insufficientCurrency.InsufficientGemsDialog import com.habitrpg.android.habitica.ui.views.shops.PurchaseDialog import com.habitrpg.common.habitica.helpers.ExceptionHandler -import com.habitrpg.common.habitica.helpers.MainNavigationController import com.habitrpg.common.habitica.helpers.RecyclerViewState import com.habitrpg.common.habitica.helpers.launchCatching import kotlinx.coroutines.Dispatchers @@ -326,6 +325,12 @@ open class ShopFragment : BaseMainFragment() } Shop.TIME_TRAVELERS_SHOP -> { formatTimeTravelersShop(shop1) + activity?.let { activity -> + val subscriptionBottomSheet = EventOutcomeSubscriptionBottomSheetFragment().apply { + eventType = EventOutcomeSubscriptionBottomSheetFragment.EVENT_GEMS_FOR_GOLD + } + subscriptionBottomSheet.show(activity.supportFragmentManager, SubscriptionBottomSheetFragment.TAG) + } } Shop.SEASONAL_SHOP -> { shop1.categories.sortWith( diff --git a/Habitica/src/main/java/com/habitrpg/android/habitica/ui/fragments/purchases/EventOutcomeSubscriptionBottomSheetFragment.kt b/Habitica/src/main/java/com/habitrpg/android/habitica/ui/fragments/purchases/EventOutcomeSubscriptionBottomSheetFragment.kt index 10191bcc48..d65faa732a 100644 --- a/Habitica/src/main/java/com/habitrpg/android/habitica/ui/fragments/purchases/EventOutcomeSubscriptionBottomSheetFragment.kt +++ b/Habitica/src/main/java/com/habitrpg/android/habitica/ui/fragments/purchases/EventOutcomeSubscriptionBottomSheetFragment.kt @@ -14,6 +14,7 @@ class EventOutcomeSubscriptionBottomSheetFragment : SubscriptionBottomSheetFragm EVENT_ARMOIRE_OPENED -> setArmoireEventSubscriptionViews() EVENT_DEATH_SCREEN -> setDeathScreenEventSubscriptionViews() EVENT_GEMS_FOR_GOLD -> setGemsForGoldEventSubscriptionViews() + EVENT_HOURGLASS_SHOP_OPENED -> setHourglassShopEventSubscriptionViews() } } @@ -36,10 +37,18 @@ class EventOutcomeSubscriptionBottomSheetFragment : SubscriptionBottomSheetFragm binding.subscription3month.visibility = View.GONE } + private fun setHourglassShopEventSubscriptionViews() { + binding.subscriberBenefitBanner.visibility = View.GONE + binding.subscribeBenefits.text = getString(R.string.subscribe_hourglass_incentive_text) + binding.subscriberBenefits.hideMysticHourglassBenefit() + binding.subscription1month.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" + const val EVENT_HOURGLASS_SHOP_OPENED = "hourglass_shop_opened" } } diff --git a/Habitica/src/main/java/com/habitrpg/android/habitica/ui/views/subscriptions/SubscriberBenefitView.kt b/Habitica/src/main/java/com/habitrpg/android/habitica/ui/views/subscriptions/SubscriberBenefitView.kt index a20203fd54..fe6022458b 100644 --- a/Habitica/src/main/java/com/habitrpg/android/habitica/ui/views/subscriptions/SubscriberBenefitView.kt +++ b/Habitica/src/main/java/com/habitrpg/android/habitica/ui/views/subscriptions/SubscriberBenefitView.kt @@ -74,4 +74,8 @@ class SubscriberBenefitView @JvmOverloads constructor( fun hideGemsForGoldBenefit() { binding.benefitGemsForGoldWrapper.isVisible = false } + + fun hideMysticHourglassBenefit() { + binding.benefitHourglassesWrapper.isVisible = false + } }