You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

56 lines
1.4 KiB

  1. //
  2. // OrderHistoryPresenter.swift
  3. // GME Remit
  4. //
  5. // Created by InKwon Devik Kim on 14/05/2019.
  6. //Copyright © 2019 Gobal Money Express Co. Ltd. All rights reserved.
  7. //
  8. import Foundation
  9. class OrderHistoryPresenter {
  10. // MARK: Properties
  11. weak var view: OrderHistoryViewInterface?
  12. var interactor: OrderHistoryInteractorInput?
  13. var wireframe: OrderHistoryWireframeInput?
  14. }
  15. // MARK: OrderHistory module interface
  16. extension OrderHistoryPresenter: OrderHistoryModuleInterface {
  17. func fetchOrders(from startDate: String, to endDate: String) {
  18. view?.stardLoading()
  19. interactor?.fetchOrderHistory(from: startDate, to: endDate)
  20. }
  21. func fetchFilteredOrders(by searchText: String) {
  22. interactor?.fetchFilteredOrders(by: searchText)
  23. }
  24. func pushDetailOrder(with order: Order?) {
  25. wireframe?.pushDetailOrder(with: order)
  26. }
  27. func presentDatePicker(completion: ((_ from: String?, _ to: String?) -> Void)?) {
  28. wireframe?.presentDatePicker(completion: completion)
  29. }
  30. }
  31. // MARK: OrderHistory interactor output interface
  32. extension OrderHistoryPresenter: OrderHistoryInteractorOutput {
  33. func setOrderHistoryModel(with model: [Order]?) {
  34. view?.endLoading()
  35. view?.setOrderHistoryModel(with: model)
  36. }
  37. func didFailFetchOrderHistory(with error: Error) {
  38. view?.endLoading()
  39. view?.didFailFetchOrderHistory(with: error)
  40. }
  41. }