When a search result is selected, there is usually a delay due to the debrid dance of API routes for grabbing a download link to stream. Add a loading indicator and prevent any other tasks from loading unless the user cancels it. iOS 14.5 was a huge update which added many QoL SwiftUI changes that are consistent to modern iOS versions. However, Ferrite supports iOS versions less than 14.5, mainly 14.3. More fixes had to be added to make sure UI is consistent across all OS versions. Signed-off-by: kingbri <bdashore3@gmail.com>
37 lines
882 B
Swift
37 lines
882 B
Swift
//
|
|
// SourceCatalogButtonView.swift
|
|
// Ferrite
|
|
//
|
|
// Created by Brian Dashore on 8/5/22.
|
|
//
|
|
|
|
import SwiftUI
|
|
|
|
struct SourceCatalogButtonView: View {
|
|
@EnvironmentObject var sourceManager: SourceManager
|
|
|
|
let availableSource: SourceJson
|
|
|
|
var body: some View {
|
|
HStack {
|
|
VStack(alignment: .leading, spacing: 5) {
|
|
HStack {
|
|
Text(availableSource.name)
|
|
Text("v\(availableSource.version)")
|
|
.foregroundColor(.secondary)
|
|
}
|
|
|
|
Text("by \(availableSource.author ?? "Unknown")")
|
|
.foregroundColor(.secondary)
|
|
}
|
|
|
|
Spacer()
|
|
|
|
Button("Install") {
|
|
Task {
|
|
await sourceManager.installSource(sourceJson: availableSource)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|