修改IAP及隐私条款相关。
This commit is contained in:
@ -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() // 关闭当前视图
|
||||
}) {
|
||||
|
||||
Reference in New Issue
Block a user