Ferrite-backup/Ferrite/Views/ComponentViews/Plugin/Source/SourceSettingsBaseUrlView.swift
kingbri d918039810 Plugins: Add website and about properties
These will serve as descriptions for a plugin which will be displayed
in the Plugin Info screen.

website has also replaced baseUrl and dynamicWebsite has replaced
dynamicBaseUrl

Signed-off-by: kingbri <bdashore3@proton.me>
2023-04-02 14:53:22 -04:00

36 lines
1,022 B
Swift

//
// SourceSettingsBaseUrlView.swift
// Ferrite
//
// Created by Brian Dashore on 3/24/23.
//
import SwiftUI
struct SourceSettingsBaseUrlView: View {
@ObservedObject var selectedSource: Source
@State private var tempSite: String = ""
var body: some View {
Section(
header: InlineHeader("Base URL"),
footer: Text("Enter the base URL of your server.")
) {
TextField("https://...", text: $tempSite, onEditingChanged: { isFocused in
if !isFocused {
if tempSite.last == "/" {
selectedSource.website = String(tempSite.dropLast())
} else {
selectedSource.website = tempSite
}
}
})
.keyboardType(.URL)
.autocorrectionDisabled(true)
.autocapitalization(.none)
.onAppear {
tempSite = selectedSource.website ?? ""
}
}
}
}