Skip to content

Commit

Permalink
update subscription screen
Browse files Browse the repository at this point in the history
  • Loading branch information
phillipthelen committed Aug 16, 2024
1 parent 0f20e77 commit caa1417
Show file tree
Hide file tree
Showing 7 changed files with 103 additions and 106 deletions.
118 changes: 59 additions & 59 deletions HabitRPG/Generated/Storyboard Scenes.swift

Large diffs are not rendered by default.

20 changes: 9 additions & 11 deletions HabitRPG/Generated/Strings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ public enum L10n {
public static var gameMechanics: String { return L10n.tr("Mainstrings", "game_mechanics") }
/// Gems allow you to buy fun extras for your account, including:
public static var gemBenefitsTitle: String { return L10n.tr("Mainstrings", "gem_benefits_title") }
/// %d Gem cap
/// Unlocks %d Gold-purchasable Gems per month
public static func gemCap(_ p1: Int) -> String {
return L10n.tr("Mainstrings", "gem_cap", p1)
}
Expand Down Expand Up @@ -1070,13 +1070,13 @@ public enum L10n {
public static var subscriptionGiftButton: String { return L10n.tr("Mainstrings", "subscription_gift_button") }
/// Want to give the benefits of a subscription to someone else?
public static var subscriptionGiftExplanation: String { return L10n.tr("Mainstrings", "subscription_gift_explanation") }
/// You’ll be able to buy Gems from the Market for 20 gold each!
/// Get up to 50 Gems in the Market to buy Quests, Customizations, Pets, and more!
public static var subscriptionInfo1Description: String { return L10n.tr("Mainstrings", "subscription_info_1_description") }
/// Gold for Gems
/// Free Monthly Gems
public static var subscriptionInfo1Title: String { return L10n.tr("Mainstrings", "subscription_info_1_title") }
/// Earn Mystic Hourglasses to purchase items in the Time Traveler’s Shop!
/// Never miss an item with 1 Mystic Hourglass a month to use in the Time Travelers Shop!
public static var subscriptionInfo2Description: String { return L10n.tr("Mainstrings", "subscription_info_2_description") }
/// Mystic Hourglasses
/// Monthly Mystic Hourglasses
public static var subscriptionInfo2Title: String { return L10n.tr("Mainstrings", "subscription_info_2_title") }
/// Subscribe now to get an exclusive set now and receive new items every month!
public static var subscriptionInfo3Description: String { return L10n.tr("Mainstrings", "subscription_info_3_description") }
Expand All @@ -1086,13 +1086,9 @@ public enum L10n {
}
/// Monthly Mystery Items
public static var subscriptionInfo3Title: String { return L10n.tr("Mainstrings", "subscription_info_3_title") }
/// Receive the Royal Purple Jackalope pet when you become a new subscriber.
public static var subscriptionInfo4Description: String { return L10n.tr("Mainstrings", "subscription_info_4_description") }
/// Special Subscriber Pet
public static var subscriptionInfo4Title: String { return L10n.tr("Mainstrings", "subscription_info_4_title") }
/// Discover even more items in Habitica with a 2x bonus daily drop cap.
/// Get a Royal Purple Jackalope plus double the Eggs, Hatching Potions, and Food each day to grow your Pet collection!
public static var subscriptionInfo5Description: String { return L10n.tr("Mainstrings", "subscription_info_5_description") }
/// Double the Drops
/// Special Pet & More Drops
public static var subscriptionInfo5Title: String { return L10n.tr("Mainstrings", "subscription_info_5_title") }
/// Choose the Subscription length that works for you
public static var subscriptionOptionsTitle: String { return L10n.tr("Mainstrings", "subscription_options_title") }
Expand Down Expand Up @@ -1174,6 +1170,8 @@ public enum L10n {
public static var triadBingoTitle: String { return L10n.tr("Mainstrings", "triadBingoTitle") }
/// Tuesday
public static var tuesday: String { return L10n.tr("Mainstrings", "tuesday") }
/// +2 Gems each month
public static var twoGemsPerMonth: String { return L10n.tr("Mainstrings", "two_gems_per_month") }
/// Two-Handed
public static var twoHanded: String { return L10n.tr("Mainstrings", "twoHanded") }
/// Unban User
Expand Down
15 changes: 6 additions & 9 deletions HabitRPG/HRPGModels/SubscriptionInformation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,31 +12,28 @@ class SubscriptionInformation {

static let titles: [String] = [
L10n.subscriptionInfo1Title,
L10n.Subscription.infoArmoireTitle,
L10n.subscriptionInfo2Title,
L10n.subscriptionInfo3Title,
L10n.subscriptionInfo2Title,
L10n.Subscription.infoFaintTitle,
L10n.subscriptionInfo4Title,
L10n.Subscription.infoArmoireTitle,
L10n.subscriptionInfo5Title
]

static let descriptions: [String] = [
L10n.subscriptionInfo1Description,
L10n.Subscription.infoArmoireDescription,
L10n.subscriptionInfo2Description,
L10n.subscriptionInfo3Description,
L10n.subscriptionInfo2Description,
L10n.Subscription.infoFaintDescription,
L10n.subscriptionInfo4Description,
L10n.Subscription.infoArmoireDescription,
L10n.subscriptionInfo5Description
]

static let images: [UIImage?] = [
Asset.subBenefitsGems.image,
Asset.subBenefitsArmoire.image,
Asset.subBenefitsHourglasses.image,
nil,
Asset.subBenefitsHourglasses.image,
Asset.subBenefitsFaint.image,
Asset.subBenefitsPet.image,
Asset.subBenefitsArmoire.image,
Asset.subBenefitDrops.image
]
}
17 changes: 8 additions & 9 deletions HabitRPG/Strings/Base.lproj/Mainstrings.strings
Original file line number Diff line number Diff line change
Expand Up @@ -731,7 +731,8 @@
"gift_confirmation_body" = "You sent %@ a %@-month Habitica subscription.";
"gift_subscription_prompt" = "Choose the subscription you’d like to gift below! This purchase won’t automatically renew.";
"gift_gems_prompt" = "Want to bestow a shiny haul of Gems to someone else?";
"gem_cap" = "%d Gem cap";
"gem_cap" = "Unlocks %d Gold-purchasable Gems per month";
"two_gems_per_month" = "+2 Gems each month";
"hourglass_count" = "+%d Mystic Hourglass";
"intro.welcome_prompt" = "What should we call you?";
"intro.welcome_speechbubble" = "Oh, you must be new here. I’m Justin, your guide to Habitica.\n\nFirst, what should we call you? Feel free to change what I picked. When you’re all set, let’s create your avatar!";
Expand Down Expand Up @@ -933,17 +934,15 @@
"publish_challenge" = "Publish Challenge";
"view_participant_progress" = "View Participant Progress";
"end_challenge" = "End Challenge";
"subscription_info_1_title" = "Gold for Gems";
"subscription_info_1_description" = "You’ll be able to buy Gems from the Market for 20 gold each!";
"subscription_info_2_title" = "Mystic Hourglasses";
"subscription_info_2_description" = "Earn Mystic Hourglasses to purchase items in the Time Traveler’s Shop!";
"subscription_info_1_title" = "Free Monthly Gems";
"subscription_info_1_description" = "Get up to 50 Gems in the Market to buy Quests, Customizations, Pets, and more!";
"subscription_info_2_title" = "Monthly Mystic Hourglasses";
"subscription_info_2_description" = "Never miss an item with 1 Mystic Hourglass a month to use in the Time Travelers Shop!";
"subscription_info_3_title" = "Monthly Mystery Items";
"subscription_info_3_description" = "Subscribe now to get an exclusive set now and receive new items every month!";
"subscription_info_3_description_new" = "Subscribe now to get this %@ set now and receive new items every month!";
"subscription_info_4_title" = "Special Subscriber Pet";
"subscription_info_4_description" = "Receive the Royal Purple Jackalope pet when you become a new subscriber.";
"subscription_info_5_title" = "Double the Drops";
"subscription_info_5_description" = "Discover even more items in Habitica with a 2x bonus daily drop cap.";
"subscription_info_5_title" = "Special Pet & More Drops";
"subscription_info_5_description" = "Get a Royal Purple Jackalope plus double the Eggs, Hatching Potions, and Food each day to grow your Pet collection!";
"subscription.info_armoire_title" = "Extra Armoire chances";
"subscription.info_armoire_description" = "Get two chances at new equipment from the Armoire for the price of one";
"subscription.info_faint_title" = "Second chance at life";
Expand Down
27 changes: 15 additions & 12 deletions HabitRPG/TableviewCells/SubscriptionOptionView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class SubscriptionOptionView: UITableViewCell {
setMonthCount(6)
case PurchaseHandler.subscriptionIdentifiers[3]:
setMonthCount(12)
flagView.text = "Save 20%"
flagView.text = "Popular"
flagView.textColor = .white
flagView.isHidden = false
default:
Expand Down Expand Up @@ -84,16 +84,16 @@ class SubscriptionOptionView: UITableViewCell {
switch count {
case 1:
setGemCap(25)
setHourglassCount(0)
showGemsPerMonth(true)
case 3:
setGemCap(30)
setHourglassCount(1)
setGemCap(25)
showGemsPerMonth(true)
case 6:
setGemCap(35)
setHourglassCount(2)
setGemCap(25)
showGemsPerMonth(true)
case 12:
setGemCap(45)
setHourglassCount(4)
setGemCap(50)
showGemsPerMonth(false)
default:
break
}
Expand All @@ -103,9 +103,12 @@ class SubscriptionOptionView: UITableViewCell {
gemCapLabel.text = L10n.gemCap(count)
}

func setHourglassCount(_ count: Int) {
// swiftlint:disable:next empty_count
mysticHourglassLabel.isHidden = count == 0
mysticHourglassLabel.text = L10n.hourglassCount(count)
private func showGemsPerMonth(_ show: Bool) {
if show {
mysticHourglassLabel.isHidden = false
mysticHourglassLabel.text = L10n.twoGemsPerMonth
} else {
mysticHourglassLabel.isHidden = true
}
}
}
10 changes: 5 additions & 5 deletions HabitRPG/UI/Purchases/SubscriptionPage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -315,17 +315,17 @@ struct SubscriptionPage: View {
if viewModel.presentationPoint != .gemForGold {
SubscriptionBenefitView(icon: Image(Asset.subBenefitsGems.name), title: Text(L10n.subscriptionInfo1Title), description: Text(L10n.subscriptionInfo1Description))
}
if viewModel.presentationPoint != .armoire {
SubscriptionBenefitView(icon: Image(Asset.subBenefitsArmoire.name), title: Text(L10n.Subscription.infoArmoireTitle), description: Text(L10n.Subscription.infoArmoireDescription))
}
SubscriptionBenefitView(icon: PixelArtView(name: "shop_set_mystery_\(viewModel.mysteryGear?.key?.split(separator: "_").last ?? "")"), title: Text(L10n.subscriptionInfo3Title), description: Text(L10n.subscriptionInfo3Description))

if viewModel.presentationPoint != .timetravelers {
SubscriptionBenefitView(icon: Image(Asset.subBenefitsHourglasses.name), title: Text(L10n.subscriptionInfo2Title), description: Text(L10n.subscriptionInfo2Description))
}
SubscriptionBenefitView(icon: PixelArtView(name: "shop_set_mystery_\(viewModel.mysteryGear?.key?.split(separator: "_").last ?? "")"), title: Text(L10n.subscriptionInfo3Title), description: Text(L10n.subscriptionInfo3Description))
if viewModel.presentationPoint != .faint {
SubscriptionBenefitView(icon: Image(Asset.subBenefitsFaint.name), title: Text(L10n.Subscription.infoFaintTitle), description: Text(L10n.Subscription.infoFaintDescription))
}
SubscriptionBenefitView(icon: Image(Asset.subBenefitsPet.name), title: Text(L10n.subscriptionInfo4Title), description: Text(L10n.subscriptionInfo4Description))
if viewModel.presentationPoint != .armoire {
SubscriptionBenefitView(icon: Image(Asset.subBenefitsArmoire.name), title: Text(L10n.Subscription.infoArmoireTitle), description: Text(L10n.Subscription.infoArmoireDescription))
}
SubscriptionBenefitView(icon: Image(Asset.subBenefitDrops.name), title: Text(L10n.subscriptionInfo5Title), description: Text(L10n.subscriptionInfo5Description)).padding(.bottom, 20)

if !viewModel.isSubscribed {
Expand Down
2 changes: 1 addition & 1 deletion HabitRPG/UI/Purchases/SubscriptionViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ class SubscriptionViewController: BaseTableViewController {
fatalError()
}
cell.title = SubscriptionInformation.titles[indexPath.item]
if indexPath.item == 3 && mysteryGear != nil {
if indexPath.item == 1 && mysteryGear != nil {
cell.descriptionText = L10n.subscriptionInfo3DescriptionNew(mysteryGear?.text ?? "")
ImageManager.getImage(name: "shop_set_mystery_\(mysteryGear?.key?.split(separator: "_").last ?? "")") { (image, _) in
cell.iconView.image = image
Expand Down

0 comments on commit caa1417

Please sign in to comment.