Make sure metadata gets saved if background fetch is performed.
This commit is contained in:
parent
af3e5e729c
commit
281416eaee
|
@ -368,10 +368,10 @@ public final class Account: DisplayNameProvider, UnreadCountProvider, Container,
|
|||
|
||||
}
|
||||
|
||||
public func saveIfNecessary() {
|
||||
metadataFile.saveIfNecessary()
|
||||
feedMetadataFile.saveIfNecessary()
|
||||
opmlFile.saveIfNecessary()
|
||||
public func save() {
|
||||
metadataFile.save()
|
||||
feedMetadataFile.save()
|
||||
opmlFile.save()
|
||||
}
|
||||
|
||||
func loadOPMLItems(_ items: [RSOPMLItem], parentFolder: Folder?) {
|
||||
|
|
|
@ -184,6 +184,10 @@ public final class AccountManager: UnreadCountProvider {
|
|||
}
|
||||
}
|
||||
|
||||
public func saveAll() {
|
||||
accounts.forEach { $0.save() }
|
||||
}
|
||||
|
||||
public func anyAccountHasAtLeastOneFeed() -> Bool {
|
||||
for account in activeAccounts {
|
||||
if account.hasAtLeastOneFeed() {
|
||||
|
|
|
@ -31,7 +31,7 @@ final class AccountMetadataFile {
|
|||
managedFile.load()
|
||||
}
|
||||
|
||||
func saveIfNecessary() {
|
||||
func save() {
|
||||
managedFile.saveIfNecessary()
|
||||
}
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ final class FeedMetadataFile {
|
|||
managedFile.load()
|
||||
}
|
||||
|
||||
func saveIfNecessary() {
|
||||
func save() {
|
||||
managedFile.saveIfNecessary()
|
||||
}
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ final class OPMLFile {
|
|||
managedFile.load()
|
||||
}
|
||||
|
||||
func saveIfNecessary() {
|
||||
func save() {
|
||||
managedFile.saveIfNecessary()
|
||||
}
|
||||
|
||||
|
|
|
@ -298,6 +298,9 @@ private extension AppDelegate {
|
|||
os_log("Account refresh operation completed.", log: self.log, type: .info)
|
||||
task.setTaskCompleted(success: true)
|
||||
}
|
||||
|
||||
AccountManager.shared.saveAll()
|
||||
|
||||
}
|
||||
|
||||
// set expiration handler
|
||||
|
|
|
@ -119,7 +119,7 @@ class ShareViewController: SLComposeServiceViewController, ShareFolderPickerCont
|
|||
|
||||
switch result {
|
||||
case .success:
|
||||
account!.saveIfNecessary()
|
||||
account!.save()
|
||||
self.extensionContext!.completeRequest(returningItems: [], completionHandler: nil)
|
||||
case .failure(let error):
|
||||
self.presentError(error) {
|
||||
|
|
Loading…
Reference in New Issue