mirror of
https://github.com/viq/NewsBlur.git
synced 2025-08-31 14:11:05 +00:00
#1718 (nested folder bug)
- Fixed duplication of feeds from subfolders.
This commit is contained in:
parent
9adbe4c479
commit
031ddba2c4
1 changed files with 11 additions and 5 deletions
|
@ -65,19 +65,25 @@ class FeedsViewController: FeedsObjCViewController {
|
|||
return
|
||||
}
|
||||
|
||||
guard let childFeeds = appDelegate.dictFolders[folderTitle] as? [AnyObject],
|
||||
let parentFeeds = appDelegate.dictFolders[parentTitle] as? [AnyObject] else {
|
||||
guard let childFeeds = appDelegate.dictFolders[folderTitle] as? [AnyHashable],
|
||||
let parentFeeds = appDelegate.dictFolders[parentTitle] as? [AnyHashable] else {
|
||||
return
|
||||
}
|
||||
|
||||
let existingSubfolders = appDelegate.dictSubfolders[parentTitle] as? [AnyObject] ?? []
|
||||
let existingSubfolders = appDelegate.dictSubfolders[parentTitle] as? [AnyHashable] ?? []
|
||||
|
||||
appDelegate.dictFolders[parentTitle] = parentFeeds + childFeeds
|
||||
appDelegate.dictSubfolders[parentTitle] = existingSubfolders + childFeeds
|
||||
appDelegate.dictFolders[parentTitle] = unique(parentFeeds + childFeeds)
|
||||
appDelegate.dictSubfolders[parentTitle] = unique(existingSubfolders + childFeeds)
|
||||
|
||||
addSubfolderFeeds(for: parentTitle)
|
||||
}
|
||||
|
||||
private func unique(_ array: [AnyHashable]) -> [AnyHashable] {
|
||||
var seen: Set<AnyHashable> = []
|
||||
|
||||
return array.filter { seen.insert($0).inserted }
|
||||
}
|
||||
|
||||
@objc(parentTitleForFolderTitle:) func parentTitle(for folderTitle: String) -> String? {
|
||||
guard let range = folderTitle.range(of: " ▸ ", options: .backwards) else {
|
||||
return nil
|
||||
|
|
Loading…
Add table
Reference in a new issue