Ferrite-backup/Ferrite/Views/SourceViews/SourceUpdateButtonView.swift
2022-09-04 18:00:53 -05:00

38 lines
920 B
Swift

//
// SourceUpdateButtonView.swift
// Ferrite
//
// Created by Brian Dashore on 8/5/22.
//
import SwiftUI
struct SourceUpdateButtonView: View {
@EnvironmentObject var sourceManager: SourceManager
let updatedSource: SourceJson
var body: some View {
HStack {
VStack(alignment: .leading, spacing: 5) {
HStack {
Text(updatedSource.name)
Text("v\(updatedSource.version)")
.foregroundColor(.secondary)
}
Text("by \(updatedSource.author ?? "Unknown")")
.foregroundColor(.secondary)
}
.padding(.vertical, 2)
Spacer()
Button("Update") {
Task {
await sourceManager.installSource(sourceJson: updatedSource, doUpsert: true)
}
}
}
}
}