Persist feed name changes correctly.

This commit is contained in:
Maurice Parker 2019-10-30 15:35:45 -05:00
parent 8bbabbacdb
commit 8d85d01da4

View File

@ -69,7 +69,6 @@ struct FeedInspectorView : View {
.onDisappear { self.viewModel.save() }
.navigationBarTitle(Text(verbatim: self.viewModel.nameForDisplay), displayMode: .inline)
.navigationBarItems(leading: Button(action: {
self.viewModel.save()
self.viewController?.dismiss(animated: true)
}) { Text("Done") } )
}
@ -137,7 +136,8 @@ struct FeedInspectorView : View {
func save() {
if name != nameForDisplay {
feed.editedName = name.isEmpty ? nil : name
let newName = name.isEmpty ? (feed.name ?? NSLocalizedString("Untitled", comment: "Feed name")) : name
feed.rename(to: newName) { _ in }
}
}