Fix bug where empty folders would be lost between runs of the app.

This commit is contained in:
Brent Simmons 2019-01-27 21:42:58 -08:00
parent 75199d2546
commit f5d6e7e8fa
1 changed files with 6 additions and 8 deletions

View File

@ -762,20 +762,18 @@ private extension Account {
return
}
guard item.isFolder, let itemChildren = item.children else {
return
}
// TODO: possibly support sub folders.
guard let folderName = item.titleFromAttributes else {
// Folder doesnt have a name, so it wont be created, and its items will go one level up.
importOPMLItems(itemChildren, parentFolder: parentFolder)
if let itemChildren = item.children {
importOPMLItems(itemChildren, parentFolder: parentFolder)
}
return
}
if let folder = ensureFolder(with: folderName) {
importOPMLItems(itemChildren, parentFolder: folder)
if let itemChildren = item.children {
importOPMLItems(itemChildren, parentFolder: folder)
}
}
}