Skip to content

Commit

Permalink
Tree: Format
Browse files Browse the repository at this point in the history
Signed-off-by: kingbri <[email protected]>
  • Loading branch information
bdashore3 committed Jun 13, 2024
1 parent 05e830f commit be14544
Show file tree
Hide file tree
Showing 10 changed files with 57 additions and 62 deletions.
8 changes: 4 additions & 4 deletions Ferrite/API/KodiWrapper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
20 changes: 8 additions & 12 deletions Ferrite/API/TorBoxWrapper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class TorBox: DebridSource, ObservableObject {

@Published var authProcessing: Bool = false
var isLoggedIn: Bool {
return getToken() != nil
getToken() != nil
}

var manualToken: String? {
Expand Down Expand Up @@ -117,7 +117,7 @@ class TorBox: DebridSource, ObservableObject {
let rawResponse = try jsonDecoder.decode(TBResponse<InstantAvailabilityData>.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
}

Expand Down Expand Up @@ -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
Expand Down
20 changes: 10 additions & 10 deletions Ferrite/Models/ActionModels.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions Ferrite/Models/AllDebridModels.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -137,15 +137,15 @@ extension AllDebrid {

// MARK: - IAMagnetResponse

internal struct InstantAvailabilityMagnet: Codable {
struct InstantAvailabilityMagnet: Codable {
let magnet, hash: String
let instant: Bool
let files: [InstantAvailabilityFile]?
}

// MARK: - IAFileResponse

internal struct InstantAvailabilityFile: Codable {
struct InstantAvailabilityFile: Codable {
let name: String

enum CodingKeys: String, CodingKey {
Expand Down
10 changes: 5 additions & 5 deletions Ferrite/Models/RealDebridModels.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
5 changes: 3 additions & 2 deletions Ferrite/Models/TorBoxModels.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ extension TorBox {
}

// MARK: - InstantAvailability

enum InstantAvailabilityData: Codable {
case links([InstantAvailabilityDataObject])
case failure(InstantAvailabilityDataFailure)
Expand All @@ -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)
}
}
Expand Down
4 changes: 2 additions & 2 deletions Ferrite/Utils/Store.swift
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ struct Store<ObjectType> {
///
/// Use this init to schedule updates on a specific scheduler other than `DispatchQueue.main`.
init<S: Scheduler>(wrappedValue: ObjectType,
on scheduler: S,
schedulerOptions: S.SchedulerOptions? = nil)
on scheduler: S,
schedulerOptions: S.SchedulerOptions? = nil)
{
self.wrappedValue = wrappedValue

Expand Down
2 changes: 0 additions & 2 deletions Ferrite/ViewModels/DebridManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -369,8 +369,6 @@ class DebridManager: ObservableObject {
await sendDebridError(error, prefix: "\(debridSource.id) download error", cancelString: "Download cancelled")
}
}

return
}

func unrestrictDownload() async {
Expand Down
8 changes: 4 additions & 4 deletions Ferrite/ViewModels/LoggingManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -89,7 +89,7 @@ class LoggingManager: ObservableObject {
}

func warn(_ message: String,
description: String? = nil)
description: String? = nil)
{
let log = Log(
level: .warn,
Expand All @@ -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,
Expand Down
34 changes: 17 additions & 17 deletions Ferrite/ViewModels/ScrapingViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.")
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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?

Expand Down Expand Up @@ -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?

Expand Down

0 comments on commit be14544

Please sign in to comment.