EstuLogPhotoCellReactor.swift 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. //
  2. // EstuLogPhotoCellReactor.swift
  3. // JiaPeiManage
  4. //
  5. // Created by Ning.ge on 2023/8/30.
  6. //
  7. import ReactorKit
  8. import RxSwift
  9. final class EstuLogPhotoCellReactor: Reactor {
  10. enum Action {
  11. case follow(season_id:String, season_type:String)
  12. case unFollow(season_id:String, season_type:String)
  13. }
  14. struct State {
  15. // var coverURL: URL?
  16. var favourites: String?
  17. var title: String
  18. }
  19. let initialState: State
  20. // private let service: HomeServiceType
  21. init(recommend: AnyObject, service: AnyObject) {
  22. // self.service = service
  23. //
  24. // let coverURL = URL(string: recommend.cover)
  25. // let favourites = "\(recommend.favorites ?? "")人追番"
  26. // let latestUpdate = "更新至第\(recommend.newest_ep_index)话"
  27. // var tagDesc: String = ""
  28. // if let tags = recommend.tags {
  29. // for tag in tags {
  30. // tagDesc += ",\(tag.tag_name)"
  31. // }
  32. // }
  33. //
  34. // if !tagDesc.isEmpty {
  35. // tagDesc.remove(at: String.Index(utf16Offset: 0, in: tagDesc))
  36. // }
  37. self.initialState = State(
  38. // coverURL: "",
  39. favourites: "favourites",
  40. title: "recommend.title"
  41. )
  42. _ = self.state
  43. }
  44. // init(like: DramaLikeModel, service: HomeServiceType, isLast:Bool) {
  45. //
  46. // self.service = service
  47. //
  48. // let coverURL = URL(string: like.cover)
  49. // let latestUpdate = "更新至第\(like.newest_ep_index)话"
  50. // var watchProgress: String?
  51. // if like.user_season.last_ep_index.isEmpty {
  52. // watchProgress = "尚未观看"
  53. // }else{
  54. // if let num = Int(like.user_season.last_ep_index) {
  55. // watchProgress = "看到第\(num)话"
  56. // }else{
  57. // watchProgress = "看到\(like.user_season.last_ep_index)"
  58. // }
  59. // }
  60. //
  61. // self.initialState = State(coverURL: coverURL,
  62. // favourites: nil,
  63. // badge: like.badge,
  64. // title: like.title,
  65. // latestUpdate: latestUpdate,
  66. // latestUpdateColor:UIColor.db_darkGray,
  67. // watchProgress:watchProgress,
  68. // tagDesc: nil,
  69. // season_id:nil,
  70. // season_type:nil,
  71. // isRcmd:false,
  72. // isHiddenLine: isLast)
  73. // _ = self.state
  74. // }
  75. // //只需调用接口,其他不用处理
  76. // func mutate(action: Action) -> Observable<Void> {
  77. // switch action {
  78. // case .follow(let season_id, let season_type):
  79. //
  80. // BilibiliToaster.show("由于接口加密,所以需要看到类似B站的效果必须用自己手机抓包,将请求参数替换")
  81. //
  82. // _ = service.dramaFollow(season_id: season_id, season_type: season_type).asObservable().subscribe()
  83. // return .empty()
  84. // case .unFollow(let season_id, let season_type):
  85. // _ = service.dramaUnFollow(season_id: season_id, season_type: season_type).subscribe()
  86. // return .empty()
  87. // }
  88. // }
  89. }