Browse Source

select account type while send money removed

pull/1/head
Amrit Giri 4 years ago
parent
commit
fc99fffcdc
  1. 7
      GME Remit/Modules/RecipientModules/Recipients/Application Logic/Interactor/RecipientsInteractor.swift
  2. 1
      GME Remit/Modules/RecipientModules/Recipients/Application Logic/Interactor/RecipientsInteractorIO.swift
  3. 5
      GME Remit/Modules/RecipientModules/Recipients/Module Interface/RecipientsModuleInterface.swift
  4. 18
      GME Remit/Modules/RecipientModules/Recipients/User Interface/Presenter/RecipientsPresenter.swift
  5. 20
      GME Remit/Modules/RecipientModules/Recipients/User Interface/View/ViewModel/RecipientsViewModel.swift
  6. 2
      GME Remit/Modules/RecipientModules/Recipients/User Interface/View/ViewModel/RecipientsViewModelInterface.swift
  7. 9
      GME Remit/Modules/RecipientModules/Recipients/User Interface/Wireframe/RecipientsWireframe.swift
  8. 4
      GME Remit/Modules/RecipientModules/Recipients/User Interface/Wireframe/RecipientsWireframeInputOutput.swift
  9. 7
      GME Remit/Modules/RemittanceModules/OverseasModules/SendMoneyParent/Application Logic/Interactor/SendMoneyParentInteractor.swift
  10. 1
      GME Remit/Modules/RemittanceModules/OverseasModules/SendMoneyParent/Application Logic/Interactor/SendMoneyParentInteractorIO.swift
  11. 4
      GME Remit/Modules/RemittanceModules/OverseasModules/SendMoneyParent/User Interface/Presenter/SendMoneyParentPresenter.swift
  12. 10
      GME Remit/Modules/RemittanceModules/OverseasModules/SendMoneyParent/User Interface/View/SendMoneyParentViewController.swift
  13. 1
      GME Remit/Modules/RemittanceModules/OverseasModules/SendMoneyParent/User Interface/View/SendMoneyParentViewInterface.swift
  14. 7
      GME Remit/Modules/RemittanceModules/OverseasModules/SendMoneyParent/User Interface/Wireframe/SendMoneyParentWireframe.swift

7
GME Remit/Modules/RecipientModules/Recipients/Application Logic/Interactor/RecipientsInteractor.swift

@ -16,7 +16,6 @@ class RecipientsInteractor {
private let service: RecipientsServiceType
private var recipients: [Recipient]?
private var accounts: [Account]?
// MARK: Initialization
@ -36,15 +35,13 @@ extension RecipientsInteractor: RecipientsInteractorInput {
}
guard
let recipients = self.recipients,
let accounts = self.accounts
let recipients = self.recipients
else {
fetchRecipients()
return
}
output?.setRecipients(using: recipients)
output?.setAccounts(using: accounts)
}
func deleteRecipient(who recipient: Recipient) {
@ -61,10 +58,8 @@ extension RecipientsInteractor: RecipientsInteractorInput {
service.fetchRecipients(
success: {
self.recipients = $0.recipients
self.accounts = $0.accounts
self.output?.setRecipients(using: $0.recipients ?? [])
self.output?.setAccounts(using: $0.accounts ?? [])
},
failure: { self.output?.setError(with:$0) }
)

1
GME Remit/Modules/RecipientModules/Recipients/Application Logic/Interactor/RecipientsInteractorIO.swift

@ -13,6 +13,5 @@ protocol RecipientsInteractorInput: class {
protocol RecipientsInteractorOutput: class {
func setRecipients(using model: [Recipient])
func setAccounts(using model: [Account])
func setError(with error: Error)
}

5
GME Remit/Modules/RecipientModules/Recipients/Module Interface/RecipientsModuleInterface.swift

@ -8,12 +8,9 @@
protocol RecipientsModuleInterface: class {
func fetchRecipients(isRefresh: Bool)
func openSelectAccount(with accounts: [Account])
func setSelectedAccount(_ account: Account)
func openSendMoneyCalculate(who recipient: Recipient)
func openAddRecipient(with delegate: SetupRecipientDelegate)
func openEditRecipient(who recipient: Recipient, with delegate: SetupRecipientDelegate)
func deleteRecipient(who recipient: Recipient)
func goNextStep(who recipient: Recipient, with account: Account)
}

18
GME Remit/Modules/RecipientModules/Recipients/User Interface/Presenter/RecipientsPresenter.swift

@ -21,9 +21,9 @@ class RecipientsPresenter {
// MARK: Recipients module interface
extension RecipientsPresenter: RecipientsModuleInterface {
func openSelectAccount(with accounts: [Account]) {
wireframe?.openSelectAccount(with: accounts)
}
func openSendMoneyCalculate(who recipient: Recipient) {
wireframe?.goNextStep(who: recipient)
}
func openAddRecipient(with delegate: SetupRecipientDelegate) {
wireframe?.openAddRecipient(with: delegate)
@ -42,10 +42,6 @@ extension RecipientsPresenter: RecipientsModuleInterface {
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
@ -56,10 +52,6 @@ extension RecipientsPresenter: RecipientsInteractorOutput {
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)
@ -68,10 +60,6 @@ extension RecipientsPresenter: RecipientsInteractorOutput {
}
extension RecipientsPresenter: RecipientsWireframeOutput {
func setSelectedAccount(_ account: Account) {
viewModel?.setSelectedAccount(account)
}
func openedSetupRecipient() {
viewModel?.progress(isShow: false)
}

20
GME Remit/Modules/RecipientModules/Recipients/User Interface/View/ViewModel/RecipientsViewModel.swift

@ -95,9 +95,9 @@ class RecipientsViewModel: ViewModelType {
self.isPartnerChanged.onNext(())
return
}
let accounts = try? self.accountsLinker.value()
self.presenter?.openSelectAccount(with: accounts ?? [])
if let receipnt = self.selectedRecipient{
self.presenter?.openSendMoneyCalculate(who: receipnt)
}
})
.disposed(by: disposeBag)
@ -138,11 +138,6 @@ class RecipientsViewModel: ViewModelType {
// MARK: - RecipientsViewModelInterface
extension RecipientsViewModel: RecipientsViewModelInterface {
func setSelectedAccount(_ account: Account) {
guard let recipient = selectedRecipient else { return }
presenter?.goNextStep(who: recipient, with: account)
}
func setRecipients(using model: [Recipient]) {
recipientsLinker.onNext(model)
@ -153,16 +148,13 @@ extension RecipientsViewModel: RecipientsViewModelInterface {
selectedRecipient = model.filter({$0.receiverID == selectedID}).first
let accounts = try? self.accountsLinker.value()
presenter?.openSelectAccount(with: accounts ?? [])
if let receipnt = selectedRecipient{
presenter?.openSendMoneyCalculate(who: receipnt)
}
selectedRecipientID = nil
}
func setAccounts(using model: [Account]) {
accountsLinker.onNext(model)
}
func setError(with error: Error) {
errorLinker.onNext(error)
}

2
GME Remit/Modules/RecipientModules/Recipients/User Interface/View/ViewModel/RecipientsViewModelInterface.swift

@ -8,8 +8,6 @@
protocol RecipientsViewModelInterface: class {
func setRecipients(using model: [Recipient])
func setAccounts(using model: [Account])
func setSelectedAccount(_ account: Account)
func setError(with error: Error)
func progress(isShow: Bool)

9
GME Remit/Modules/RecipientModules/Recipients/User Interface/Wireframe/RecipientsWireframe.swift

@ -38,10 +38,6 @@ extension RecipientsWireframe: RecipientsWireframeInput {
return viewController
}
func openSelectAccount(with accounts: [Account]) {
self.output?.setSelectedAccount(Account(JSON: [:])!)
}
func openAddRecipient(with delegate: SetupRecipientDelegate) {
SetupRecipientWireframe().openNew(with: delegate, on: view) {
self.output?.openedSetupRecipient()
@ -54,12 +50,11 @@ extension RecipientsWireframe: RecipientsWireframeInput {
}
}
func goNextStep(who recipient: Recipient, with account: Account) {
func goNextStep(who recipient: Recipient) {
guard let navigationVC = view.navigationController else {
return
}
let wireframe = SendMoneyParentWireframe()
wireframe.open(for: recipient, with: account, in: navigationVC)
wireframe.open(for: recipient, in: navigationVC)
}
}

4
GME Remit/Modules/RecipientModules/Recipients/User Interface/Wireframe/RecipientsWireframeInputOutput.swift

@ -9,14 +9,12 @@
import Foundation
protocol RecipientsWireframeInput: WireframeInput {
func openSelectAccount(with accounts: [Account])
func openAddRecipient(with delegate: SetupRecipientDelegate)
func openEditRecipient(who recipient: Recipient, with delegate: SetupRecipientDelegate)
func goNextStep(who recipient: Recipient, with account: Account)
func goNextStep(who recipient: Recipient)
}
protocol RecipientsWireframeOutput: class {
func setSelectedAccount(_ account: Account)
func openedSetupRecipient()
func setSelectAccountError(with error: Error)
}

7
GME Remit/Modules/RemittanceModules/OverseasModules/SendMoneyParent/Application Logic/Interactor/SendMoneyParentInteractor.swift

@ -15,14 +15,12 @@ class SendMoneyParentInteractor {
weak var output: SendMoneyParentInteractorOutput?
private let service: SendMoneyParentServiceType
var reciepient: Recipient?
var account: Account?
// MARK: Initialization
init(service: SendMoneyParentServiceType, reciepient: Recipient?, account: Account?) {
init(service: SendMoneyParentServiceType, reciepient: Recipient?) {
self.service = service
self.reciepient = reciepient
self.account = account
}
// MARK: Converting entities
@ -32,9 +30,8 @@ class SendMoneyParentInteractor {
extension SendMoneyParentInteractor: SendMoneyParentInteractorInput {
func viewIsReady() {
if let reciepient = self.reciepient, let acunt = self.account {
if let reciepient = self.reciepient{
self.output?.show(model: reciepient)
self.output?.show(model: acunt)
}
}
}

1
GME Remit/Modules/RemittanceModules/OverseasModules/SendMoneyParent/Application Logic/Interactor/SendMoneyParentInteractorIO.swift

@ -12,5 +12,4 @@ protocol SendMoneyParentInteractorInput: class {
protocol SendMoneyParentInteractorOutput: class {
func show(model: Recipient)
func show(model: Account)
}

4
GME Remit/Modules/RemittanceModules/OverseasModules/SendMoneyParent/User Interface/Presenter/SendMoneyParentPresenter.swift

@ -34,8 +34,4 @@ extension SendMoneyParentPresenter: SendMoneyParentInteractorOutput {
func show(model: Recipient) {
self.view?.show(model: model)
}
func show(model: Account) {
self.view?.show(model: model)
}
}

10
GME Remit/Modules/RemittanceModules/OverseasModules/SendMoneyParent/User Interface/View/SendMoneyParentViewController.swift

@ -110,12 +110,6 @@ class SendMoneyParentViewController: UIViewController {
}
}
var account: Account? {
didSet {
self.requestModel.autoDebitAccount = account
}
}
// MARK: VC's Life cycle
override func viewDidLoad() {
@ -272,10 +266,6 @@ extension SendMoneyParentViewController: SendMoneyParentViewInterface {
func show(model: Recipient) {
self.receipient = model
}
func show(model: Account) {
self.account = model
}
}
extension SendMoneyParentViewController: HUDStatusDelegate {

1
GME Remit/Modules/RemittanceModules/OverseasModules/SendMoneyParent/User Interface/View/SendMoneyParentViewInterface.swift

@ -8,5 +8,4 @@
protocol SendMoneyParentViewInterface: class {
func show(model: Recipient)
func show(model: Account)
}

7
GME Remit/Modules/RemittanceModules/OverseasModules/SendMoneyParent/User Interface/Wireframe/SendMoneyParentWireframe.swift

@ -11,7 +11,6 @@ import UIKit
class SendMoneyParentWireframe {
weak var view: UIViewController!
var reciepient: Recipient?
var account: Account?
}
extension SendMoneyParentWireframe: SendMoneyParentWireframeInput {
@ -22,8 +21,7 @@ extension SendMoneyParentWireframe: SendMoneyParentWireframeInput {
let service = SendMoneyParentService()
let interactor = SendMoneyParentInteractor(
service: service,
reciepient: reciepient,
account: self.account
reciepient: reciepient
)
let presenter = SendMoneyParentPresenter()
@ -39,9 +37,8 @@ extension SendMoneyParentWireframe: SendMoneyParentWireframeInput {
return viewController
}
func open(for reciepient: Recipient, with account: Account, in source: UINavigationController) {
func open(for reciepient: Recipient, in source: UINavigationController) {
self.reciepient = reciepient
self.account = account
self.pushMainView(in: source)
}
}
Loading…
Cancel
Save