Skip to content

Commit

Permalink
check if user has no hourglasses -> show sub bottomsheet
Browse files Browse the repository at this point in the history
  • Loading branch information
Hafizzle committed Sep 28, 2023
1 parent 574b1da commit 3dc0759
Showing 1 changed file with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import com.habitrpg.android.habitica.ui.views.CurrencyText
import com.habitrpg.android.habitica.ui.views.dialogs.HabiticaAlertDialog
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.insufficientCurrency.InsufficientHourglassesDialog
import com.habitrpg.android.habitica.ui.views.shops.PurchaseDialog
import com.habitrpg.common.habitica.helpers.ExceptionHandler
import com.habitrpg.common.habitica.helpers.RecyclerViewState
Expand Down Expand Up @@ -327,12 +328,16 @@ open class ShopFragment : BaseMainFragment<FragmentRefreshRecyclerviewBinding>()
}
Shop.TIME_TRAVELERS_SHOP -> {
formatTimeTravelersShop(shop1)
if (userViewModel.user.value?.isSubscribed == false && (hourglasses.value ?: 0.0) <= 0.0) {
activity?.let { activity ->
val subscriptionBottomSheet = EventOutcomeSubscriptionBottomSheetFragment().apply {
eventType = EventOutcomeSubscriptionBottomSheetFragment.EVENT_HOURGLASS_SHOP_OPENED
if (userViewModel.user.value?.isSubscribed == false) {
if ((hourglasses.value ?: 0.0) > 0.0) {
context?.let { context -> InsufficientHourglassesDialog(context).show()}
} else {
activity?.let { activity ->
val subscriptionBottomSheet = EventOutcomeSubscriptionBottomSheetFragment().apply {
eventType = EventOutcomeSubscriptionBottomSheetFragment.EVENT_HOURGLASS_SHOP_OPENED
}
subscriptionBottomSheet.show(activity.supportFragmentManager, SubscriptionBottomSheetFragment.TAG)
}
subscriptionBottomSheet.show(activity.supportFragmentManager, SubscriptionBottomSheetFragment.TAG)
}
}
}
Expand Down

0 comments on commit 3dc0759

Please sign in to comment.