8000 Apply fixes from CodeFactor by codefactor-io[bot] · Pull Request #3 · cranci1/Sora · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Apply fixes from CodeFactor #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 1, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Sora/ContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ struct ContentView: View {
func fetchLatestRelease(completion: @escaping (GitHubRelease?) -> Void) {
let url = URL(string: "https://api.github.com/repos/cranci1/Sora/releases/latest")!

URLSession.custom.dataTask(with: url) { data, response, error in
URLSession.custom.dataTask(with: url) { data, _, error in
guard let data = data, error == nil else {
completion(nil)
return
Expand Down
4 changes: 2 additions & 2 deletions Sora/Utils/CustomPlayer/Components/MusicProgressSlider.swift
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,13 @@ struct MusicProgressSlider<T: BinaryFloatingPoint>: View {
.frame(width: bounds.size.width, height: bounds.size.height, alignment: .center)
.contentShape(Rectangle())
.gesture(DragGesture(minimumDistance: 0, coordinateSpace: .local)
.updating($isActive) { value, state, transaction in
.updating($isActive) { _, state, _ in
state = true
}
.onChanged { gesture in
localTempProgress = T(gesture.translation.width / bounds.size.width)
value = max(min(getPrgValue(), inRange.upperBound), inRange.lowerBound)
}.onEnded { value in
}.onEnded { _ in
localRealProgress = max(min(localRealProgress + localTempProgress, 1), 0)
localTempProgress = 0
})
Expand Down
2 changes: 1 addition & 1 deletion Sora/Utils/GitHub/GitHubAPI.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class GitHubAPI {
func fetchReleases(completion: @escaping ([GitHubReleases]?) -> Void) {
let url = URL(string: "https://api.github.com/repos/cranci1/Sora/releases")!

URLSession.custom.dataTask(with: url) { data, response, error in
URLSession.custom.dataTask(with: url) { data, _, error in
guard let data = data, error == nil else {
completion(nil)
return
Expand Down
4 changes: 2 additions & 2 deletions Sora/Utils/Modules/ModulesManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class ModulesManager: ObservableObject {
completion(.failure(ModuleError.invalidURL))
return
}
let task = URLSession.custom.dataTask(with: url) { data, response, error in
let task = URLSession.custom.dataTask(with: url) { data, _, error in
guard let data = data, error == nil else {
completion(.failure(error ?? ModuleError.unknown))
return
Expand Down Expand Up @@ -69,7 +69,7 @@ class ModulesManager: ObservableObject {
func refreshModules() {
for (name, urlString) in moduleURLs {
guard let url = URL(string: urlString) else { continue }
let task = URLSession.custom.dataTask(with: url) { data, response, error in
let task = URLSession.custom.dataTask(with: url) { data, _, error in
guard let data = data, error == nil else { return }
do {
let updatedModule = try JSONDecoder().decode(ModuleStruct.self, from: data)
Expand Down
2 changes: 1 addition & 1 deletion Sora/Views/HomeView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ struct HomeView: View {
return
}

URLSession.custom.dataTask(with: url) { data, response, error in
URLSession.custom.dataTask(with: url) { data, _, error in
guard let data = data, error == nil else {
completion([])
return
Expand Down
2 changes: 1 addition & 1 deletion Sora/Views/MediaViews/EpisodesCell/EpisodeCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ struct EpisodeCell: View {
return
}

URLSession.custom.dataTask(with: url) { data, response, error in
URLSession.custom.dataTask(with: url) { data, _, error in
if let error = error {
print("Failed to fetch episode details: \(error)")
DispatchQueue.main.async {
Expand Down
6 changes: 3 additions & 3 deletions Sora/Views/MediaViews/MediaExtraction.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ extension MediaView {
func fetchItemDetails() {
guard let url = URL(string: item.href.hasPrefix("https") ? item.href : "\(module.module[0].details.baseURL.hasSuffix("/") ? module.module[0].details.baseURL : "\(module.module[0].details.baseURL)/")\(item.href.hasPrefix("/") ? String(item.href.dropFirst()) : item.href)") else { return }

URLSession.custom.dataTask(with: url) { data, response, error in
URLSession.custom.dataTask(with: url) { data, _, error in
defer { isLoading = false }
guard let data = data, error == nil else { return }

Expand Down Expand Up @@ -53,7 +53,7 @@ extension MediaView {
guard let url = URL(string: urlString.hasPrefix("https") ? urlString : "\(module.module[0].details.baseURL)\(urlString)") else { return }

Logger.shared.log("Pressed episode button")
URLSession.custom.dataTask(with: url) { data, response, error in
URLSession.custom.dataTask(with: url) { data, _, error in
guard let data = data, error == nil else { return }

let html = String(data: data, encoding: .utf8) ?? ""
Expand All @@ -80,7 +80,7 @@ extension MediaView {
let patternURL = extractPatternURL(from: html)
guard let patternURL = patternURL else { return }

URLSession.custom.dataTask(with: patternURL) { data, response, error in
URLSession.custom.dataTask(with: patternURL) { data, _, error in
guard let data = data, error == nil else { return }

let patternHTML = String(data: data, encoding: .utf8) ?? ""
Expand Down
2 changes: 1 addition & 1 deletion Sora/Views/MediaViews/MediaView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ struct MediaView: View {
let parameters: [String: Any] = ["query": query]
request.httpBody = try? JSONSerialization.data(withJSONObject: parameters)

URLSession.custom.dataTask(with: request) { data, response, error in
URLSession.custom.dataTask(with: request) { data, _, error in
if let error = error {
completion(.failure(error))
return
Expand Down
2 changes: 1 addition & 1 deletion Sora/Views/SearchViews/SearchResultsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ struct SearchResultsView: View {
let urlString = "\(module.module[0].search.url)?\(module.module[0].search.parameter)=\(encodedSearchText)"
guard let url = URL(string: urlString) else { return }

URLSession.custom.dataTask(with: url) { data, response, error in
URLSession.custom.dataTask(with: url) { data, _, error in
defer { isLoading = false }
guard let data = data, error == nil else { return }

Expand Down
0