// // RecipientsPresenter.swift // GME Remit // // Created by InKwon James Kim on 08/08/2019. //Copyright © 2019 Gobal Money Express Co. Ltd. All rights reserved. // import Foundation class RecipientsPresenter { // MARK: Properties weak var viewModel: RecipientsViewModelInterface? var interactor: RecipientsInteractorInput? var wireframe: RecipientsWireframeInput? } // MARK: Recipients module interface extension RecipientsPresenter: RecipientsModuleInterface { func openSelectAccount(with accounts: [Account]) { wireframe?.openSelectAccount(with: accounts) } func openAddRecipient(with delegate: SetupRecipientDelegate) { viewModel?.progress(isShow: true) wireframe?.openAddRecipient(with: delegate) } func openEditRecipient(who recipient: Recipient, with delegate: SetupRecipientDelegate) { viewModel?.progress(isShow: true) wireframe?.openEditRecipient(who: recipient, with: delegate) } func deleteRecipient(who recipient: Recipient) { viewModel?.progress(isShow: true) interactor?.deleteRecipient(who: recipient) } func fetchRecipients(isRefresh: Bool) { viewModel?.progress(isShow: true) interactor?.fetchRecipients(isRefresh: isRefresh) } func goNextStep(who recipient: Recipient, with account: Account) { wireframe?.goNextStep(who: recipient, with: account) } } // MARK: Recipients interactor output interface extension RecipientsPresenter: RecipientsInteractorOutput { func setRecipients(using model: [Recipient]) { viewModel?.progress(isShow: false) viewModel?.setRecipients(using: model) } func setAccounts(using model: [Account]) { viewModel?.setAccounts(using: model) } func setError(with error: Error) { viewModel?.progress(isShow: false) viewModel?.setError(with: error) } } extension RecipientsPresenter: RecipientsWireframeOutput { func setSelectedAccount(_ account: Account) { viewModel?.setSelectedAccount(account) } func openedSetupRecipient() { viewModel?.progress(isShow: false) } func setSelectAccountError(with error: Error) { viewModel?.setError(with: error) } }