From f9ecc746a1004a3ba5902be473a883e29f44251d Mon Sep 17 00:00:00 2001 From: kingbri Date: Mon, 3 Jun 2024 16:25:32 -0400 Subject: [PATCH] Tree: Format Signed-off-by: kingbri --- Ferrite/API/AllDebridWrapper.swift | 2 +- Ferrite/API/PremiumizeWrapper.swift | 8 ++--- Ferrite/API/RealDebridWrapper.swift | 4 +-- Ferrite/ViewModels/DebridManager.swift | 30 +++++++++---------- .../Library/Cloud/RealDebridCloudView.swift | 2 +- 5 files changed, 22 insertions(+), 24 deletions(-) diff --git a/Ferrite/API/AllDebridWrapper.swift b/Ferrite/API/AllDebridWrapper.swift index c32f4e8..eb0cbb7 100644 --- a/Ferrite/API/AllDebridWrapper.swift +++ b/Ferrite/API/AllDebridWrapper.swift @@ -279,7 +279,7 @@ public class AllDebrid: PollingDebridSource { fileName: magnetResponse.filename, status: magnetResponse.status, hash: magnetResponse.hash, - links: magnetResponse.links.map { $0.link } + links: magnetResponse.links.map(\.link) ) } diff --git a/Ferrite/API/PremiumizeWrapper.swift b/Ferrite/API/PremiumizeWrapper.swift index c7d8bbe..7d2b6fb 100644 --- a/Ferrite/API/PremiumizeWrapper.swift +++ b/Ferrite/API/PremiumizeWrapper.swift @@ -190,7 +190,7 @@ public class Premiumize: OAuthDebridSource { return DebridIA( magnet: magnet, - source: self.id, + source: id, expiryTimeStamp: Date().timeIntervalSince1970 + 300, files: files ) @@ -331,10 +331,8 @@ public class Premiumize: OAuthDebridSource { // No user torrents for Premiumize public func getUserTorrents() async throws -> [DebridCloudTorrent] { - return [] + [] } - public func deleteTorrent(torrentId: String) async throws { - return - } + public func deleteTorrent(torrentId: String) async throws {} } diff --git a/Ferrite/API/RealDebridWrapper.swift b/Ferrite/API/RealDebridWrapper.swift index 7d9257b..379df7b 100644 --- a/Ferrite/API/RealDebridWrapper.swift +++ b/Ferrite/API/RealDebridWrapper.swift @@ -272,7 +272,7 @@ public class RealDebrid: PollingDebridSource { availableHashes.append( DebridIA( magnet: Magnet(hash: hash, link: nil), - source: self.id, + source: id, expiryTimeStamp: Date().timeIntervalSince1970 + 300, files: files ) @@ -281,7 +281,7 @@ public class RealDebrid: PollingDebridSource { availableHashes.append( DebridIA( magnet: Magnet(hash: hash, link: nil), - source: self.id, + source: id, expiryTimeStamp: Date().timeIntervalSince1970 + 300, files: [] ) diff --git a/Ferrite/ViewModels/DebridManager.swift b/Ferrite/ViewModels/DebridManager.swift index 57b1feb..4cb85bd 100644 --- a/Ferrite/ViewModels/DebridManager.swift +++ b/Ferrite/ViewModels/DebridManager.swift @@ -572,26 +572,26 @@ public class DebridManager: ObservableObject { func fetchRdDownload(magnet: Magnet?, existingLink: String?) async { // If an existing link is passed in args, set it to that. Otherwise, find one from RD cloud. /* - let torrentLink: String? - if let existingLink { - torrentLink = existingLink - } else { - // Bypass the TTL for up to date information - await fetchRdCloud(bypassTTL: true) + let torrentLink: String? + if let existingLink { + torrentLink = existingLink + } else { + // Bypass the TTL for up to date information + await fetchRdCloud(bypassTTL: true) - let existingTorrent = realDebridCloudTorrents.first { $0.hash == selectedRealDebridItem?.magnet.hash && $0.status == "downloaded" } - torrentLink = existingTorrent?.links[safe: selectedRealDebridFile?.batchFileIndex ?? 0] - } - */ + let existingTorrent = realDebridCloudTorrents.first { $0.hash == selectedRealDebridItem?.magnet.hash && $0.status == "downloaded" } + torrentLink = existingTorrent?.links[safe: selectedRealDebridFile?.batchFileIndex ?? 0] + } + */ do { // If the links match from a user's downloads, no need to re-run a download /* - if let torrentLink, - let downloadLink = await checkRdUserDownloads(userTorrentLink: torrentLink) - { - downloadUrl = downloadLink - } else */ + if let torrentLink, + let downloadLink = await checkRdUserDownloads(userTorrentLink: torrentLink) + { + downloadUrl = downloadLink + } else */ if let magnet { let downloadLink = try await realDebrid.getDownloadLink( magnet: magnet, ia: selectedRealDebridItem, iaFile: selectedRealDebridFile diff --git a/Ferrite/Views/ComponentViews/Library/Cloud/RealDebridCloudView.swift b/Ferrite/Views/ComponentViews/Library/Cloud/RealDebridCloudView.swift index 0cc39cf..f1a2224 100644 --- a/Ferrite/Views/ComponentViews/Library/Cloud/RealDebridCloudView.swift +++ b/Ferrite/Views/ComponentViews/Library/Cloud/RealDebridCloudView.swift @@ -18,7 +18,7 @@ struct RealDebridCloudView: View { Group { DisclosureGroup("Downloads") { ForEach(debridManager.realDebridCloudDownloads.filter { - searchText.isEmpty ? true : $0.fileName .lowercased().contains(searchText.lowercased()) + searchText.isEmpty ? true : $0.fileName.lowercased().contains(searchText.lowercased()) }, id: \.self) { cloudDownload in Button(cloudDownload.fileName) { navModel.resultFromCloud = true