mirror of
https://github.com/yattee/yattee.git
synced 2025-08-09 20:24:06 +00:00
Add Piped support
This commit is contained in:
@@ -115,7 +115,7 @@ struct AccountFormView: View {
|
||||
isValidating = true
|
||||
|
||||
validationDebounce.debouncing(1) {
|
||||
validator.validateAccount()
|
||||
validator.validateInvidiousAccount()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -132,6 +132,7 @@ struct AccountFormView: View {
|
||||
|
||||
private var validator: AccountValidator {
|
||||
AccountValidator(
|
||||
app: .constant(instance.app),
|
||||
url: instance.url,
|
||||
account: Instance.Account(instanceID: instance.id, url: instance.url, sid: sid),
|
||||
id: $sid,
|
||||
|
@@ -13,6 +13,18 @@ struct AccountsSettingsView: View {
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
Group {
|
||||
if instance.supportsAccounts {
|
||||
accounts
|
||||
} else {
|
||||
Text("Accounts are not supported for the application of this instance")
|
||||
.foregroundColor(.secondary)
|
||||
}
|
||||
}
|
||||
.navigationTitle(instance.shortDescription)
|
||||
}
|
||||
|
||||
var accounts: some View {
|
||||
List {
|
||||
Section(header: Text("Accounts"), footer: sectionFooter) {
|
||||
ForEach(instances.accounts(instanceID), id: \.self) { account in
|
||||
@@ -59,7 +71,6 @@ struct AccountsSettingsView: View {
|
||||
}
|
||||
}
|
||||
}
|
||||
.navigationTitle(instance.shortDescription)
|
||||
.sheet(isPresented: $presentingAccountForm, onDismiss: { accountsChanged.toggle() }) {
|
||||
AccountFormView(instance: instance)
|
||||
}
|
||||
|
@@ -5,6 +5,7 @@ struct InstanceFormView: View {
|
||||
|
||||
@State private var name = ""
|
||||
@State private var url = ""
|
||||
@State private var app = Instance.App.invidious
|
||||
|
||||
@State private var isValid = false
|
||||
@State private var isValidated = false
|
||||
@@ -37,7 +38,7 @@ struct InstanceFormView: View {
|
||||
.frame(minWidth: 0, maxWidth: .infinity, minHeight: 0, maxHeight: .infinity)
|
||||
.background(.thickMaterial)
|
||||
#else
|
||||
.frame(width: 400, height: 150)
|
||||
.frame(width: 400, height: 190)
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -73,6 +74,13 @@ struct InstanceFormView: View {
|
||||
|
||||
private var formFields: some View {
|
||||
Group {
|
||||
Picker("Application", selection: $app) {
|
||||
ForEach(Instance.App.allCases, id: \.self) { app in
|
||||
Text(app.rawValue.capitalized).tag(app)
|
||||
}
|
||||
}
|
||||
.pickerStyle(.segmented)
|
||||
|
||||
TextField("Name", text: $name, prompt: Text("Instance Name (optional)"))
|
||||
.focused($nameFieldFocused)
|
||||
|
||||
@@ -104,6 +112,7 @@ struct InstanceFormView: View {
|
||||
|
||||
var validator: AccountValidator {
|
||||
AccountValidator(
|
||||
app: $app,
|
||||
url: url,
|
||||
id: $url,
|
||||
isValid: $isValid,
|
||||
@@ -137,7 +146,7 @@ struct InstanceFormView: View {
|
||||
return
|
||||
}
|
||||
|
||||
savedInstanceID = instancesModel.add(name: name, url: url).id
|
||||
savedInstanceID = instancesModel.add(app: app, name: name, url: url).id
|
||||
|
||||
dismiss()
|
||||
}
|
||||
|
@@ -19,8 +19,10 @@ struct InstancesSettingsView: View {
|
||||
Group {
|
||||
Section(header: Text("Instances"), footer: DefaultAccountHint()) {
|
||||
ForEach(instances) { instance in
|
||||
NavigationLink(instance.description) {
|
||||
AccountsSettingsView(instanceID: instance.id)
|
||||
Group {
|
||||
NavigationLink(instance.longDescription) {
|
||||
AccountsSettingsView(instanceID: instance.id)
|
||||
}
|
||||
}
|
||||
#if os(iOS)
|
||||
.swipeActions(edge: .trailing, allowsFullSwipe: false) {
|
||||
|
Reference in New Issue
Block a user