Ferrite-backup/Ferrite/Views/ComponentViews/Library/DebridCloudView.swift
kingbri eeb9cbdf65 Debrid: Unify cloud views
Cloud torrents and downloads are unified with the new protocol.

Signed-off-by: kingbri <bdashore3@proton.me>
2024-06-19 16:40:26 -05:00

42 lines
1 KiB
Swift

//
// DebridCloudView.swift
// Ferrite
//
// Created by Brian Dashore on 12/31/22.
//
import SwiftUI
struct DebridCloudView: View {
@EnvironmentObject var debridManager: DebridManager
@Store var debridSource: DebridSource
@Binding var searchText: String
var body: some View {
List {
if !debridSource.cloudDownloads.isEmpty {
CloudDownloadView(debridSource: debridSource, searchText: $searchText)
}
if !debridSource.cloudTorrents.isEmpty {
CloudTorrentView(debridSource: debridSource, searchText: $searchText)
}
}
.listStyle(.plain)
.task {
await debridManager.fetchDebridCloud()
}
.refreshable {
await debridManager.fetchDebridCloud(bypassTTL: true)
}
.onChange(of: debridManager.selectedDebridType) { newType in
if newType != nil {
Task {
await debridManager.fetchDebridCloud()
}
}
}
}
}