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

//
// OrderHistoryPresenter.swift
// GME Remit
//
// Created by InKwon Devik Kim on 14/05/2019.
//Copyright © 2019 Gobal Money Express Co. Ltd. All rights reserved.
//
import Foundation
class OrderHistoryPresenter {
// MARK: Properties
weak var view: OrderHistoryViewInterface?
var interactor: OrderHistoryInteractorInput?
var wireframe: OrderHistoryWireframeInput?
}
// MARK: OrderHistory module interface
extension OrderHistoryPresenter: OrderHistoryModuleInterface {
func fetchOrders(from startDate: String, to endDate: String) {
view?.stardLoading()
interactor?.fetchOrderHistory(from: startDate, to: endDate)
}
func fetchFilteredOrders(by searchText: String) {
interactor?.fetchFilteredOrders(by: searchText)
}
func pushDetailOrder(with order: Order?) {
wireframe?.pushDetailOrder(with: order)
}
func presentDatePicker(completion: ((_ from: String?, _ to: String?) -> Void)?) {
wireframe?.presentDatePicker(completion: completion)
}
}
// MARK: OrderHistory interactor output interface
extension OrderHistoryPresenter: OrderHistoryInteractorOutput {
func setOrderHistoryModel(with model: [Order]?) {
view?.endLoading()
view?.setOrderHistoryModel(with: model)
}
func didFailFetchOrderHistory(with error: Error) {
view?.endLoading()
view?.didFailFetchOrderHistory(with: error)
}
}