From d2880b76b136f108f091c5fd88f7795a0685ff96 Mon Sep 17 00:00:00 2001 From: Phillip Thelen Date: Mon, 14 Oct 2024 13:10:28 +0200 Subject: [PATCH] various subscription page fixes --- Habitica/res/drawable/pill_bg_yellow_100.xml | 6 ++++ Habitica/res/layout/activity_death.xml | 3 +- .../res/layout/activity_gift_subscription.xml | 35 +++++++++++++++++-- .../layout/fragment_subscription_content.xml | 4 +-- Habitica/res/layout/gift_segment.xml | 4 +-- Habitica/res/layout/subscription_details.xml | 6 +++- Habitica/res/values/strings.xml | 18 +++++----- Habitica/res/values/styles.xml | 6 ++++ .../habitica/helpers/AppConfigManager.kt | 4 ++- ...tOutcomeSubscriptionBottomSheetFragment.kt | 1 - .../SubscriptionBottomSheetFragment.kt | 2 +- .../subscriptions/SubscriptionDetailsView.kt | 7 +++- 12 files changed, 74 insertions(+), 22 deletions(-) create mode 100644 Habitica/res/drawable/pill_bg_yellow_100.xml diff --git a/Habitica/res/drawable/pill_bg_yellow_100.xml b/Habitica/res/drawable/pill_bg_yellow_100.xml new file mode 100644 index 000000000..36ff67376 --- /dev/null +++ b/Habitica/res/drawable/pill_bg_yellow_100.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/Habitica/res/layout/activity_death.xml b/Habitica/res/layout/activity_death.xml index d14e7b26e..10a05ca1b 100644 --- a/Habitica/res/layout/activity_death.xml +++ b/Habitica/res/layout/activity_death.xml @@ -91,7 +91,6 @@ android:layout_width="match_parent" android:layout_height="69dp" android:layout_marginHorizontal="24dp" - android:layout_marginBottom="6dp" android:text="@string/faint_button" android:textStyle="bold" /> @@ -101,6 +100,7 @@ android:layout_height="60dp" android:layout_marginHorizontal="24dp" app:activeBackground="@drawable/ad_button_background_content" + android:visibility="gone" app:text="@string/watch_ad_to_hang_on" app:textColor="@color/text_primary" /> @@ -114,7 +114,6 @@ diff --git a/Habitica/res/layout/activity_gift_subscription.xml b/Habitica/res/layout/activity_gift_subscription.xml index 8336bb328..add23bc93 100644 --- a/Habitica/res/layout/activity_gift_subscription.xml +++ b/Habitica/res/layout/activity_gift_subscription.xml @@ -17,10 +17,39 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:minHeight="?attr/actionBarSize" - android:background="@color/brand_300" - app:titleTextColor="@color/white" + android:background="?attr/colorContentBackground" app:layout_scrollFlags="scroll|enterAlways" - app:popupTheme="@style/ThemeOverlay.AppCompat.Dark" /> + style="@style/Toolbar.Modern" + app:popupTheme="@style/Theme.AppCompat.DayNight"> + + + + + + + + diff --git a/Habitica/res/layout/fragment_subscription_content.xml b/Habitica/res/layout/fragment_subscription_content.xml index c53fbb0ee..f969cd291 100644 --- a/Habitica/res/layout/fragment_subscription_content.xml +++ b/Habitica/res/layout/fragment_subscription_content.xml @@ -247,8 +247,8 @@ diff --git a/Habitica/res/layout/subscription_details.xml b/Habitica/res/layout/subscription_details.xml index 2d9baecb9..6bceb8f81 100644 --- a/Habitica/res/layout/subscription_details.xml +++ b/Habitica/res/layout/subscription_details.xml @@ -86,7 +86,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_vertical" - android:text="@string/not_recurring" + android:text="@string/gifted" android:visibility="gone" /> @@ -321,6 +324,7 @@ android:textColor="@color/white" android:textSize="14sp" android:textStyle="italic" + android:lineHeight="18sp" android:layout_marginTop="4dp" android:layout_marginHorizontal="16dp" android:gravity="center" /> diff --git a/Habitica/res/values/strings.xml b/Habitica/res/values/strings.xml index a51d64d54..fa23536d6 100644 --- a/Habitica/res/values/strings.xml +++ b/Habitica/res/values/strings.xml @@ -423,8 +423,9 @@ Active Due Cancel Subscription - You can cancel your subscription from the Google Play Store app. Any months of Subscription credit will be applied after your recurring Subscription has ended. - No longer want to subscribe? Due to constraints on mobile payments, you\'ll need to cancel via our website. To do this, tap the button below, log in to your account, tap the player icon in the top right, then go to Subscription. Any months of subscription credit will be applied after your subscription has ended. We\'ll miss you! + No longer want to subscribe? You can find the option to unsubscribe by going to the Payments & Subscriptions section of the Google Play Store app. Any leftover months of subscription credit will be added to your end date after cancellation. + No longer want to subscribe? Due to your payment method, you’ll need to unsubscribe from our website. To do this, tap the button below, log in to your account, tap the player icon in the top right, then go to the Subscription section. Any leftover months of subscription credit will be added to your end date after cancellation. We’ll miss you! + No longer want to subscribe? Due to your payment method, you’ll need to unsubscribe through your Apple ID subscription settings on your iOS device. Visit Habitica Website Current Bonuses Months Subscribed @@ -434,10 +435,10 @@ Inactive 1 Month %d Months - month - 3 months - 6 months - 12 months + Month + 3 mMnths + 6 Months + 12 Months You get these benefits for being a Subscriber Subscription Status @@ -1275,7 +1276,7 @@ Your Tutorials were reset You ran out of Health! But you can get them all back with hard work! Good luck—you’ll do great. - Broken equipment can be repurchased \nfrom Rewards + Broken equipment can be repurchased \nfrom the Market %d, lose %d Gold, and break a piece of gear… You can earn them all back with hard work!]]> %d, lose %d Gold, and your Experience… You can earn them all back with hard work!]]> Account Reset @@ -1491,7 +1492,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! + Subscribers get a Mystic Hourglass each month along with these exclusive benefits! SUBSCRIBER BENEFIT You don\'t have any Saddles Saddles instantly raise a Pet to a Mount. You can purchase one from the Market. @@ -1558,6 +1559,7 @@ Set Resubscribe to pick up where you left off! %d/%d Gem Cap + Open Habitica Website You diff --git a/Habitica/res/values/styles.xml b/Habitica/res/values/styles.xml index 3776b09cc..12303cc0f 100644 --- a/Habitica/res/values/styles.xml +++ b/Habitica/res/values/styles.xml @@ -600,6 +600,12 @@ @drawable/pill_bg_yellow + + + diff --git a/Habitica/src/main/java/com/habitrpg/android/habitica/helpers/AppConfigManager.kt b/Habitica/src/main/java/com/habitrpg/android/habitica/helpers/AppConfigManager.kt index e76753e04..0449cd9d4 100644 --- a/Habitica/src/main/java/com/habitrpg/android/habitica/helpers/AppConfigManager.kt +++ b/Habitica/src/main/java/com/habitrpg/android/habitica/helpers/AppConfigManager.kt @@ -120,7 +120,9 @@ class AppConfigManager(contentRepository: ContentRepository) : fun activePromo(): HabiticaPromotion? { var promo: HabiticaPromotion? = null if (worldState?.isValid == true) { - for (event in worldState?.events ?: listOf(worldState?.currentEvent)) { + val allEvents = worldState?.events?.toMutableList() ?: mutableListOf() + allEvents.add(worldState?.currentEvent) + for (event in allEvents) { if (event == null) return null val thisPromo = getHabiticaPromotionFromKey( 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 2c5971916..814be72cd 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 @@ -42,7 +42,6 @@ class EventOutcomeSubscriptionBottomSheetFragment : SubscriptionBottomSheetFragm private fun setHourglassShopEventSubscriptionViews() { binding.content.subscribeBenefitsTitle.text = getString(R.string.subscribe_hourglass_incentive_text) - binding.content.subscriberBenefits.hideMysticHourglassBenefit() skus.firstOrNull { buttonForSku(it)?.isVisible == true }?.let { selectSubscription(it) } } diff --git a/Habitica/src/main/java/com/habitrpg/android/habitica/ui/fragments/purchases/SubscriptionBottomSheetFragment.kt b/Habitica/src/main/java/com/habitrpg/android/habitica/ui/fragments/purchases/SubscriptionBottomSheetFragment.kt index 284bcf1f2..839f51914 100644 --- a/Habitica/src/main/java/com/habitrpg/android/habitica/ui/fragments/purchases/SubscriptionBottomSheetFragment.kt +++ b/Habitica/src/main/java/com/habitrpg/android/habitica/ui/fragments/purchases/SubscriptionBottomSheetFragment.kt @@ -215,7 +215,7 @@ open class SubscriptionBottomSheetFragment : BottomSheetDialogFragment() { if (totalGemCap > 24) { binding.content.existingGemCapBonusView.visibility = View.VISIBLE - binding.content.gemCapExtraLabel.text = getString(R.string.gem_cap_extra, totalGemCap - 24, 50) + binding.content.gemCapExtraLabel.text = getString(R.string.gem_cap_extra, totalGemCap, 50) binding.content.extraGemsProgress.progress = totalGemCap } else { binding.content.existingGemCapBonusView.visibility = View.GONE diff --git a/Habitica/src/main/java/com/habitrpg/android/habitica/ui/views/subscriptions/SubscriptionDetailsView.kt b/Habitica/src/main/java/com/habitrpg/android/habitica/ui/views/subscriptions/SubscriptionDetailsView.kt index ec46b41d1..f5885d630 100644 --- a/Habitica/src/main/java/com/habitrpg/android/habitica/ui/views/subscriptions/SubscriptionDetailsView.kt +++ b/Habitica/src/main/java/com/habitrpg/android/habitica/ui/views/subscriptions/SubscriptionDetailsView.kt @@ -166,6 +166,7 @@ class SubscriptionDetailsView : LinearLayout { if (plan.paymentMethod == "Google") { binding.changeSubscriptionDescription.setText(R.string.cancel_subscription_google_description) binding.changeSubscriptionButton.setText(R.string.open_in_store) + binding.changeSubscriptionButton.visibility = View.VISIBLE } else { if (plan.isGroupPlanSub) { /*if (plan.ownerID == currentUserID) { @@ -174,10 +175,14 @@ class SubscriptionDetailsView : LinearLayout { binding.changeSubscriptionDescription.setText(R.string.cancel_subscription_group_plan) binding.changeSubscriptionButton.visibility = View.GONE // } + } else if (plan.paymentMethod == "Apple") { + binding.changeSubscriptionDescription.setText(R.string.cancel_subscription_apple_description) + binding.changeSubscriptionButton.visibility = View.GONE } else { binding.changeSubscriptionDescription.setText(R.string.cancel_subscription_notgoogle_description) + binding.changeSubscriptionButton.setText(R.string.open_habitica_website) + binding.changeSubscriptionButton.visibility = View.VISIBLE } - binding.changeSubscriptionButton.setText(R.string.visit_habitica_website) } } if (plan.dateTerminated != null) {