Skip to content

Commit

Permalink
improve sub flow
Browse files Browse the repository at this point in the history
  • Loading branch information
phillipthelen committed Nov 4, 2024
1 parent 53d7f14 commit de17f0d
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 11 deletions.
16 changes: 9 additions & 7 deletions HabitRPG/UI/Purchases/G1G1Banner.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,23 @@ struct G1G1Banner: View {
}()

var body: some View {
HStack {
Image(Asset.promoGiftsLeft.name)
Spacer()
ZStack(alignment: .center) {
HStack {
Image(Asset.promoGiftsLeft.name)
Spacer()
Image(Asset.promoGiftsRight.name)
}
.background(LinearGradient(colors: [Color(UIColor("#3BCAD7")), Color(UIColor("#925CF3"))], startPoint: .topLeading, endPoint: .bottomTrailing))
VStack(spacing: 5) {
Text(L10n.giftOneGetOneTitle)
.font(.system(size: 22, weight: .bold))
Text(L10n.giftOneGetOneDescriptionDate(formatter.string(from: endDate)))
.font(.system(size: 16, weight: .semibold))
.lineSpacing(2)
.multilineTextAlignment(.center)
}.padding(.horizontal, 6)
Spacer()
Image(Asset.promoGiftsRight.name)
.padding(.horizontal, 50)
}
}
.background(LinearGradient(colors: [Color(UIColor("#3BCAD7")), Color(UIColor("#925CF3"))], startPoint: .topLeading, endPoint: .bottomTrailing))
.onTapGesture {
RouterHandler.shared.handle(.promoInfo)
}
Expand Down
7 changes: 4 additions & 3 deletions HabitRPG/UI/Purchases/SubscriptionDetailViewUI.swift
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ struct SubscriptionDetailViewUI: View {
}
Text(L10n.Subscription.monthsSubscribed)
.font(.system(size: 13, weight: .semibold))
}
}.frame(maxHeight: .infinity)
}
DetailContainer(verticalPadding: 14) {
VStack(spacing: 6) {
Expand All @@ -248,9 +248,10 @@ struct SubscriptionDetailViewUI: View {
}
Text(L10n.Subscription.monthlyGems)
.font(.system(size: 13, weight: .semibold))
}
}.frame(maxHeight: .infinity)
}
}
}.multilineTextAlignment(.center)
.fixedSize(horizontal: false, vertical: true)
DetailContainer(verticalPadding: 14) {
HStack(spacing: 4) {
Image(Asset.hourglassBannerLeft.name)
Expand Down
5 changes: 4 additions & 1 deletion HabitRPG/UI/Purchases/SubscriptionPage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -165,10 +165,13 @@ class SubscriptionViewModel: BaseSubscriptionViewModel {
withAnimation {
isSubscribing = true
}
PurchaseHandler.shared.purchaseSubscription(selectedSubscription) {[weak self] _ in
PurchaseHandler.shared.purchaseSubscription(selectedSubscription) {[weak self] success in
withAnimation {
self?.isSubscribing = false
}
if success && self?.presentationPoint != nil {
self?.dismiss()
}
}
}

Expand Down

0 comments on commit de17f0d

Please sign in to comment.