123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171 |
- //
- // SettingListView.swift
- // AIEmoji
- //
- // Created by 100Years on 2025/1/16.
- //
- import SwiftUI
- import SwiftUIX
- struct TSSettingListView: View {
- @ObservedObject var viewModel: TSSetingViewModel
- var publisher: ListEventPublisher
- var body: some View {
- let spaceHeight = 16.0
- CocoaScrollView {
- VStack(spacing: 0) {
- Spacer().frame(height: spaceHeight)
-
- SettingPurchaseTopView(eventPublisher: publisher, vipType: $viewModel.vipType)
- .onTapGesture {
- publisher.enterPurchasePublisher.send(true)
- }
-
- if kPurchaseDefault.isVip {
- Spacer().frame(height: spaceHeight)
- SettingListVideoItemView(type: .videoPackage, publisher: publisher)
- }
-
- Spacer().frame(height: spaceHeight)
- VStack(spacing:0) {
- SettingListItemView(type: .videoTimes, publisher: publisher, rightView: SettingListNumItemView(num: $viewModel.videoTimes), rightArrow: false)
- SettingListItemView(type: .changeLanguage, publisher: publisher,rightView: EmptyView(), rightArrow: true)
- SettingListItemView(type: .update, publisher: publisher, rightView: SettingListAppUpdateItemView(isHaveNewVersion: $viewModel.isHaveNewVersion), rightArrow: true)
- }.cornerRadius(16)
-
- Spacer().frame(height: spaceHeight)
- VStack(spacing:0) {
- SettingListItemView(type: .rateus, publisher: publisher, rightView: EmptyView(), rightArrow: true)
- SettingListItemView(type: .shareus, publisher: publisher,rightView: EmptyView(), rightArrow: true)
- }.cornerRadius(16)
-
- Spacer().frame(height: spaceHeight)
- VStack(spacing:0) {
- SettingListItemView(type: .AboutData, publisher: publisher, rightView: EmptyView(), rightArrow: true)
- SettingListItemView(type: .removeCloudData, publisher: publisher,rightView: EmptyView(), rightArrow: true)
- SettingListItemView(type: .privacy, publisher: publisher,rightView: EmptyView(), rightArrow: true)
- SettingListItemView(type: .agreement, publisher: publisher,rightView: EmptyView(), rightArrow: true)
- }.cornerRadius(16)
-
- #if DEBUG
- Spacer().frame(height: spaceHeight)
- VStack(spacing:0) {
- SettingListItemView(type: .deleteAllData, publisher: publisher, rightView: EmptyView(), rightArrow: true)
- SettingListItemView(type: .lookAllData, publisher: publisher,rightView: EmptyView(), rightArrow: true)
- SettingListItemView(type: .videoTimesAdd, publisher: publisher,rightView: EmptyView(), rightArrow: true)
- SettingListItemView(type: .videoTimesReduce, publisher: publisher,rightView: EmptyView(), rightArrow: true)
- }.cornerRadius(16)
- #endif
- Spacer()
- }.padding(.horizontal)
- Spacer().frame(height: 20)
- }
- .alwaysBounceVertical(true)
- .scrollIndicatorStyle(HiddenScrollViewIndicatorStyle())
- }
- }
- struct SettingListItemView<RightView:View>: View {
- var type : SettingType
- var publisher: ListEventPublisher
- var rightView:RightView?
- var rightArrow: Bool
- var body: some View {
- ZStack {
- Color.white.opacity(0.1)
- HStack {
- Text(type.rawValue.localized).font(.font(size: 16.0)).foregroundColor(.white)
- Spacer()
- if let view = rightView{
- view
- }
-
- if rightArrow {
- Image(.whiteRightArrow)
- }
-
- }.padding(.horizontal)
- }
- .frame(height: 64)
- .onTapGesture {
- publisher.settingPublisher.send(type)
- }
- }
- }
- struct SettingListAppUpdateItemView: View {
- @Binding var isHaveNewVersion: Bool
- var body: some View {
- if isHaveNewVersion {
- Color.hex("#FECB34").frame(width: 4, height: 4).cornerRadius(2)
- Spacer().frame(width: 4)
- }
- Text(appVersion()).foregroundColor(.hex("#FFFFFF").opacity(0.4)).font(.font(size: 16))
- }
- }
- struct SettingListNumItemView: View {
- @Binding var num: Int
- var body: some View {
- Text("\(num)").foregroundColor(UIColor.themeColor.color).font(.font(size: 16))
- }
- }
- struct SettingListVideoItemView: View {
-
- var type : SettingType
- var publisher: ListEventPublisher
-
- var body: some View {
- ZStack{
- LinearGradient(gradient: Gradient(colors: [Color.hex("#583986"),Color.hex("#333C8C")]), startPoint: .leading, endPoint: .trailing)
- HStack(spacing:8){
- Image(.hourglass)
- Text("Video Effect Use Pack".localized).font(.font(size: 14.0)).foregroundColor(.white)
- Spacer()
- Image(.whiteRightArrow)
- }
- .padding(.horizontal)
- }
- .frame(height: 48)
- .cornerRadius(16)
- .onTapGesture {
- publisher.settingPublisher.send(type)
- }
- }
- }
- //
- //struct SettingListItemView: View {
- // var type : SettingType
- // var publisher: ListEventPublisher
- // @Binding var isHaveNewVersion: Bool
- //
- // var body: some View {
- // ZStack {
- // Color.white.opacity(0.1)
- // HStack {
- // Text(type.rawValue.localized).font(.font(size: 16.0)).foregroundColor(.white)
- // Spacer()
- // if type == .update {
- // if isHaveNewVersion {
- // Color.hex("#FECB34").frame(width: 4, height: 4).cornerRadius(2)
- // Spacer().frame(width: 4)
- // }
- // Text(appVersion()).foregroundColor(.hex("#FFFFFF").opacity(0.4)).font(.font(size: 16))
- // }
- //
- // Image(.whiteRightArrow)
- // }.padding(.horizontal)
- // }
- // .frame(height: 64)
- //// .cornerRadius(16)
- //// .cornerRadius(.allCorners, 16)
- // }
- //}
|