TSAIListHistoryBaseVM.swift 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. //
  2. // TSAIListHistoryBaseVM.swift
  3. // AIEmoji
  4. //
  5. // Created by 100Years on 2025/4/9.
  6. //
  7. import Alamofire
  8. import ObjectMapper
  9. class TSAIListHistoryBaseVM {
  10. var colDataArray:[TSComponent] = [TSComponent]()
  11. lazy var historySeciton: TSGenmojiCoLSectionModel = {
  12. debugPrint("123")
  13. let sectionModel = TSGenmojiCoLSectionModel()
  14. sectionModel.style = .changeAgeHistory
  15. sectionModel.name = "History".localized
  16. for model in listModelArray {
  17. let itemModel = TSGenmojiCoLItemModel()
  18. itemModel.style = sectionModel.style
  19. itemModel.dataModel = model
  20. sectionModel.items.append(itemModel)
  21. }
  22. debugPrint("456")
  23. return sectionModel
  24. }()
  25. var generatorStyle:TSGeneratorImageStyle
  26. init(generatorStyle:TSGeneratorImageStyle) {
  27. self.generatorStyle = generatorStyle
  28. self.combinedData()
  29. }
  30. func combinedData(){
  31. colDataArray.removeAll()
  32. if historySeciton.items.count > 0 {
  33. colDataArray.append(historySeciton)
  34. }
  35. }
  36. func removeAllHistoryList(){
  37. switch generatorStyle {
  38. case .ageOld:
  39. TSChangeOldAgeHistory.shared.removeALLModel()
  40. case .ageChild:
  41. TSChangeBabyAgeHistory.shared.removeALLModel()
  42. case .oldPhoto:
  43. TSChangeOldPhotoHistory.shared.removeALLModel()
  44. case .eyeOpen:
  45. TSAIEyeOpenHistory.shared.removeALLModel()
  46. case .pretty:
  47. TSAIPhotoPrettyHistory.shared.removeALLModel()
  48. case .photoLive:
  49. TSAIPhotoLiveHistory.shared.removeALLModel()
  50. case .photoExpand:
  51. TSAIPhotoExpandHistory.shared.removeALLModel()
  52. }
  53. colDataArray.removeAll()
  54. }
  55. }
  56. extension TSAIListHistoryBaseVM {
  57. var listModelArray:[TSActionInfoModel]{
  58. switch generatorStyle {
  59. case .ageOld:
  60. TSChangeOldAgeHistory.shared.listModels
  61. case .ageChild:
  62. TSChangeBabyAgeHistory.shared.listModels
  63. case .oldPhoto:
  64. TSChangeOldPhotoHistory.shared.listModels
  65. case .eyeOpen:
  66. TSAIEyeOpenHistory.shared.listModels
  67. case .pretty:
  68. TSAIPhotoPrettyHistory.shared.listModels
  69. case .photoLive:
  70. TSAIPhotoLiveHistory.shared.listModels
  71. case .photoExpand:
  72. TSAIPhotoExpandHistory.shared.listModels
  73. }
  74. }
  75. }