Add Feed Folder Picker
Fixes #2193: • Containers with indentation are supported • Small icon provider is used • AssetCatalog updated with SF Symbol images for desktop, iPad, iPhone. • Title page doesn’t work at the current time.
This commit is contained in:
parent
4081aa0168
commit
ad4aaf9a19
|
@ -134,6 +134,11 @@ class AddWebFeedModel: ObservableObject {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func smallIconImage(for container: Container) -> RSImage? {
|
||||||
|
if let smallIconProvider = container as? SmallIconProvider {
|
||||||
|
return smallIconProvider.smallIcon?.image
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,7 +56,7 @@ struct AddWebFeedView: View {
|
||||||
Text("Add a Web Feed")
|
Text("Add a Web Feed")
|
||||||
.font(.title)
|
.font(.title)
|
||||||
Spacer()
|
Spacer()
|
||||||
}
|
}.padding()
|
||||||
|
|
||||||
LazyVGrid(columns: [GridItem(.fixed(75), spacing: 10, alignment: .trailing),GridItem(.fixed(400), spacing: 0, alignment: .leading) ], alignment: .leading, spacing: 10, pinnedViews: [], content:{
|
LazyVGrid(columns: [GridItem(.fixed(75), spacing: 10, alignment: .trailing),GridItem(.fixed(400), spacing: 0, alignment: .leading) ], alignment: .leading, spacing: 10, pinnedViews: [], content:{
|
||||||
|
|
||||||
|
@ -82,7 +82,7 @@ struct AddWebFeedView: View {
|
||||||
#if os(iOS)
|
#if os(iOS)
|
||||||
@ViewBuilder var iosForm: some View {
|
@ViewBuilder var iosForm: some View {
|
||||||
NavigationView {
|
NavigationView {
|
||||||
Form {
|
List {
|
||||||
urlTextField
|
urlTextField
|
||||||
providedNameTextField
|
providedNameTextField
|
||||||
folderPicker
|
folderPicker
|
||||||
|
@ -111,10 +111,8 @@ struct AddWebFeedView: View {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
var urlTextField: some View {
|
@ViewBuilder var urlTextField: some View {
|
||||||
HStack {
|
|
||||||
#if os(iOS)
|
#if os(iOS)
|
||||||
Text("Feed:")
|
|
||||||
TextField("URL", text: $viewModel.providedURL)
|
TextField("URL", text: $viewModel.providedURL)
|
||||||
.disableAutocorrection(true)
|
.disableAutocorrection(true)
|
||||||
.autocapitalization(UITextAutocapitalizationType.none)
|
.autocapitalization(UITextAutocapitalizationType.none)
|
||||||
|
@ -123,28 +121,32 @@ struct AddWebFeedView: View {
|
||||||
.disableAutocorrection(true)
|
.disableAutocorrection(true)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
var providedNameTextField: some View {
|
var providedNameTextField: some View {
|
||||||
HStack(alignment: .lastTextBaseline) {
|
|
||||||
#if os(iOS)
|
|
||||||
Text("Name:")
|
|
||||||
#endif
|
|
||||||
TextField("Optional", text: $viewModel.providedName)
|
TextField("Optional", text: $viewModel.providedName)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@ViewBuilder var folderPicker: some View {
|
@ViewBuilder var folderPicker: some View {
|
||||||
#if os(iOS)
|
#if os(iOS)
|
||||||
Picker("Folder:", selection: $viewModel.selectedFolderIndex, content: {
|
Picker("Folder", selection: $viewModel.selectedFolderIndex, content: {
|
||||||
ForEach(0..<viewModel.containers.count, id: \.self, content: { index in
|
ForEach(0..<viewModel.containers.count, id: \.self, content: { index in
|
||||||
if let containerName = (viewModel.containers[index] as? DisplayNameProvider)?.nameForDisplay {
|
if let containerName = (viewModel.containers[index] as? DisplayNameProvider)?.nameForDisplay {
|
||||||
if viewModel.containers[index] is Folder {
|
if viewModel.containers[index] is Folder {
|
||||||
Text("\(viewModel.containers[index].account?.nameForDisplay ?? "") / \(containerName)").tag(index)
|
HStack(alignment: .top) {
|
||||||
|
if let image = viewModel.smallIconImage(for: viewModel.containers[index]) {
|
||||||
|
Image(rsImage: image)
|
||||||
|
}
|
||||||
|
Text("\(containerName)").tag(index)
|
||||||
|
}.padding(.leading, 16)
|
||||||
} else {
|
} else {
|
||||||
|
HStack(alignment: .top) {
|
||||||
|
if let image = viewModel.smallIconImage(for: viewModel.containers[index]) {
|
||||||
|
Image(rsImage: image)
|
||||||
|
}
|
||||||
Text(containerName).tag(index)
|
Text(containerName).tag(index)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
#else
|
#else
|
||||||
|
@ -152,7 +154,12 @@ struct AddWebFeedView: View {
|
||||||
ForEach(0..<viewModel.containers.count, id: \.self, content: { index in
|
ForEach(0..<viewModel.containers.count, id: \.self, content: { index in
|
||||||
if let containerName = (viewModel.containers[index] as? DisplayNameProvider)?.nameForDisplay {
|
if let containerName = (viewModel.containers[index] as? DisplayNameProvider)?.nameForDisplay {
|
||||||
if viewModel.containers[index] is Folder {
|
if viewModel.containers[index] is Folder {
|
||||||
Text("\(viewModel.containers[index].account?.nameForDisplay ?? "") / \(containerName)").padding(.leading, 2).tag(index)
|
HStack {
|
||||||
|
if let image = viewModel.smallIconImage(for: viewModel.containers[index]) {
|
||||||
|
Image(rsImage: image)
|
||||||
|
}
|
||||||
|
Text("\(containerName)")
|
||||||
|
}.padding(.leading, 2).tag(index)
|
||||||
} else {
|
} else {
|
||||||
Text(containerName).padding(.leading, 2).tag(index)
|
Text(containerName).padding(.leading, 2).tag(index)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"images" : [
|
"images" : [
|
||||||
{
|
{
|
||||||
"filename" : "localAccountMac.pdf",
|
"filename" : "mac.pdf",
|
||||||
"idiom" : "universal"
|
"idiom" : "universal"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"images" : [
|
"images" : [
|
||||||
{
|
{
|
||||||
"filename" : "localAccountPad.pdf",
|
"filename" : "ipad.pdf",
|
||||||
"idiom" : "universal"
|
"idiom" : "universal"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"images" : [
|
"images" : [
|
||||||
{
|
{
|
||||||
"filename" : "localAccountPhone.pdf",
|
"filename" : "phone.pdf",
|
||||||
"idiom" : "universal"
|
"idiom" : "universal"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue