DebridManager: Fix magnet links not loading

I mistakenly added an and condition which caused all debrid services
to fail unless the user is using Premiumize.

Signed-off-by: kingbri <bdashore3@proton.me>
This commit is contained in:
kingbri 2022-12-06 10:35:18 -05:00
parent 17867db40c
commit 32e5e21d3c

View file

@ -438,18 +438,20 @@ public class DebridManager: ObservableObject {
showLoadingProgress = true
// Premiumize doesn't need a magnet link
guard let magnetLink = searchResult.magnetLink, selectedDebridType == .premiumize else {
guard searchResult.magnetLink != nil || selectedDebridType == .premiumize else {
toastModel?.updateToastDescription("Could not run your action because the magnet link is invalid.")
print("Debrid error: Invalid magnet link")
return
}
// Force unwrap is OK for debrid types that aren't ignored since the magnet link was already checked
// Do not force unwrap for Premiumize!
switch selectedDebridType {
case .realDebrid:
await fetchRdDownload(magnetLink: magnetLink)
await fetchRdDownload(magnetLink: searchResult.magnetLink!)
case .allDebrid:
await fetchAdDownload(magnetLink: magnetLink)
await fetchAdDownload(magnetLink: searchResult.magnetLink!)
case .premiumize:
fetchPmDownload()
case .none: