TSSettingListView.swift 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. //
  2. // SettingListView.swift
  3. // AIEmoji
  4. //
  5. // Created by 100Years on 2025/1/16.
  6. //
  7. import SwiftUI
  8. struct TSSettingListView: View {
  9. @ObservedObject var viewModel: TSSetingViewModel
  10. var publisher: ListEventPublisher
  11. var body: some View {
  12. ScrollView {
  13. // Color.clear
  14. VStack(spacing: 0) {
  15. Spacer().frame(height: 16)
  16. SettingPurchaseTopView(eventPublisher: publisher, isViper: $viewModel.isViper)
  17. .frame(height: 117*kDesignScale)
  18. .onTapGesture {
  19. if PurchaseManager.default.isVip {
  20. return
  21. }
  22. publisher.enterPurchasePublisher.send(true)
  23. }
  24. ForEach(viewModel.settingTypes, id:\.self) { type in
  25. Spacer().frame(height: 16)
  26. SettingListItemView(type: type,viewModel: viewModel)
  27. .onTapGesture {
  28. publisher.settingPublisher.send(type)
  29. }
  30. }
  31. Spacer()
  32. }
  33. .padding(.horizontal)
  34. Spacer().frame(height: 20)
  35. }
  36. }
  37. }
  38. struct SettingListItemView: View {
  39. var type : SettingType
  40. var viewModel: TSSetingViewModel
  41. var body: some View {
  42. ZStack {
  43. Color.white.opacity(0.1)
  44. HStack {
  45. Text(type.rawValue.localized).font(.font(size: 16.0)).foregroundColor(.white)
  46. Spacer()
  47. // if type != .about {
  48. // Image(.whiteRightArrow)
  49. // }else{
  50. // Text(appVersion()).foregroundColor(.hex("#FFFFFF").opacity(0.4)).font(.font(size: 16))
  51. // }
  52. if type == .update {
  53. if viewModel.isHaveNewVersion {
  54. Color.hex("#FECB34").frame(width: 4, height: 4).cornerRadius(2)
  55. Spacer().frame(width: 4)
  56. }
  57. Text(appVersion()).foregroundColor(.hex("#FFFFFF").opacity(0.4)).font(.font(size: 16))
  58. }
  59. Image(.whiteRightArrow)
  60. }.padding(.horizontal)
  61. }
  62. .frame(height: 64)
  63. .cornerRadius(16)
  64. // .cornerRadius(.allCorners, 16)
  65. }
  66. }