Skip writing OPML file to disk during startup. Structure-changed notices happen during startup as the object graph is created, but it doesn’t mean that there’s a change that requires saving to disk.

This commit is contained in:
Brent Simmons 2018-09-16 20:02:24 -07:00
parent 1c3dca4d9b
commit 7026eae899
1 changed files with 7 additions and 2 deletions

View File

@ -81,6 +81,8 @@ public final class Account: DisplayNameProvider, UnreadCountProvider, Container,
private var _flattenedFeeds = Set<Feed>()
private var flattenedFeedsNeedUpdate = true
private var startingUp = true
private struct SettingsKey {
static let unreadCount = "unreadCount"
}
@ -160,6 +162,7 @@ public final class Account: DisplayNameProvider, UnreadCountProvider, Container,
}
self.delegate.accountDidInitialize(self)
startingUp = false
}
// MARK: - API
@ -221,7 +224,7 @@ public final class Account: DisplayNameProvider, UnreadCountProvider, Container,
let folder = Folder(account: self, name: name)
folders!.insert(folder)
dirty = true
structureDidChange()
postChildrenDidChangeNotification()
return folder
@ -476,7 +479,9 @@ public final class Account: DisplayNameProvider, UnreadCountProvider, Container,
public func structureDidChange() {
// Feeds were added or deleted. Or folders added or deleted.
// Or feeds inside folders were added or deleted.
dirty = true
if !startingUp {
dirty = true
}
flattenedFeedsNeedUpdate = true
feedDictionaryNeedsUpdate = true
}