Skip to content

Commit

Permalink
sub page tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
phillipthelen committed Sep 18, 2024
1 parent 4ad265b commit 6a3f5ea
Show file tree
Hide file tree
Showing 23 changed files with 99 additions and 77 deletions.
10 changes: 5 additions & 5 deletions HabitRPG/Generated/Strings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1082,7 +1082,7 @@ 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") }
/// Get up to 50 Gems in the Market to buy Quests, Customizations, Pets, and more!
/// Get up to 50 Gold-purchasable Gems in the Market to buy Quests, Customizations, Pets, and more!
public static var subscriptionInfo1Description: String { return L10n.tr("Mainstrings", "subscription_info_1_description") }
/// Free Monthly Gems
public static var subscriptionInfo1Title: String { return L10n.tr("Mainstrings", "subscription_info_1_title") }
Expand All @@ -1092,9 +1092,9 @@ public enum L10n {
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") }
/// Stay decked out in the latest exclusive gear. Subscribe now to get %s!
public static func subscriptionInfo3DescriptionNew(_ p1: UnsafePointer<CChar>) -> String {
return L10n.tr("Mainstrings", "subscription_info_3_description_new", p1)
/// Stay decked out in the latest exclusive gear. Subscribe now to get %@’s %@!
public static func subscriptionInfo3DescriptionGear(_ p1: String, _ p2: String) -> String {
return L10n.tr("Mainstrings", "subscription_info_3_description_gear", p1, p2)
}
/// Limited Monthly Gear Sets
public static var subscriptionInfo3Title: String { return L10n.tr("Mainstrings", "subscription_info_3_title") }
Expand All @@ -1108,7 +1108,7 @@ public enum L10n {
public static var subscriptionPromoDescription: String { return L10n.tr("Mainstrings", "subscription_promo_description") }
/// Need Gems?
public static var subscriptionPromoTitle: String { return L10n.tr("Mainstrings", "subscription_promo_title") }
/// Subscribing supports our small team and helps keep Habitica running, thank you!
/// Subscribing supports our small team and helps keep Habitica running
public static var subscriptionSupportDevelopers: String { return L10n.tr("Mainstrings", "subscription_support_developers") }
/// success
public static var success: String { return L10n.tr("Mainstrings", "success") }
Expand Down
2 changes: 1 addition & 1 deletion HabitRPG/Habitica-Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>997</string>
<string>1000</string>
<key>CustomDomain</key>
<string>${CUSTOM_DOMAIN}</string>
<key>DisableSSL</key>
Expand Down
12 changes: 6 additions & 6 deletions HabitRPG/Images.xcassets/payment_gift.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
{
"images" : [
{
"filename" : "Group 712.png",
"idiom" : "universal",
"filename" : "payment_gift.png",
"scale" : "1x"
},
{
"filename" : "Group [email protected]",
"idiom" : "universal",
"filename" : "[email protected]",
"scale" : "2x"
},
{
"filename" : "Group [email protected]",
"idiom" : "universal",
"filename" : "[email protected]",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
"author" : "xcode",
"version" : 1
}
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
3 changes: 1 addition & 2 deletions HabitRPG/Storyboards/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -3428,13 +3428,12 @@
<barButtonItem key="rightBarButtonItem" systemItem="cancel" id="Xg0-Ur-YWK">
<color key="tintColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<connections>
<segue destination="wW2-hb-dip" kind="unwind" unwindAction="unwindToList:" id="Bwo-Ow-e2l"/>
<action selector="cancelButtonTapped:" destination="QrZ-zf-ehm" id="8MG-sb-kbc"/>
</connections>
</barButtonItem>
</navigationItem>
</hostingController>
<placeholder placeholderIdentifier="IBFirstResponder" id="9cl-Ci-XdC" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
<exit id="wW2-hb-dip" userLabel="Exit" sceneMemberID="exit"/>
</objects>
<point key="canvasLocation" x="2804" y="10418"/>
</scene>
Expand Down
6 changes: 3 additions & 3 deletions HabitRPG/Strings/Base.lproj/Mainstrings.strings
Original file line number Diff line number Diff line change
Expand Up @@ -936,12 +936,12 @@
"view_participant_progress" = "View Participant Progress";
"end_challenge" = "End Challenge";
"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_1_description" = "Get up to 50 Gold-purchasable 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" = "Limited Monthly Gear Sets";
"subscription_info_3_description" = "Subscribe now to get an exclusive set now and receive new items every month!";
"subscription_info_3_description_new" = "Stay decked out in the latest exclusive gear. Subscribe now to get %s!";
"subscription_info_3_description_gear" = "Stay decked out in the latest exclusive gear. Subscribe now to get %@’s %@!";
"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" = "Double Armoire Rewards";
Expand All @@ -953,7 +953,7 @@
"subscription_options_title" = "Choose the Subscription length that works for you";
"subscription_gift_explanation" = "Want to give the benefits of a subscription to someone else?";
"subscription_gift_button" = "Gift a Subscription";
"subscription_support_developers" = "Subscribing supports our small team and helps keep Habitica running, thank you!";
"subscription_support_developers" = "Subscribing supports our small team and helps keep Habitica running";
"subscribe" = "Subscribe";
"subscription.armore_header" = "Subscribers get extra chances at the Armoire and these other benefits!";
"subscription.faint_header" = "Subscribers get a second chance at life each day and these other benefits!";
Expand Down
11 changes: 7 additions & 4 deletions HabitRPG/UI/Purchases/GiftSubscriptionViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,18 @@ struct GiftSubscriptionPage: View {
SubscriptionOptionViewUI(price: Text(viewModel.priceFor(PurchaseHandler.noRenewSubscriptionIdentifiers[0])),
recurring: Text(viewModel.titleFor(PurchaseHandler.noRenewSubscriptionIdentifiers[0])),
instantGems: "24",
isSelected: PurchaseHandler.noRenewSubscriptionIdentifiers[0] == viewModel.selectedSubscription)
isSelected: PurchaseHandler.noRenewSubscriptionIdentifiers[0] == viewModel.selectedSubscription,
isGift: true)
SubscriptionOptionViewUI(price: Text(viewModel.priceFor(PurchaseHandler.noRenewSubscriptionIdentifiers[1])),
recurring: Text(viewModel.titleFor(PurchaseHandler.noRenewSubscriptionIdentifiers[1])),
instantGems: "24",
isSelected: PurchaseHandler.noRenewSubscriptionIdentifiers[1] == viewModel.selectedSubscription)
isSelected: PurchaseHandler.noRenewSubscriptionIdentifiers[1] == viewModel.selectedSubscription,
isGift: true)
SubscriptionOptionViewUI(price: Text(viewModel.priceFor(PurchaseHandler.noRenewSubscriptionIdentifiers[2])),
recurring: Text(viewModel.titleFor(PurchaseHandler.noRenewSubscriptionIdentifiers[2])),
instantGems: "24",
isSelected: PurchaseHandler.noRenewSubscriptionIdentifiers[2] == viewModel.selectedSubscription)
isSelected: PurchaseHandler.noRenewSubscriptionIdentifiers[2] == viewModel.selectedSubscription,
isGift: true)
SubscriptionOptionViewUI(price: Text(viewModel.priceFor(PurchaseHandler.noRenewSubscriptionIdentifiers[3])), recurring: Text(viewModel.titleFor(PurchaseHandler.noRenewSubscriptionIdentifiers[3])),
tag: HStack(spacing: 0) {
Image(uiImage: Asset.flagFlap.image.withRenderingMode(.alwaysTemplate)).foregroundColor(Color(hexadecimal: "77F4C7"))
Expand All @@ -76,7 +79,7 @@ struct GiftSubscriptionPage: View {
], startPoint: .leading, endPoint: .trailing))
},
instantGems: "50",
isSelected: PurchaseHandler.noRenewSubscriptionIdentifiers[3] == viewModel.selectedSubscription,
isGift: true, isSelected: PurchaseHandler.noRenewSubscriptionIdentifiers[3] == viewModel.selectedSubscription,
nonSalePrice: viewModel.twelveMonthNonSalePrice,
gemCapMax: true,
showHourglassPromo: false)
Expand Down
4 changes: 3 additions & 1 deletion HabitRPG/UI/Purchases/SubscriptionDetailViewUI.swift
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ struct SubscriptionDetailViewUI: View {
return L10n.subscriptionDuration(duration)
} else if plan.isGroupPlanSub {
return L10n.memberGroupPlan
} else if plan.isGifted {
return L10n.Subscription.gifted
} else if let terminated = plan.dateTerminated {
let formatter = DateFormatter()
formatter.dateStyle = .medium
Expand Down Expand Up @@ -245,7 +247,7 @@ struct SubscriptionDetailViewUI: View {
Text(cancelDescription).font(.system(size: 13))
if let text = cancelButtonText {
HabiticaButtonUI(label: Text(text).foregroundColor(.purple100), color: .yellow100, size: .compact) {

cancelSubscription()
}.padding(.top, 7)
}
}
Expand Down
24 changes: 17 additions & 7 deletions HabitRPG/UI/Purchases/SubscriptionOptionViewUI.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ struct HourglassPromo: View {
return Group {
Text("Get ") +
Text("12 Mystic Hourglasses").fontWeight(.bold) +
Text("immediately after your first 12 month subscription!")
Text(" immediately after your first 12 month subscription!")
}
.font(.system(size: 15, weight: .medium))
.foregroundColor(.teal1)
Expand Down Expand Up @@ -48,12 +48,15 @@ struct SubscriptionOptionViewUI<Price: View, Recurring: View, Tag: View>: View {
let recurring: Recurring
let tag: Tag
let instantGems: String
var isGift = false

var isSelected: Bool
var nonSalePrice: String?
var gemCapMax = false
var showHourglassPromo = false

@State var isVisible = false

var selectedColor: Color {
return nonSalePrice != nil ? Color.teal1 : .purple300
}
Expand Down Expand Up @@ -95,7 +98,7 @@ struct SubscriptionOptionViewUI<Price: View, Recurring: View, Tag: View>: View {
HStack(spacing: 8) {
Image(Asset.plus.name).renderingMode(.template).foregroundColor(isSelected ? Color.yellow100 : .purple400)
Group {
Text("Unlock ") +
Text(isGift ? "Unlocks " : "Unlock ") +
Text("\(instantGems) Gems").fontWeight(.bold).foregroundColor(isSelected ? Color.yellow5 : .white) +
Text(" per month instantly")
}.multilineTextAlignment(.leading)
Expand All @@ -110,9 +113,9 @@ struct SubscriptionOptionViewUI<Price: View, Recurring: View, Tag: View>: View {
}.multilineTextAlignment(.leading)
} else {
Group {
Text("Earn ") +
Text(isGift ? "Earns" : "Earn ") +
Text("+2 Gems").fontWeight(.bold).foregroundColor(isSelected ? Color.yellow5 : .white) +
Text(" every month you're subscribed")
Text(isGift ? " every month they're subscribed" : " every month you're subscribed")
}.multilineTextAlignment(.leading)
}
}.font(.caption)
Expand All @@ -129,8 +132,10 @@ struct SubscriptionOptionViewUI<Price: View, Recurring: View, Tag: View>: View {
tag.offset(y: 16)
}
.frame(height: showHourglassPromo ? 186 : 126)
if isSelected {
.zIndex(1)
if isSelected && isVisible {
Image(Asset.subscriptionSelectionIndicator.name)
.zIndex(300)
.frame(width: 40, height: 40)
.animation(.snappy(duration: 0.2).delay(0.5))
.asymmetricTransition(insertion: .slide, removal: .opacity.animation(.easeInOut(duration: 0.15)))
Expand All @@ -140,12 +145,17 @@ struct SubscriptionOptionViewUI<Price: View, Recurring: View, Tag: View>: View {
.cornerRadius(12)
.foregroundColor(isSelected ? selectedColor : Color.purple600)
.padding(.vertical, 4)
.onAppear {
withAnimation {
isVisible = true
}
}
}
}

extension SubscriptionOptionViewUI where Tag == EmptyView {
init(price: Price, recurring: Recurring, instantGems: String, isSelected: Bool) {
self.init(price: price, recurring: recurring, tag: EmptyView(), instantGems: instantGems, isSelected: isSelected)
init(price: Price, recurring: Recurring, instantGems: String, isSelected: Bool, isGift: Bool = false) {
self.init(price: price, recurring: recurring, tag: EmptyView(), instantGems: instantGems, isGift: isGift, isSelected: isSelected)
}
}

Expand Down
Loading

0 comments on commit 6a3f5ea

Please sign in to comment.