diff --git a/Ferrite/API/KodiWrapper.swift b/Ferrite/API/KodiWrapper.swift index 74130b3..ba5ccae 100644 --- a/Ferrite/API/KodiWrapper.swift +++ b/Ferrite/API/KodiWrapper.swift @@ -12,10 +12,10 @@ class Kodi { // Used to add server to CoreData. Not part of API func addServer(urlString: String, - friendlyName: String?, - username: String?, - password: String?, - existingServer: KodiServer? = nil) throws + friendlyName: String?, + username: String?, + password: String?, + existingServer: KodiServer? = nil) throws { let backgroundContext = PersistenceController.shared.backgroundContext diff --git a/Ferrite/API/TorBoxWrapper.swift b/Ferrite/API/TorBoxWrapper.swift index 29e72ca..c76409f 100644 --- a/Ferrite/API/TorBoxWrapper.swift +++ b/Ferrite/API/TorBoxWrapper.swift @@ -20,7 +20,7 @@ class TorBox: DebridSource, ObservableObject { @Published var authProcessing: Bool = false var isLoggedIn: Bool { - return getToken() != nil + getToken() != nil } var manualToken: String? { @@ -117,7 +117,7 @@ class TorBox: DebridSource, ObservableObject { let rawResponse = try jsonDecoder.decode(TBResponse.self, from: data) // If the data is a failure, return - guard case .links(let iaObjects) = rawResponse.data else { + guard case let .links(iaObjects) = rawResponse.data else { return } @@ -230,18 +230,14 @@ class TorBox: DebridSource, ObservableObject { // MARK: - Cloud methods // Unused - func getUserDownloads() async throws { - return - } - + func getUserDownloads() async throws {} + func checkUserDownloads(link: String) async throws -> String? { - return nil - } - - func deleteDownload(downloadId: String) async throws { - return + nil } - + + func deleteDownload(downloadId: String) async throws {} + func getUserTorrents() async throws { let torrentList = try await myTorrentList() cloudTorrents = torrentList.map { torrent in diff --git a/Ferrite/Models/ActionModels.swift b/Ferrite/Models/ActionModels.swift index eb73c30..cd32128 100644 --- a/Ferrite/Models/ActionModels.swift +++ b/Ferrite/Models/ActionModels.swift @@ -21,16 +21,16 @@ struct ActionJson: Codable, Hashable, PluginJson { let tags: [PluginTagJson]? init(name: String, - version: Int16, - minVersion: String?, - about: String?, - website: String?, - requires: [ActionRequirement], - deeplink: [DeeplinkActionJson]?, - author: String?, - listId: UUID?, - listName: String?, - tags: [PluginTagJson]?) + version: Int16, + minVersion: String?, + about: String?, + website: String?, + requires: [ActionRequirement], + deeplink: [DeeplinkActionJson]?, + author: String?, + listId: UUID?, + listName: String?, + tags: [PluginTagJson]?) { self.name = name self.version = version diff --git a/Ferrite/Models/AllDebridModels.swift b/Ferrite/Models/AllDebridModels.swift index ff28617..3faeeb8 100644 --- a/Ferrite/Models/AllDebridModels.swift +++ b/Ferrite/Models/AllDebridModels.swift @@ -53,7 +53,7 @@ extension AllDebrid { // MARK: - AddMagnetData - internal struct AddMagnetData: Codable { + struct AddMagnetData: Codable { let magnet, hash, name, filenameOriginal: String let size: Int let ready: Bool @@ -103,7 +103,7 @@ extension AllDebrid { // MARK: - MagnetStatusLink // Abridged for required parameters - internal struct MagnetStatusLink: Codable { + struct MagnetStatusLink: Codable { let link: String let filename: String let size: Int @@ -137,7 +137,7 @@ extension AllDebrid { // MARK: - IAMagnetResponse - internal struct InstantAvailabilityMagnet: Codable { + struct InstantAvailabilityMagnet: Codable { let magnet, hash: String let instant: Bool let files: [InstantAvailabilityFile]? @@ -145,7 +145,7 @@ extension AllDebrid { // MARK: - IAFileResponse - internal struct InstantAvailabilityFile: Codable { + struct InstantAvailabilityFile: Codable { let name: String enum CodingKeys: String, CodingKey { diff --git a/Ferrite/Models/RealDebridModels.swift b/Ferrite/Models/RealDebridModels.swift index 1374058..fd25dca 100644 --- a/Ferrite/Models/RealDebridModels.swift +++ b/Ferrite/Models/RealDebridModels.swift @@ -67,11 +67,11 @@ extension RealDebrid { } } - internal struct InstantAvailabilityData: Codable, Sendable { + struct InstantAvailabilityData: Codable, Sendable { var rd: [[String: InstantAvailabilityInfo]] } - internal struct InstantAvailabilityInfo: Codable, Sendable { + struct InstantAvailabilityInfo: Codable, Sendable { var filename: String var filesize: Int } @@ -96,7 +96,7 @@ extension RealDebrid { // MARK: - torrentInfo endpoint - internal struct TorrentInfoResponse: Codable, Sendable { + struct TorrentInfoResponse: Codable, Sendable { let id, filename, originalFilename, hash: String let bytes, originalBytes: Int let host: String @@ -117,7 +117,7 @@ extension RealDebrid { } } - internal struct TorrentInfoFile: Codable, Sendable { + struct TorrentInfoFile: Codable, Sendable { let id: Int let path: String let bytes, selected: Int @@ -136,7 +136,7 @@ extension RealDebrid { // MARK: - unrestrictLink endpoint - internal struct UnrestrictLinkResponse: Codable, Sendable { + struct UnrestrictLinkResponse: Codable, Sendable { let id, filename: String let mimeType: String? let filesize: Int diff --git a/Ferrite/Models/TorBoxModels.swift b/Ferrite/Models/TorBoxModels.swift index b3c5196..be9845f 100644 --- a/Ferrite/Models/TorBoxModels.swift +++ b/Ferrite/Models/TorBoxModels.swift @@ -15,6 +15,7 @@ extension TorBox { } // MARK: - InstantAvailability + enum InstantAvailabilityData: Codable { case links([InstantAvailabilityDataObject]) case failure(InstantAvailabilityDataFailure) @@ -34,9 +35,9 @@ extension TorBox { func encode(to encoder: Encoder) throws { var container = encoder.singleValueContainer() switch self { - case .links(let array): + case let .links(array): try container.encode(array) - case .failure(let value): + case let .failure(value): try container.encode(value) } } diff --git a/Ferrite/Utils/Store.swift b/Ferrite/Utils/Store.swift index 395e45b..773d39c 100644 --- a/Ferrite/Utils/Store.swift +++ b/Ferrite/Utils/Store.swift @@ -91,8 +91,8 @@ struct Store { /// /// Use this init to schedule updates on a specific scheduler other than `DispatchQueue.main`. init(wrappedValue: ObjectType, - on scheduler: S, - schedulerOptions: S.SchedulerOptions? = nil) + on scheduler: S, + schedulerOptions: S.SchedulerOptions? = nil) { self.wrappedValue = wrappedValue diff --git a/Ferrite/ViewModels/DebridManager.swift b/Ferrite/ViewModels/DebridManager.swift index 962a721..01cd4b1 100644 --- a/Ferrite/ViewModels/DebridManager.swift +++ b/Ferrite/ViewModels/DebridManager.swift @@ -369,8 +369,6 @@ class DebridManager: ObservableObject { await sendDebridError(error, prefix: "\(debridSource.id) download error", cancelString: "Download cancelled") } } - - return } func unrestrictDownload() async { diff --git a/Ferrite/ViewModels/LoggingManager.swift b/Ferrite/ViewModels/LoggingManager.swift index 9abf814..c790fb6 100644 --- a/Ferrite/ViewModels/LoggingManager.swift +++ b/Ferrite/ViewModels/LoggingManager.swift @@ -71,7 +71,7 @@ class LoggingManager: ObservableObject { // TODO: Maybe append to a constant logfile? func info(_ message: String, - description: String? = nil) + description: String? = nil) { let log = Log( level: .info, @@ -89,7 +89,7 @@ class LoggingManager: ObservableObject { } func warn(_ message: String, - description: String? = nil) + description: String? = nil) { let log = Log( level: .warn, @@ -107,8 +107,8 @@ class LoggingManager: ObservableObject { } func error(_ message: String, - description: String? = nil, - showToast: Bool = true) + description: String? = nil, + showToast: Bool = true) { let log = Log( level: .error, diff --git a/Ferrite/ViewModels/ScrapingViewModel.swift b/Ferrite/ViewModels/ScrapingViewModel.swift index 964fcc8..cc844fb 100644 --- a/Ferrite/ViewModels/ScrapingViewModel.swift +++ b/Ferrite/ViewModels/ScrapingViewModel.swift @@ -313,11 +313,11 @@ class ScrapingViewModel: ObservableObject { } private func handleApiCredential(_ credential: SourceApiCredential, - replacement: String, - searchUrl: String, - apiUrl: String?, - website: String, - sourceName: String) async -> String? + replacement: String, + searchUrl: String, + apiUrl: String?, + website: String, + sourceName: String) async -> String? { // Is the credential expired var isExpired = false @@ -354,8 +354,8 @@ class ScrapingViewModel: ObservableObject { } private func fetchApiCredential(urlString: String, - credential: SourceApiCredential, - sourceName: String) async -> String? + credential: SourceApiCredential, + sourceName: String) async -> String? { guard let url = URL(string: urlString) else { await sendSourceError("\(sourceName): Token URL \(urlString) is invalid.") @@ -522,9 +522,9 @@ class ScrapingViewModel: ObservableObject { // TODO: Add regex parsing for API private func parseJsonResult(_ result: JSON, - jsonParser: SourceJsonParser, - source: Source, - existingSearchResult: SearchResult? = nil) -> SearchResult? + jsonParser: SourceJsonParser, + source: Source, + existingSearchResult: SearchResult? = nil) -> SearchResult? { // Enforce these parsers guard let titleParser = jsonParser.title else { @@ -751,10 +751,10 @@ class ScrapingViewModel: ObservableObject { // Complex query parsing for RSS scraping private func runRssComplexQuery(item: Element, - query: String, - attribute: String, - discriminator: String?, - regexString: String?) throws -> String? + query: String, + attribute: String, + discriminator: String?, + regexString: String?) throws -> String? { var parsedValue: String? @@ -956,9 +956,9 @@ class ScrapingViewModel: ObservableObject { // Complex query parsing for HTML scraping private func runHtmlComplexQuery(row: Element, - query: String, - attribute: String, - regexString: String?) throws -> String? + query: String, + attribute: String, + regexString: String?) throws -> String? { var parsedValue: String?