Skip to content

Commit 542d883

Browse files
committed
Remove redundant method upsertSitePluginInBackground
1 parent aeb377d commit 542d883

File tree

1 file changed

+8
-17
lines changed

1 file changed

+8
-17
lines changed

Yosemite/Yosemite/Stores/SitePluginStore.swift

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,14 @@ private extension SitePluginStore {
8787
guard let self = self else { return }
8888
switch result {
8989
case .success(let plugin):
90-
self.upsertSitePluginInBackground(siteID: siteID, readonlyPlugin: plugin, completionHandler: onCompletion)
90+
self.upsertSitePluginsInBackground(siteID: siteID, readonlyPlugins: [plugin]) { result in
91+
switch result {
92+
case .success:
93+
onCompletion(.success(plugin))
94+
case .failure(let error):
95+
onCompletion(.failure(error))
96+
}
97+
}
9198
case .failure(let error):
9299
onCompletion(.failure(error))
93100
}
@@ -99,22 +106,6 @@ private extension SitePluginStore {
99106
//
100107
private extension SitePluginStore {
101108

102-
/// Updates or inserts Readonly the `SitePlugin` entity in background.
103-
/// Triggers `completionHandler` on main thread.
104-
///
105-
func upsertSitePluginInBackground(siteID: Int64, readonlyPlugin: SitePlugin, completionHandler: @escaping (Result<SitePlugin, Error>) -> Void) {
106-
let writerStorage = storageManager.writerDerivedStorage
107-
writerStorage.perform {
108-
self.upsertSitePlugins(siteID: siteID, readonlyPlugins: [readonlyPlugin], in: writerStorage)
109-
}
110-
111-
storageManager.saveDerivedType(derivedStorage: writerStorage) {
112-
DispatchQueue.main.async {
113-
completionHandler(.success(readonlyPlugin))
114-
}
115-
}
116-
}
117-
118109
/// Updates or inserts Readonly `SitePlugin` entities in background.
119110
/// Triggers `completionHandler` on main thread.
120111
///

0 commit comments

Comments
 (0)