|
@@ -61,69 +61,7 @@ class TSPurchaseVC: TSBaseVC {
|
|
|
lazy var bgView: UIView = {
|
|
|
let bgView = UIView()
|
|
|
bgView.backgroundColor = .clear
|
|
|
-
|
|
|
-// let imageScroll1 = createImageScroll(imageName: "img-premium-photos-1", direction: .topToBottom)
|
|
|
-// let imageScroll2 = createImageScroll(imageName: "img-premium-photos-2", direction: .bottomToTop)
|
|
|
-// let imageScroll3 = createImageScroll(imageName: "img-premium-photos-3", direction: .topToBottom)
|
|
|
-// let imageScroll4 = createImageScroll(imageName: "img-premium-photos-4", direction: .bottomToTop)
|
|
|
-// let imageScroll5 = createImageScroll(imageName: "img-premium-photos-5", direction: .topToBottom)
|
|
|
-//
|
|
|
-// bgView.addSubview(imageScroll1)
|
|
|
-// bgView.addSubview(imageScroll2)
|
|
|
-// bgView.addSubview(imageScroll3)
|
|
|
-// bgView.addSubview(imageScroll4)
|
|
|
-// bgView.addSubview(imageScroll5)
|
|
|
-//
|
|
|
-// let top = -40.0
|
|
|
-// let w = 110.0
|
|
|
-// let h = 600//554.0
|
|
|
-//
|
|
|
-// //中间
|
|
|
-// imageScroll3.snp.makeConstraints { make in
|
|
|
-// make.top.equalTo(top)
|
|
|
-// make.centerX.equalToSuperview()
|
|
|
-// make.width.equalTo(w)
|
|
|
-// make.height.equalTo(h)
|
|
|
-// }
|
|
|
-// //左边
|
|
|
-// imageScroll2.snp.makeConstraints { make in
|
|
|
-// make.top.equalTo(top)
|
|
|
-// make.trailing.equalTo(imageScroll3.snp.leading).offset(-12)
|
|
|
-// make.width.equalTo(w)
|
|
|
-// make.height.equalTo(h)
|
|
|
-// }
|
|
|
-//
|
|
|
-// imageScroll1.snp.makeConstraints { make in
|
|
|
-// make.top.equalTo(top)
|
|
|
-// make.trailing.equalTo(imageScroll2.snp.leading).offset(-12)
|
|
|
-// make.width.equalTo(w)
|
|
|
-// make.height.equalTo(h)
|
|
|
-// }
|
|
|
-//
|
|
|
-// //右边
|
|
|
-// imageScroll4.snp.makeConstraints { make in
|
|
|
-// make.top.equalTo(top)
|
|
|
-// make.leading.equalTo(imageScroll3.snp.trailing).offset(12)
|
|
|
-// make.width.equalTo(w)
|
|
|
-// make.height.equalTo(h)
|
|
|
-// }
|
|
|
-//
|
|
|
-// imageScroll5.snp.makeConstraints { make in
|
|
|
-// make.top.equalTo(top)
|
|
|
-// make.leading.equalTo(imageScroll4.snp.trailing).offset(12)
|
|
|
-// make.width.equalTo(w)
|
|
|
-// make.height.equalTo(h)
|
|
|
-// }
|
|
|
-//
|
|
|
-//
|
|
|
-// kDelayMainShort {//0.1 秒后开启动画
|
|
|
-// imageScroll1.startAnimation()
|
|
|
-// imageScroll2.startAnimation()
|
|
|
-// imageScroll3.startAnimation()
|
|
|
-// imageScroll4.startAnimation()
|
|
|
-// imageScroll5.startAnimation()
|
|
|
-// }
|
|
|
-
|
|
|
+
|
|
|
let imageView = UIImageView.createImageView(imageName: "purchase_bj",contentMode: .scaleAspectFill)
|
|
|
bgView.addSubview(imageView)
|
|
|
|
|
@@ -347,27 +285,33 @@ struct PurchaseView :View {
|
|
|
|
|
|
@ObservedObject var viewModel: PurchaseViewModel
|
|
|
|
|
|
+
|
|
|
var body: some View {
|
|
|
- ScrollView {
|
|
|
- Spacer().frame(height:274*kDesignScale)
|
|
|
+
|
|
|
+ let vipType = PurchaseManager.default.vipType
|
|
|
+
|
|
|
+ VStack {
|
|
|
+ Spacer()
|
|
|
+
|
|
|
VStack {
|
|
|
-
|
|
|
- Text("Get PRO Access")
|
|
|
+ let text = vipType == .none ? "Get PRO Access".localized : "Super Offer for Yearly Pro".localized
|
|
|
+ Text(text)
|
|
|
.font(.font(name: .PoppinsBlackItalic,size: 26))
|
|
|
.foregroundColor(UIColor.white.color)
|
|
|
.frame(height: 26*kDesignScale)
|
|
|
|
|
|
- Spacer().frame(height: 12)
|
|
|
-
|
|
|
- HStack {
|
|
|
- Text("Unlimited")
|
|
|
- .foregroundColor("#FECB34".uiColor.color)
|
|
|
-
|
|
|
- Text("Generation")
|
|
|
- .foregroundColor(UIColor.white.color)
|
|
|
-
|
|
|
- }.font(.font(name: .PoppinsBlackItalic,size: 26))
|
|
|
- .frame(height: 26*kDesignScale)
|
|
|
+ if vipType == .none {
|
|
|
+ Spacer().frame(height: 12)
|
|
|
+ HStack {
|
|
|
+ Text("Unlimited")
|
|
|
+ .foregroundColor("#FECB34".uiColor.color)
|
|
|
+
|
|
|
+ Text("Generation")
|
|
|
+ .foregroundColor(UIColor.white.color)
|
|
|
+
|
|
|
+ }.font(.font(name: .PoppinsBlackItalic,size: 26))
|
|
|
+ .frame(height: 26*kDesignScale)
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
Spacer().frame(height: 32)
|
|
@@ -377,30 +321,30 @@ struct PurchaseView :View {
|
|
|
ZStack(alignment: .topTrailing) {
|
|
|
PurchaseItemView(title: "One Year".localized, type: .year, selectedType: $viewModel.selectedType).onTapGesture {
|
|
|
viewModel.selectedType = .year
|
|
|
+ //playVibration()
|
|
|
}
|
|
|
TSVipRecView()
|
|
|
.offset(x:-30,y:-14)
|
|
|
}
|
|
|
-
|
|
|
-// HStack {
|
|
|
-// PurchaseItemView(title: "One Month".localized, type: .month, selectedType: $viewModel.selectedType).onTapGesture {
|
|
|
-// viewModel.selectedType = .month
|
|
|
-// }
|
|
|
+
|
|
|
+ if vipType == .none {
|
|
|
PurchaseItemView(title: "One Week".localized, type: .week, selectedType: $viewModel.selectedType).onTapGesture {
|
|
|
viewModel.selectedType = .week
|
|
|
}
|
|
|
-// }
|
|
|
+ }
|
|
|
+
|
|
|
+ Spacer().frame(height: 4)
|
|
|
|
|
|
Button {
|
|
|
viewModel.buyPublisher.send(true)
|
|
|
} label: {
|
|
|
ZStack {
|
|
|
- Color.hex("#FFBD59")
|
|
|
+ UIColor.themeColor.color
|
|
|
Text("Continue")
|
|
|
.font(.font(size: 16,weight: .medium))
|
|
|
.foregroundColor(.hex("#111111"))
|
|
|
|
|
|
- }.frame(maxWidth: .infinity ,minHeight: 48.0)
|
|
|
+ }.frame(maxWidth: .infinity ,minHeight: 48.0,maxHeight: 48.0)
|
|
|
.cornerRadius(24.0)
|
|
|
}
|
|
|
|
|
@@ -434,6 +378,8 @@ struct PurchaseView :View {
|
|
|
}
|
|
|
}.font(.system(size: 12)).foregroundColor(.hex("#999999"))
|
|
|
}.padding(.horizontal)
|
|
|
+
|
|
|
+ Spacer().frame(height:9+k_Height_safeAreaInsetsBottom())
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -448,10 +394,7 @@ struct PurchaseView :View {
|
|
|
startPoint: UnitPoint.leading,
|
|
|
endPoint: UnitPoint.trailing
|
|
|
)
|
|
|
-
|
|
|
-
|
|
|
-// .shadow(color: gorgeousColor.opacity(0.7), radius: 6, x: 0, y: 0)
|
|
|
-
|
|
|
+
|
|
|
.foregroundColor(gorgeousColor)
|
|
|
.frame(height: 20)
|
|
|
}
|
|
@@ -467,7 +410,7 @@ struct PurchaseItemView: View {
|
|
|
ZStack {
|
|
|
Color.white.opacity(0.1)
|
|
|
HStack {
|
|
|
-
|
|
|
+ //左边加个
|
|
|
VStack(alignment: .leading, spacing: 14) {
|
|
|
Text(title).font(.font(size: 14)).foregroundColor(UIColor.white.color)
|
|
|
Text(PurchaseManager.default.price(for: type) ?? "--").font(.font(size: 18,weight: .medium)).foregroundColor(UIColor.mainText.color)
|
|
@@ -475,15 +418,9 @@ struct PurchaseItemView: View {
|
|
|
|
|
|
Spacer()
|
|
|
|
|
|
+ //右边每周的💰
|
|
|
VStack(alignment: .trailing, spacing: 2) {
|
|
|
- if type == .year {
|
|
|
- if let price = PurchaseManager.default.averageWeeklyForYear() {
|
|
|
- Text("\(price)")
|
|
|
- }
|
|
|
- }else{
|
|
|
- Text("\(PurchaseManager.default.price(for: type) ?? "--")")
|
|
|
- }
|
|
|
-
|
|
|
+ Text("\(PurchaseManager.default.averageWeekly(for:type) ?? "--")")
|
|
|
Text("Per week".localized)
|
|
|
|
|
|
}.font(.font(size: 16,weight: .regular)).foregroundColor(Color.white.opacity(0.6))
|