123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118 |
- //
- // TSPurchaseVideoTimesAlertView.swift
- // AIEmoji
- //
- // Created by 100Years on 2025/8/6.
- //
- import SwiftUI
- import SwiftUIX
- struct TSPurchaseVideoTimesAlertView :View {
- @ObservedObject var viewModel: TSPurchaseVideoTimesVM
- @State var isExpand: Bool = false
- var body: some View {
- VStack {
- let limit = "No effect uses left. Get more to keep creating.".localized
-
- Spacer()
- ZStack(alignment: .topTrailing) {
- VStack {
- Spacer().frame(height: 24)
- Text("Limit Reached".localized)
- .font(.font(size: 22,weight: .medium))
- .foregroundColor(.white)
- .padding(EdgeInsets(top: 0, leading: 10, bottom: 0, trailing: 10))
-
- Spacer().frame(height: 16)
- Text(limit)
- .foregroundColor(.white.opacity(0.7))
- .padding(EdgeInsets(top: 0, leading: 10, bottom: 0, trailing: 10))
-
- Spacer().frame(height: 15)
- VStack(alignment: .leading, spacing: 20, content: {
- TSPurchaseVideoTimesCellView(type: .purchase(.videoNum1), selectedType: $viewModel.selectedType)
- .onTapGesture {
- viewModel.selectedType = .purchase(.videoNum1)
- }
- ZStack(alignment: .topTrailing) {
- TSPurchaseVideoTimesCellView(type: .purchase(.videoNum2), selectedType: $viewModel.selectedType)
- .onTapGesture {
- viewModel.selectedType = .purchase(.videoNum2)
- }
- TSPurchaseVideoTimesRecView()
- .offset(x:-30,y:-14)
- }
- TSPurchaseVideoTimesCellView(type: .purchase(.videoNum3), selectedType: $viewModel.selectedType)
- .onTapGesture {
- viewModel.selectedType = .purchase(.videoNum3)
- }
- }).multilineTextAlignment(.center).font(.font(size: 16,weight:.regular)).foregroundColor(.white)
-
- Spacer().frame(height: 44)
-
-
- Button {
- viewModel.buyPublisher.send(true)
- } label: {
- ZStack {
- Image(.purchaseVideoTimesBtnbg)
- Text("Purchase".localized)
- .font(.font(size: 16,weight: .medium))
- .foregroundColor(.white)
- }.frame(maxWidth: .infinity ,minHeight: 48.0,maxHeight: 48.0)
- }
-
-
- VStack{
- Spacer().frame(height: 15)
- Button {
- withAnimation(.easeInOut(duration: 0.3)) {
- isExpand.toggle()
- }
- } label: {
- HStack(spacing: 4) {
- Text("View Usage Rules".localized)
- .font(.font(size: 12,weight: .regular))
- .foregroundColor(.white.opacity(0.7))
- Image(isExpand ? .chatUpArrow : .chatDownArrow)
- }
- }
- }
-
- if isExpand {
-
- Spacer().frame(height: 10)
-
- VStack(alignment: .leading, spacing: 8, content: {
- TSPurchaseVideoTextLineView(image: .purchaseVideoTimesCheck, text: "Only VIP can purchase video effect uses".localized)
- TSPurchaseVideoTextLineView(image: .purchaseVideoTimesCheck, text: "Uses can be applied to all video generations".localized)
- TSPurchaseVideoTextLineView(image: .purchaseVideoTimesCheck, text: "Uses never expire and can be purchased repeatedly".localized)
- TSPurchaseVideoTextLineView(image: .purchaseVideoTimesCheck, text: "All unused uses will be lost if the app is uninstalled".localized)
- })
- .padding(EdgeInsets(top: 0, leading: 10, bottom: 0, trailing: 10))
-
- Spacer().frame(height: 24 + k_Height_safeAreaInsetsBottom())
- }else{
- Spacer().frame(height: k_Height_safeAreaInsetsBottom())
- }
- }
- .padding(.horizontal,16)
- .background(
- // Image(.purchaseVideoTimesAlertBj)
- // .resizable() // 允许调整大小
- // .scaledToFill()
- Color.hex("#261840").cornerRadius([.topLeading,.topTrailing], 20)
- )
-
- Button {
- viewModel.closePagePublisher.send(true)
- } label: {
- Image(.closeClear).resizable().frame(width: 24, height: 24)
- }.offset(x:-8,y:8)
- }
- }
- .ignoresSafeArea()
- }
- }
|