Skip to content

Commit

Permalink
mystic hourglass benefit sub screen
Browse files Browse the repository at this point in the history
- mystic hourglass benefit sub screen variant added
- Show bottom sheet when time traveler page viewed
  • Loading branch information
Hafizzle committed Sep 21, 2023
1 parent 3d3fd97 commit 2bb168e
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 1 deletion.
1 change: 1 addition & 0 deletions Habitica/res/layout/subscription_benefits.xml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
</LinearLayout>

<LinearLayout
android:id="@+id/benefit_hourglasses_wrapper"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
Expand Down
1 change: 1 addition & 0 deletions Habitica/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1465,6 +1465,7 @@
<string name="subscriber_benefit_success_faint">You got a second chance with 1HP!</string>
<string name="revive_broken_equipment">Your %s broke</string>
<string name="subscribe_gems_for_gold_incentive_text">Subscribe to buy Gems with Gold and receive these other exclusive benefits!</string>
<string name="subscribe_hourglass_incentive_text">Subscribers get Mystic Hourglasses to buy items in the Time Travelers Shop and these other exclusive benefits!</string>


<plurals name="you_x_others">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -326,6 +325,12 @@ open class ShopFragment : BaseMainFragment<FragmentRefreshRecyclerviewBinding>()
}
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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}

}
Expand All @@ -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"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,8 @@ class SubscriberBenefitView @JvmOverloads constructor(
fun hideGemsForGoldBenefit() {
binding.benefitGemsForGoldWrapper.isVisible = false
}

fun hideMysticHourglassBenefit() {
binding.benefitHourglassesWrapper.isVisible = false
}
}

0 comments on commit 2bb168e

Please sign in to comment.