Skip to content

Commit

Permalink
fix: 过滤失效收藏订阅
Browse files Browse the repository at this point in the history
  • Loading branch information
yichengchen committed Feb 7, 2024
1 parent 28b7a29 commit accca13
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
14 changes: 8 additions & 6 deletions BilibiliLive/Module/ViewController/FavoriteViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,20 @@ class FavoriteViewController: CategoryViewController {
Task {
// 用户创建的收藏夹
let favList = try? await WebRequest.requestFavVideosList()
if favList != nil {
categories = favList!.map {
if let favList {
categories = favList.map {
return CategoryDisplayModel(title: $0.title, contentVC: FavoriteVideoContentViewController(info: $0))
}
}

// 用户收藏的订阅
let favFolderCollectedList = try? await WebRequest.requestFavFolderCollectedList()
if favFolderCollectedList != nil {
favFolderCollectedList!.forEach {
categories.append(CategoryDisplayModel(title: $0.title, contentVC: FavoriteVideoContentViewController(info: $0)))
}
if let favFolderCollectedList {
favFolderCollectedList
.filter { $0.mid != 0 }
.forEach {
categories.append(CategoryDisplayModel(title: $0.title, contentVC: FavoriteVideoContentViewController(info: $0)))
}
}

initTypeCollectionView()
Expand Down
3 changes: 2 additions & 1 deletion BilibiliLive/Request/WebRequest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -553,13 +553,14 @@ struct FavData: PlayableData, Codable {
class FavListData: Codable, Hashable {
let title: String
let id: Int
var mid: Int?
var currentPage = 1
var end = false
var loading = false
// 收藏夹是否为用户自己创建
var createBySelf = false
enum CodingKeys: String, CodingKey {
case title, id
case title, id, mid
}

static func == (lhs: FavListData, rhs: FavListData) -> Bool {
Expand Down

0 comments on commit accca13

Please sign in to comment.