Skip to content

Commit

Permalink
Merge pull request #104 from Darock-Studio/feature/history-delection
Browse files Browse the repository at this point in the history
添加删除历史记录功能
  • Loading branch information
WindowsMEMZ authored Feb 1, 2024
2 parents fad1787 + f84cc05 commit 1ccd10f
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 2 deletions.
26 changes: 26 additions & 0 deletions DarockBili Watch App/PersonalCenter/HistoryView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,34 @@ struct HistoryView: View {
ForEach(0...histories.count - 1, id: \.self) { i in
if (histories[i] as! [String: Any])["Type"]! as! String == "archive" {
VideoCard(histories[i] as! [String: String])
.swipeActions {
Button(role: .destructive, action: {
let headers: HTTPHeaders = [
"cookie": "SESSDATA=\(sessdata);",
"User-Agent": "Mozilla/5.0 (X11; CrOS x86_64 14541.0.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"
]
AF.request("https://api.bilibili.com/x/v2/history/delete?kid=archive_\(bv2av(bvid: (histories[i] as! [String: String])["BV"]!))&csrf=\(biliJct)", method: .post, headers: headers).response { response in
debugPrint(response)
}
}, label: {
Image(systemName: "xmark.bin.fill")
})
}
} else if (histories[i] as! [String: Any])["Type"]! as! String == "pgc" {
BangumiCard((histories[i] as! [String: Any])["Data"] as! BangumiData)
.swipeActions {
Button(role: .destructive, action: {
let headers: HTTPHeaders = [
"cookie": "SESSDATA=\(sessdata);",
"User-Agent": "Mozilla/5.0 (X11; CrOS x86_64 14541.0.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"
]
AF.request("https://api.bilibili.com/x/v2/history/delete?kid=pgc_\(((histories[i] as! [String: Any])["Data"] as! BangumiData).seasonId)&csrf=\(biliJct)", method: .post, headers: headers).response { response in
debugPrint(response)
}
}, label: {
Image(systemName: "xmark.bin.fill")
})
}
}
}
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/SDWebImage/SDWebImageWebPCoder",
"state" : {
"revision" : "acfb824ca5cd9dbde2c43dc6b5a008c6757dee85",
"version" : "0.14.3"
"revision" : "db4603921b31a6ce0f8c26d36d6a3fffc2dba481",
"version" : "0.14.2"
}
},
{
Expand Down

0 comments on commit 1ccd10f

Please sign in to comment.