Different services can send different statuses for if a file is cached or not. Therefore, make this scoped to the debrid service rather than expecting everything to state "downloaded". Also it feels pretty blank if the disclosure groups are gone when a cloud array is empty, so remove those checks. Signed-off-by: kingbri <bdashore3@proton.me>
37 lines
931 B
Swift
37 lines
931 B
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 {
|
|
CloudDownloadView(debridSource: debridSource, searchText: $searchText)
|
|
CloudMagnetView(debridSource: debridSource, searchText: $searchText)
|
|
}
|
|
.listStyle(.plain)
|
|
.task {
|
|
await debridManager.fetchDebridCloud()
|
|
}
|
|
.refreshable {
|
|
await debridManager.fetchDebridCloud(bypassTTL: true)
|
|
}
|
|
.onChange(of: debridManager.selectedDebridSource?.id) { newType in
|
|
if newType != nil {
|
|
Task {
|
|
await debridManager.fetchDebridCloud()
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|