Merge pull request #3 from cranci1/main-cf-autofix
Some checks are pending
Build and Release IPA / Build IPA and Mac Catalyst (push) Waiting to run

Apply fixes from CodeFactor
This commit is contained in:
cranci 2025-01-01 12:33:50 +01:00 committed by GitHub
commit 0f8852dc98
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 13 additions and 13 deletions

View file

@ -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

View file

@ -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
})

View file

@ -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

View file

@ -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
@ -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)

View file

@ -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

View file

@ -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 {

View file

@ -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 }
@ -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) ?? ""
@ -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) ?? ""

View file

@ -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

View file

@ -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 }