Make all tasks run in parallel to increase responsiveness and efficiency when fetching new data. However, parallel tasks means that toast errors are no longer feasible. Instead, add a logging system which has a more detailed view of app messages and direct the user there if there is an error. Signed-off-by: kingbri <bdashore3@proton.me>
61 lines
2 KiB
Swift
61 lines
2 KiB
Swift
//
|
|
// SettingsKodiView.swift
|
|
// Ferrite
|
|
//
|
|
// Created by Brian Dashore on 3/4/23.
|
|
//
|
|
|
|
import SwiftUI
|
|
|
|
struct SettingsKodiView: View {
|
|
@AppStorage("ExternalServices.KodiUrl") var kodiUrl: String = ""
|
|
@AppStorage("ExternalServices.KodiUsername") var kodiUsername: String = ""
|
|
@AppStorage("ExternalServices.KodiPassword") var kodiPassword: String = ""
|
|
|
|
@State private var showPassword = false
|
|
|
|
var body: some View {
|
|
NavView {
|
|
List {
|
|
Section(header: InlineHeader("Description")) {
|
|
VStack(alignment: .leading, spacing: 10) {
|
|
Text("Kodi is an external application that is used to manage a local media library and playback.")
|
|
|
|
Link("Website", destination: URL(string: "https://kodi.tv")!)
|
|
}
|
|
}
|
|
|
|
Section(
|
|
header: InlineHeader("Base URL"),
|
|
footer: Text("Enter your Kodi server's http URL here including the port.")
|
|
) {
|
|
TextField("http://...", text: $kodiUrl, onEditingChanged: { isFocused in
|
|
if !isFocused, kodiUrl.last == "/" {
|
|
kodiUrl = String(kodiUrl.dropLast())
|
|
}
|
|
})
|
|
.keyboardType(.URL)
|
|
.autocorrectionDisabled(true)
|
|
.autocapitalization(.none)
|
|
}
|
|
|
|
Section(
|
|
header: InlineHeader("Credentials"),
|
|
footer: Text("Enter your kodi username and password here (if applicable)")
|
|
) {
|
|
TextField("Username", text: $kodiUsername)
|
|
|
|
HybridSecureField(text: $kodiPassword)
|
|
}
|
|
}
|
|
.navigationTitle("Kodi")
|
|
.navigationBarTitleDisplayMode(.inline)
|
|
}
|
|
}
|
|
}
|
|
|
|
struct SettingsKodiView_Previews: PreviewProvider {
|
|
static var previews: some View {
|
|
SettingsKodiView()
|
|
}
|
|
}
|