Skip to content

Commit 34326a1

Browse files
committed
Removes Advanced Settings Sync
1 parent 6361f23 commit 34326a1

File tree

8 files changed

+0
-175
lines changed

8 files changed

+0
-175
lines changed

Networking/Networking.xcodeproj/project.pbxproj

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,6 @@
142142
2665032E261F4FBF0079A159 /* ProductAddOnOption.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2665032D261F4FBF0079A159 /* ProductAddOnOption.swift */; };
143143
26650332261FFA1A0079A159 /* ProductAddOnEnvelope.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26650331261FFA1A0079A159 /* ProductAddOnEnvelope.swift */; };
144144
266C7F9225AD3C88006ED243 /* attribute-term.json in Resources */ = {isa = PBXBuildFile; fileRef = 266C7F9125AD3C87006ED243 /* attribute-term.json */; };
145-
267066092774BF3B008E1F68 /* settings-advanced.json in Resources */ = {isa = PBXBuildFile; fileRef = 267066082774BF3B008E1F68 /* settings-advanced.json */; };
146145
2670C3FC270F4E06002FE931 /* SiteListMapperTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2670C3FB270F4E06002FE931 /* SiteListMapperTests.swift */; };
147146
2670C3FE270F4E6A002FE931 /* sites-malformed.json in Resources */ = {isa = PBXBuildFile; fileRef = 2670C3FD270F4E6A002FE931 /* sites-malformed.json */; };
148147
267313312559CC930026F7EF /* PaymentGateway.swift in Sources */ = {isa = PBXBuildFile; fileRef = 267313302559CC930026F7EF /* PaymentGateway.swift */; };
@@ -812,7 +811,6 @@
812811
2665032D261F4FBF0079A159 /* ProductAddOnOption.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProductAddOnOption.swift; sourceTree = "<group>"; };
813812
26650331261FFA1A0079A159 /* ProductAddOnEnvelope.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProductAddOnEnvelope.swift; sourceTree = "<group>"; };
814813
266C7F9125AD3C87006ED243 /* attribute-term.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = "attribute-term.json"; sourceTree = "<group>"; };
815-
267066082774BF3B008E1F68 /* settings-advanced.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = "settings-advanced.json"; sourceTree = "<group>"; };
816814
2670C3FB270F4E06002FE931 /* SiteListMapperTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SiteListMapperTests.swift; sourceTree = "<group>"; };
817815
2670C3FD270F4E6A002FE931 /* sites-malformed.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = "sites-malformed.json"; sourceTree = "<group>"; };
818816
267313302559CC930026F7EF /* PaymentGateway.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PaymentGateway.swift; sourceTree = "<group>"; };
@@ -1942,7 +1940,6 @@
19421940
D88D5A40230BC5DA007B6E01 /* reviews-all.json */,
19431941
57BE08D72409B63700F6DCED /* reviews-missing-avatar-urls.json */,
19441942
D88D5A42230BC668007B6E01 /* reviews-single.json */,
1945-
267066082774BF3B008E1F68 /* settings-advanced.json */,
19461943
DE74F29B27E0A1D00002FE59 /* setting-coupon.json */,
19471944
DE74F29F27E3137F0002FE59 /* setting-analytics.json */,
19481945
74046E20217A73D0007DD7BF /* settings-general.json */,
@@ -2519,7 +2516,6 @@
25192516
CC0786C7267BB10700BA9AC1 /* shipping-label-status-success.json in Resources */,
25202517
D88D5A41230BC5DA007B6E01 /* reviews-all.json in Resources */,
25212518
74C947862193A6C70024CB60 /* comment-moderate-unapproved.json in Resources */,
2522-
267066092774BF3B008E1F68 /* settings-advanced.json in Resources */,
25232519
3105472C262E303400C5C02B /* wcpay-payment-intent-unknown-status.json in Resources */,
25242520
B559EBAA20A0B5CD00836CD4 /* orders-load-all.json in Resources */,
25252521
3158A4A12729F40F00C3CFA8 /* wcpay-account-live-test.json in Resources */,

Networking/Networking/Remote/SiteSettingsRemote.swift

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -33,20 +33,6 @@ public class SiteSettingsRemote: Remote {
3333
enqueue(request, mapper: mapper, completion: completion)
3434
}
3535

36-
/// Retrieves all of the advanced `SiteSetting`s for a given site.
37-
///
38-
/// - Parameters:
39-
/// - siteID: Site for which we'll fetch the advanced settings.
40-
/// - completion: Closure to be executed upon completion.
41-
///
42-
public func loadAdvancedSettings(for siteID: Int64, completion: @escaping (Result<[SiteSetting], Error>) -> Void) {
43-
let path = Constants.siteSettingsPath + Constants.advancedSettingsGroup
44-
let request = JetpackRequest(wooApiVersion: .mark3, method: .get, siteID: siteID, path: path, parameters: nil)
45-
let mapper = SiteSettingsMapper(siteID: siteID, settingsGroup: SiteSettingGroup.advanced)
46-
47-
enqueue(request, mapper: mapper, completion: completion)
48-
}
49-
5036
/// Retrieve detail for a single setting for a given site
5137
///
5238
/// - Parameters:

Networking/NetworkingTests/Remote/SiteSettingsRemoteTests.swift

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -87,25 +87,6 @@ final class SiteSettingsRemoteTests: XCTestCase {
8787
wait(for: [expectation], timeout: Constants.expectationTimeout)
8888
}
8989

90-
// MARK: - Load advanced settings tests
91-
92-
func test_load_advanced_settings_properly_returns_parsed_settings() throws {
93-
// Given
94-
network.simulateResponse(requestUrlSuffix: "settings/advanced", filename: "settings-advanced")
95-
let remote = SiteSettingsRemote(network: network)
96-
97-
// When
98-
let result: Result<[Networking.SiteSetting], Error> = waitFor { promise in
99-
remote.loadAdvancedSettings(for: self.sampleSiteID) { result in
100-
promise(result)
101-
}
102-
}
103-
104-
// Then
105-
let settings = try result.get()
106-
XCTAssertEqual(settings.count, 2)
107-
}
108-
10990
// MARK: - Load single setting tests
11091
func test_loadSetting_properly_returns_parsed_settings() throws {
11192
// Given

Networking/NetworkingTests/Responses/settings-advanced.json

Lines changed: 0 additions & 46 deletions
This file was deleted.

WooCommerce/Classes/Yosemite/DefaultStoresManager.swift

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -330,15 +330,6 @@ private extension DefaultStoresManager {
330330
}
331331
dispatch(productSettingsAction)
332332

333-
group.enter()
334-
let advancedSettingsAction = SettingAction.synchronizeAdvancedSiteSettings(siteID: siteID) { error in
335-
if let error = error {
336-
errors.append(error)
337-
}
338-
group.leave()
339-
}
340-
dispatch(advancedSettingsAction)
341-
342333
group.enter()
343334
let sitePlanAction = AccountAction.synchronizeSitePlan(siteID: siteID) { result in
344335
if case let .failure(error) = result {

Yosemite/Yosemite/Actions/SettingAction.swift

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,6 @@ public enum SettingAction: Action {
1414
///
1515
case synchronizeProductSiteSettings(siteID: Int64, onCompletion: (Error?) -> Void)
1616

17-
/// Synchronizes the site's advanced settings
18-
///
19-
case synchronizeAdvancedSiteSettings(siteID: Int64, onCompletion: (Error?) -> Void)
20-
2117
/// Retrieves the site API details (used to determine the WC version)
2218
///
2319
case retrieveSiteAPI(siteID: Int64, onCompletion: (Result<SiteAPI, Error>) -> Void)

Yosemite/Yosemite/Stores/SettingStore.swift

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,6 @@ public class SettingStore: Store {
3838
synchronizeGeneralSiteSettings(siteID: siteID, onCompletion: onCompletion)
3939
case .synchronizeProductSiteSettings(let siteID, let onCompletion):
4040
synchronizeProductSiteSettings(siteID: siteID, onCompletion: onCompletion)
41-
case let .synchronizeAdvancedSiteSettings(siteID, onCompletion):
42-
synchronizeAdvancedSiteSettings(siteID: siteID, onCompletion: onCompletion)
4341
case .retrieveSiteAPI(let siteID, let onCompletion):
4442
retrieveSiteAPI(siteID: siteID, onCompletion: onCompletion)
4543
case let .retrieveCouponSetting(siteID, onCompletion):
@@ -89,21 +87,6 @@ private extension SettingStore {
8987
}
9088
}
9189

92-
/// Synchronizes the advanced site settings associated with the provided Site ID (if any!).
93-
///
94-
func synchronizeAdvancedSiteSettings(siteID: Int64, onCompletion: @escaping (Error?) -> Void) {
95-
siteSettingsRemote.loadAdvancedSettings(for: siteID) { [weak self] result in
96-
switch result {
97-
case .success(let settings):
98-
self?.upsertStoredAdvancedSettingsInBackground(siteID: siteID, readOnlySiteSettings: settings) {
99-
onCompletion(nil)
100-
}
101-
case .failure(let error):
102-
onCompletion(error)
103-
}
104-
}
105-
}
106-
10790
/// Retrieves the site API information associated with the provided Site ID (if any!).
10891
/// This call does NOT persist returned data into the Storage layer.
10992
///

Yosemite/YosemiteTests/Stores/SettingStoreTests.swift

Lines changed: 0 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -472,48 +472,6 @@ final class SettingStoreTests: XCTestCase {
472472
XCTAssertEqual(storageProductSiteSettings2?.map({ $0.toReadOnly() }).sorted(), [sampleProductSiteSetting2Mutated()])
473473
}
474474

475-
func test_advanced_site_gets_stored_correctly() throws {
476-
// Given
477-
let settingStore = SettingStore(dispatcher: dispatcher, storageManager: storageManager, network: network)
478-
network.simulateResponse(requestUrlSuffix: "settings/advanced", filename: "settings-advanced")
479-
XCTAssertEqual(viewStorage.countObjects(ofType: Storage.SiteSetting.self), 0)
480-
481-
// When
482-
let action = SettingAction.synchronizeAdvancedSiteSettings(siteID: sampleSiteID) { _ in }
483-
settingStore.onAction(action)
484-
485-
// Then
486-
waitUntil {
487-
self.viewStorage.countObjects(ofType: Storage.SiteSetting.self) == 2
488-
}
489-
}
490-
491-
func test_advanced_site_gets_updated_correctly() throws {
492-
// Given
493-
storageManager.insertSampleSiteSetting(readOnlySiteSetting: sampleAdvancedSiteSettingMutated())
494-
XCTAssertEqual(viewStorage.countObjects(ofType: Storage.SiteSetting.self), 1)
495-
496-
network.simulateResponse(requestUrlSuffix: "settings/advanced", filename: "settings-advanced")
497-
let settingStore = SettingStore(dispatcher: dispatcher, storageManager: storageManager, network: network)
498-
499-
// When
500-
let completed: Bool = waitFor { promise in
501-
let action = SettingAction.synchronizeAdvancedSiteSettings(siteID: self.sampleSiteID) { _ in
502-
promise(true)
503-
}
504-
settingStore.onAction(action)
505-
}
506-
507-
508-
// Then
509-
XCTAssertTrue(completed)
510-
XCTAssertEqual(viewStorage.countObjects(ofType: Storage.SiteSetting.self), 2)
511-
512-
let sample = sampleAdvancedSiteSetting()
513-
let updated = viewStorage.loadSiteSetting(siteID: sampleSiteID, settingID: sample.settingID)?.toReadOnly()
514-
XCTAssertEqual(sample, updated)
515-
}
516-
517475

518476
// MARK: - SettingAction.retrieveSiteAPI
519477

@@ -875,26 +833,6 @@ private extension SettingStoreTests {
875833
settingGroupKey: SiteSettingGroup.product.rawValue)
876834
}
877835

878-
// MARK: - Advanced SiteSetting Samples
879-
880-
func sampleAdvancedSiteSetting() -> Networking.SiteSetting {
881-
return SiteSetting(siteID: sampleSiteID,
882-
settingID: "woocommerce_checkout_pay_endpoint",
883-
label: "Pay",
884-
settingDescription: "Endpoint for the pay page",
885-
value: "order-pay",
886-
settingGroupKey: SiteSettingGroup.advanced.rawValue)
887-
}
888-
889-
func sampleAdvancedSiteSettingMutated() -> Networking.SiteSetting {
890-
return SiteSetting(siteID: sampleSiteID,
891-
settingID: "woocommerce_checkout_pay_endpoint",
892-
label: "Pay",
893-
settingDescription: "Endpoint for the pay page",
894-
value: "order-pay-2",
895-
settingGroupKey: SiteSettingGroup.advanced.rawValue)
896-
}
897-
898836
// MARK: - SiteAPI Samples
899837

900838
func sampleSiteAPIWithWoo() -> Networking.SiteAPI {

0 commit comments

Comments
 (0)