修改IAP及隐私条款相关。

This commit is contained in:
oscarz
2024-08-17 12:23:47 +08:00
parent 00fd0adf89
commit 6d6776b9fd
21 changed files with 57 additions and 44 deletions

View File

@ -16,9 +16,9 @@ struct VIPPaymentView: View {
let freeValues = ["2 Times / Day", "2 Times / Day", "2 Times / Day"]
let premiumValues = ["Unlimited", "Unlimited", "Unlimited"]
let products = [
("Premium Weekly", "$4.99", "Billed Weekly", "weekly", IAPProduct.premiumFeature1),
("Premium Monthly", "$9.99 / month", "Billed Monthly", "monthly", IAPProduct.premiumFeature2),
("Premium Yearly", "$49.99 / year", "Billed Yearly", "yearly", IAPProduct.premiumFeature3)
("Weekly", "$4.99 / week", "Billed as one payment of $4.99", "weekly", IAPProduct.premiumFeature1, "Billed Weekly"),
("Monthly", "$9.99 / month", "Billed as one payment of $9.99", "monthly", IAPProduct.premiumFeature2, "Billed Monthly"),
("Annual", "$4.16 / month", "Billed as one payment of $49.99", "yearly", IAPProduct.premiumFeature3, "Billed Yearly")
]
@State private var selectedProductIndex: Int = 1 //
@ -74,44 +74,46 @@ struct VIPPaymentView: View {
}
}
ForEach(products.indices, id: \.self) { index in
Button(action: {
// do someting
}) {
HStack {
Image(systemName: selectedProductIndex == index ? "checkmark.circle.fill" : "circle")
.foregroundColor(selectedProductIndex == index ? .green : .secondary)
.padding(.horizontal, 4)
VStack(alignment: .leading) {
if products[index].0 == "Premium Yearly" {
// "Premium Yearly"
Text(products[index].0) + Text(" ⚡️") + Text(" 58% off")
.bold()
.foregroundColor(.red) // 使
VStack(alignment: .leading) { // 使 VStack ForEach
ForEach(products.indices, id: \.self) { index in
Button(action: {
// do someting
}) {
HStack() {
Image(systemName: selectedProductIndex == index ? "checkmark.circle.fill" : "circle")
.foregroundColor(selectedProductIndex == index ? .green : .secondary)
.padding(.horizontal, 4)
VStack(alignment: .leading) {
if products[index].0 == "Annual" {
// "Premium Yearly"
Text(products[index].0) + Text(" ⚡️") + Text(" 58% off")
.bold()
.foregroundColor(.red) // 使
.font(.subheadline)
} else {
Text(products[index].0)
}
Text(products[index].1)
.font(.caption)
Text(products[index].2)
.font(.subheadline)
} else {
Text(products[index].0)
}
Text(products[index].1)
.font(.subheadline)
.frame(maxWidth: .infinity, alignment: .leading) // 使 HStack
}
.padding(.vertical, 10)
.background(self.selectedProductIndex == index ? Color.yellow : Color.clear)
.cornerRadius(5)
.padding(.horizontal, 20) //
.onTapGesture {
self.selectedProductIndex = index
self.selectedPlanText = products[index].5
}
Spacer()
Text(products[index].2)
.font(.subheadline)
.foregroundColor(.secondary)
}
.padding(.vertical, 10)
.background(self.selectedProductIndex == index ? Color.yellow : Color.clear)
.cornerRadius(5)
.padding(.horizontal, 20) //
.onTapGesture {
self.selectedProductIndex = index
self.selectedPlanText = products[index].2
}
.frame(maxWidth: .infinity, alignment: .leading) // 使 HStack
}
}
Spacer()
.padding(.horizontal, 5) //
Button("Purchase") {
// Handle purchase logic here
@ -125,7 +127,7 @@ struct VIPPaymentView: View {
.frame(minWidth: 0, maxWidth: .infinity)
.shadow(radius: 2) //
.font(.headline) //
.padding(.top, 50)
.padding(.top, 20)
Text((selectedPlanText ) + ", Cancel Anytime")
.font(.footnote)
@ -135,7 +137,7 @@ struct VIPPaymentView: View {
}
.frame(maxWidth: .infinity, maxHeight: .infinity)
.background(Color(.systemBackground))
.toast(isPresented: $showingToast, dismissAfter: 5.0, onDismiss: {
.toast(isPresented: $showingToast, dismissAfter: globalEnvironment.toastPresentMsNormal, onDismiss: {
// Toast
presentationMode.wrappedValue.dismiss() //
}) {