Ferrite-backup/Ferrite/Views/ComponentViews/Library/DebridCloudView.swift
kingbri 375de6f46e Debrid: Various updates to API and settings
Debrid services can change their APIs at any time which negatively
impacts user experiences on Ferrite.

Add the following:
- Ability for a user to add a manually generated API key only showing the
last 4 characters for security purposes.
- Make ephemeral auth sessions toggle-able. ASWebAuthenticationView does
not automatically clear on toggle change.
- Add the savedLinks endpoint for AllDebrid so users can access their
downloads and magnets.
- Add a links section to AD's cloud view.

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

43 lines
1.1 KiB
Swift

//
// DebridCloudView.swift
// Ferrite
//
// Created by Brian Dashore on 12/31/22.
//
import SwiftUI
struct DebridCloudView: View {
@EnvironmentObject var debridManager: DebridManager
@Binding var searchText: String
var body: some View {
List {
switch debridManager.selectedDebridType {
case .realDebrid:
RealDebridCloudView(searchText: $searchText)
case .premiumize:
PremiumizeCloudView(searchText: $searchText)
case .allDebrid:
AllDebridCloudView(searchText: $searchText)
case .none:
EmptyView()
}
}
.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()
}
}
}
}
}