add in why subscribe text

This commit is contained in:
Trey t
2022-12-27 15:27:16 -06:00
parent 384a57a4bd
commit e7e9367896
5 changed files with 14 additions and 11 deletions

View File

@@ -86,7 +86,7 @@ struct MonthView: View {
if iapManager.showIAP { if iapManager.showIAP {
VStack { VStack {
Spacer() Spacer()
PurchaseButtonView(height: 175, iapManager: iapManager) PurchaseButtonView(iapManager: iapManager)
} }
} else if iapManager.showIAPWarning { } else if iapManager.showIAPWarning {
VStack { VStack {

View File

@@ -15,12 +15,10 @@ struct PurchaseButtonView: View {
var iapManager: IAPManager var iapManager: IAPManager
private let height: Float
private let showCountdownTimer: Bool private let showCountdownTimer: Bool
private let showManageSubClosure: (() -> Void)? private let showManageSubClosure: (() -> Void)?
public init(height: Float, iapManager: IAPManager, showManageSubClosure: (() -> Void)? = nil, showCountdownTimer: Bool = false) { public init(iapManager: IAPManager, showManageSubClosure: (() -> Void)? = nil, showCountdownTimer: Bool = false) {
self.height = height
self.showManageSubClosure = showManageSubClosure self.showManageSubClosure = showManageSubClosure
self.iapManager = iapManager self.iapManager = iapManager
self.showCountdownTimer = showCountdownTimer self.showCountdownTimer = showCountdownTimer
@@ -34,12 +32,10 @@ struct PurchaseButtonView: View {
case true: case true:
VStack { VStack {
buyOptionsView buyOptionsView
.frame(height: CGFloat(height))
.background(theme.currentTheme.secondaryBGColor) .background(theme.currentTheme.secondaryBGColor)
} }
case false: case false:
subscribedView subscribedView
.frame(height: CGFloat(height))
.background(theme.currentTheme.secondaryBGColor) .background(theme.currentTheme.secondaryBGColor)
} }
} }
@@ -51,7 +47,6 @@ struct PurchaseButtonView: View {
Text(String(localized: "purchase_view_title")) Text(String(localized: "purchase_view_title"))
.foregroundColor(textColor) .foregroundColor(textColor)
.frame(minWidth: 0, maxWidth: .infinity, alignment: .leading) .frame(minWidth: 0, maxWidth: .infinity, alignment: .leading)
.frame(height: 50)
.padding([.leading, .trailing]) .padding([.leading, .trailing])
VStack(alignment: .leading) { VStack(alignment: .leading) {
ForEach(iapManager.sortedSubscriptionKeysByPriceOptions, id: \.self) { product in ForEach(iapManager.sortedSubscriptionKeysByPriceOptions, id: \.self) { product in
@@ -98,6 +93,7 @@ struct PurchaseButtonView: View {
.bold() .bold()
.foregroundColor(textColor) .foregroundColor(textColor)
.frame(minWidth: 0, maxWidth: .infinity, alignment: .leading) .frame(minWidth: 0, maxWidth: .infinity, alignment: .leading)
.padding(.top)
if showCountdownTimer { if showCountdownTimer {
if let date = Calendar.current.date(byAdding: .day, value: 30, to: firstLaunchDate) { if let date = Calendar.current.date(byAdding: .day, value: 30, to: firstLaunchDate) {
@@ -126,6 +122,11 @@ struct PurchaseButtonView: View {
} }
.frame(minWidth: 0, maxWidth: .infinity, alignment: .leading) .frame(minWidth: 0, maxWidth: .infinity, alignment: .leading)
} }
Text(String(localized: "purchase_view_current_why_subscribe"))
.font(.body)
.bold()
.foregroundColor(textColor)
} }
HStack { HStack {
ForEach(iapManager.sortedSubscriptionKeysByPriceOptions) { product in ForEach(iapManager.sortedSubscriptionKeysByPriceOptions) { product in
@@ -137,6 +138,7 @@ struct PurchaseButtonView: View {
.bold() .bold()
.frame(maxWidth: .infinity) .frame(maxWidth: .infinity)
.contentShape(Rectangle()) .contentShape(Rectangle())
.frame(height: 65)
}) })
.padding() .padding()
.frame(maxWidth: .infinity) .frame(maxWidth: .infinity)
@@ -159,7 +161,7 @@ struct PurchaseButtonView: View {
VStack(alignment: .leading) { VStack(alignment: .leading) {
Text(String(localized: "purchase_view_current_subscription")) Text(String(localized: "purchase_view_current_subscription"))
.font(.title3) .font(.title3)
.padding(.leading) .padding([.leading, .top])
Divider() Divider()
@@ -229,6 +231,6 @@ struct PurchaseButtonView: View {
struct PurchaseButtonView_Previews: PreviewProvider { struct PurchaseButtonView_Previews: PreviewProvider {
static var previews: some View { static var previews: some View {
PurchaseButtonView(height: 175, iapManager: IAPManager()) PurchaseButtonView(iapManager: IAPManager())
} }
} }

View File

@@ -150,7 +150,7 @@ struct SettingsView: View {
ZStack { ZStack {
theme.currentTheme.secondaryBGColor theme.currentTheme.secondaryBGColor
VStack { VStack {
PurchaseButtonView(height: iapManager.currentSubscription != nil ? 300 : 200, iapManager: iapManager, showManageSubClosure: { PurchaseButtonView(iapManager: iapManager, showManageSubClosure: {
Task { Task {
await await
self.showManageSubscription() self.showManageSubscription()

View File

@@ -67,7 +67,7 @@ struct YearView: View {
if iapManager.showIAP { if iapManager.showIAP {
VStack { VStack {
Spacer() Spacer()
PurchaseButtonView(height: 175, iapManager: iapManager) PurchaseButtonView(iapManager: iapManager)
} }
} else if iapManager.showIAPWarning { } else if iapManager.showIAPWarning {
VStack { VStack {

View File

@@ -115,6 +115,7 @@
"purchase_view_cancel" = "Cancel"; "purchase_view_cancel" = "Cancel";
"purchase_view_current_subscription" = "Current Subscription"; "purchase_view_current_subscription" = "Current Subscription";
"purchase_view_current_subscription_expires_in" = "Trial expires in:"; "purchase_view_current_subscription_expires_in" = "Trial expires in:";
"purchase_view_current_why_subscribe" = "Subscription will give you access to historical data grouped by Month and Year";
"purchase_view_current_subscription_expired_on" = "Trial expired on:"; "purchase_view_current_subscription_expired_on" = "Trial expired on:";
"purchase_view_loading" = "Loading subscription options"; "purchase_view_loading" = "Loading subscription options";
"purchase_view_restore" = "Restore"; "purchase_view_restore" = "Restore";