Commit a5fe1230 by Demid Merzlyakov

IOS-101: CoreDataStorage notifies the widget.

parent cab0b358
...@@ -9,6 +9,7 @@ import Foundation ...@@ -9,6 +9,7 @@ import Foundation
import CoreData import CoreData
import OneWeatherCore import OneWeatherCore
import OneWeatherAnalytics import OneWeatherAnalytics
import WidgetKit
public class CoreDataStorage: Storage { public class CoreDataStorage: Storage {
private let modelName = "1WModel" private let modelName = "1WModel"
...@@ -92,6 +93,11 @@ public class CoreDataStorage: Storage { ...@@ -92,6 +93,11 @@ public class CoreDataStorage: Storage {
context.insert(coreAppData) context.insert(coreAppData)
try self.save(context: context) try self.save(context: context)
self.lastSavedAppData = appData self.lastSavedAppData = appData
// This shouldn't be here in theory, but it's the simplest way to work around the DelayedSaveStorage.
// TODO: find a better place for it.
if #available(iOS 14, *) {
WidgetCenter.shared.reloadAllTimelines()
}
} }
self.log.info("Save: success") self.log.info("Save: success")
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment