This commit is contained in:
Stuart Breckenridge 2020-07-09 17:36:17 +08:00
parent f4deab1361
commit 771fe21422
No known key found for this signature in database
GPG Key ID: 79BD673276AE83CE

View File

@ -14,7 +14,7 @@ import RSCore
struct AddWebFeedView: View {
@Environment(\.presentationMode) private var presentationMode
@ObservedObject private var viewModel = AddWebFeedModel()
@StateObject private var viewModel = AddWebFeedModel()
@ViewBuilder var body: some View {
#if os(iOS)
@ -27,14 +27,15 @@ struct AddWebFeedView: View {
presentationMode.wrappedValue.dismiss()
}
})
#else
macForm
.onAppear {
viewModel.pasteUrlFromPasteboard()
}.alert(isPresented: $viewModel.showError) {
Alert(title: Text("Oops"), message: Text(viewModel.addFeedError!.localizedDescription), dismissButton: Alert.Button.cancel({
viewModel.addFeedError = AddWebFeedError.none
Alert(title: Text("Oops"),
message: Text(viewModel.addFeedError!.localizedDescription),
dismissButton: Alert.Button.cancel({
viewModel.addFeedError = AddWebFeedError.none
}))
}.onReceive(viewModel.$shouldDismiss, perform: { dismiss in
if dismiss == true {
@ -59,7 +60,6 @@ struct AddWebFeedView: View {
}.padding()
LazyVGrid(columns: [GridItem(.fixed(75), spacing: 10, alignment: .trailing),GridItem(.fixed(400), spacing: 0, alignment: .leading) ], alignment: .leading, spacing: 10, pinnedViews: [], content:{
Text("URL:").bold()
urlTextField
.textFieldStyle(RoundedBorderTextFieldStyle())
@ -134,16 +134,20 @@ struct AddWebFeedView: View {
if viewModel.containers[index] is Folder {
HStack(alignment: .top) {
if let image = viewModel.smallIconImage(for: viewModel.containers[index]) {
Image(rsImage: image).foregroundColor(.accentColor)
Image(rsImage: image)
.foregroundColor(.accentColor)
}
Text("\(containerName)").tag(index)
Text("\(containerName)")
.tag(index)
}.padding(.leading, 16)
} else {
HStack(alignment: .top) {
if let image = viewModel.smallIconImage(for: viewModel.containers[index]) {
Image(rsImage: image).foregroundColor(.accentColor)
Image(rsImage: image)
.foregroundColor(.accentColor)
}
Text(containerName).tag(index)
Text(containerName)
.tag(index)
}
}
}
@ -159,13 +163,18 @@ struct AddWebFeedView: View {
Image(rsImage: image)
}
Text("\(containerName)")
}.padding(.leading, 2).tag(index)
}
.padding(.leading, 2)
.tag(index)
} else {
Text(containerName).padding(.leading, 2).tag(index)
Text(containerName)
.padding(.leading, 2)
.tag(index)
}
}
})
}).padding(.leading, -8)
})
.padding(.leading, -8)
#endif
}
@ -188,7 +197,8 @@ struct AddWebFeedView: View {
})
.disabled(!viewModel.providedURL.mayBeURL)
.help("Add Feed")
}.padding(.trailing, 2)
}
.padding(.trailing, 2)
}