Skip to content

Commit a674d6b

Browse files
committed
Adds Empty RemoteSynchronizer
1 parent d05affd commit a674d6b

File tree

2 files changed

+62
-0
lines changed

2 files changed

+62
-0
lines changed
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
import Foundation
2+
import Yosemite
3+
import Combine
4+
5+
/// Type that syncs the order with the remote server.
6+
///
7+
final class RemoteOrderSynchronizer: OrderSynchronizer {
8+
9+
// MARK: Outputs
10+
11+
@Published private(set) var state: OrderSyncState = .synced
12+
13+
var statePublisher: Published<OrderSyncState>.Publisher {
14+
$state
15+
}
16+
17+
@Published private(set) var order: Order = OrderFactory.emptyNewOrder
18+
19+
var orderPublisher: Published<Order>.Publisher {
20+
$order
21+
}
22+
23+
// MARK: Inputs
24+
25+
var setStatus = PassthroughSubject<OrderStatusEnum, Never>()
26+
27+
var setProduct = PassthroughSubject<OrderSyncProductInput, Never>()
28+
29+
var setAddresses = PassthroughSubject<OrderSyncAddressesInput?, Never>()
30+
31+
var setShipping = PassthroughSubject<ShippingLine?, Never>()
32+
33+
var setFee = PassthroughSubject<OrderFeeLine?, Never>()
34+
35+
// MARK: Private properties
36+
37+
private let siteID: Int64
38+
39+
private let stores: StoresManager
40+
41+
// MARK: Initializers
42+
43+
init(siteID: Int64, stores: StoresManager = ServiceLocator.stores) {
44+
self.siteID = siteID
45+
self.stores = stores
46+
}
47+
48+
// MARK: Methods
49+
func retrySync() {
50+
// TODO: Implement
51+
}
52+
53+
/// Creates the order remotely.
54+
///
55+
func commitAllChanges(onCompletion: @escaping (Result<Order, Error>) -> Void) {
56+
// TODO: Implement
57+
}
58+
}

WooCommerce/WooCommerce.xcodeproj/project.pbxproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -419,6 +419,7 @@
419419
247CE8A6258340E600F9D9D1 /* ScreenshotImages.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 247CE8A5258340E600F9D9D1 /* ScreenshotImages.xcassets */; };
420420
24C5AC7625A53021008FD769 /* Embassy in Frameworks */ = {isa = PBXBuildFile; productRef = 247CE89B2583402A00F9D9D1 /* Embassy */; };
421421
24F98C502502AEE200F49B68 /* EventLogging.swift in Sources */ = {isa = PBXBuildFile; fileRef = 24F98C4F2502AEE200F49B68 /* EventLogging.swift */; };
422+
2602A63D27BD3C8C00B347F1 /* RemoteOrderSynchronizer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2602A63C27BD3C8C00B347F1 /* RemoteOrderSynchronizer.swift */; };
422423
260C315E2523CC4000157BC2 /* RefundProductsTotalViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 260C315D2523CC4000157BC2 /* RefundProductsTotalViewModel.swift */; };
423424
260C31602524ECA900157BC2 /* IssueRefundViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 260C315F2524ECA900157BC2 /* IssueRefundViewController.swift */; };
424425
260C31622524EEB200157BC2 /* IssueRefundViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 260C31612524EEB200157BC2 /* IssueRefundViewController.xib */; };
@@ -2056,6 +2057,7 @@
20562057
24C579D124F476300076E1B4 /* Woo-Alpha.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = "Woo-Alpha.entitlements"; sourceTree = "<group>"; };
20572058
24F98C4F2502AEE200F49B68 /* EventLogging.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EventLogging.swift; sourceTree = "<group>"; };
20582059
25D00C97936D2C6589F8ECE9 /* Pods-WooCommerce.release-alpha.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-WooCommerce.release-alpha.xcconfig"; path = "../Pods/Target Support Files/Pods-WooCommerce/Pods-WooCommerce.release-alpha.xcconfig"; sourceTree = "<group>"; };
2060+
2602A63C27BD3C8C00B347F1 /* RemoteOrderSynchronizer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RemoteOrderSynchronizer.swift; sourceTree = "<group>"; };
20592061
260C315D2523CC4000157BC2 /* RefundProductsTotalViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RefundProductsTotalViewModel.swift; sourceTree = "<group>"; };
20602062
260C315F2524ECA900157BC2 /* IssueRefundViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IssueRefundViewController.swift; sourceTree = "<group>"; };
20612063
260C31612524EEB200157BC2 /* IssueRefundViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = IssueRefundViewController.xib; sourceTree = "<group>"; };
@@ -4523,6 +4525,7 @@
45234525
children = (
45244526
26C6439227B5DBE900DD00D1 /* OrderSynchronizer.swift */,
45254527
26C6439427B9A1B300DD00D1 /* LocalOrderSynchronizer.swift */,
4528+
2602A63C27BD3C8C00B347F1 /* RemoteOrderSynchronizer.swift */,
45264529
);
45274530
path = Synchronizer;
45284531
sourceTree = "<group>";
@@ -8663,6 +8666,7 @@
86638666
DEDB886B26E8531E00981595 /* ShippingLabelPackageAttributes.swift in Sources */,
86648667
AEC95D412774C5AE001571F5 /* AddressFormViewModelProtocol.swift in Sources */,
86658668
B6E851F5276330200041D1BA /* RefundFeesDetailsTableViewCell.swift in Sources */,
8669+
2602A63D27BD3C8C00B347F1 /* RemoteOrderSynchronizer.swift in Sources */,
86668670
B57C744A20F5649300EEFC87 /* EmptyStoresTableViewCell.swift in Sources */,
86678671
45DB70602614C7E80064A6CF /* ShippingLabelPackageDetailsResultsControllers.swift in Sources */,
86688672
027D67D1245ADDF40036B8DB /* FilterTypeViewModel+Helpers.swift in Sources */,

0 commit comments

Comments
 (0)