Browse Source

refractored

pull/1/head
gme_2 6 years ago
parent
commit
54f88ed445
  1. 17
      GMERemittance/Module/Resend/Application Logic/Interactor/ResendInteractor.swift
  2. 5
      GMERemittance/Module/Resend/Application Logic/Interactor/ResendInteractorIO.swift
  3. 2
      GMERemittance/Module/Resend/Application Logic/Service/ResendServiceType.swift
  4. 1
      GMERemittance/Module/Resend/Module Interface/ResendModuleInterface.swift
  5. 17
      GMERemittance/Module/Resend/User Interface/Presenter/ResendPresenter.swift
  6. 27
      GMERemittance/Module/Resend/User Interface/View/ResendViewController.swift
  7. 4
      GMERemittance/Module/Resend/User Interface/View/ResendViewInterface.swift
  8. 3
      GMERemittance/SideMenu/SideMenu.storyboard

17
GMERemittance/Module/Resend/Application Logic/Interactor/ResendInteractor.swift

@ -27,5 +27,20 @@ class ResendInteractor {
// MARK: Resend interactor input interface
extension ResendInteractor: ResendInteractorInput {
func fetchList(fromDate: String?, toDate: String?) {
let userName = Utility.getMyUserName()
var param: [String: String] = [:]
if let fromDate = fromDate {
param["FromDate"] = fromDate
}
if let toDate = toDate {
param["ToDate"] = toDate
}
self.service.fetchResendService(user: userName, param: param, success: { (model) in
guard let model = model else {return}
self.output?.show(model: model)
}) { (error) in
self.output?.show(error: error)
}
}
}

5
GMERemittance/Module/Resend/Application Logic/Interactor/ResendInteractorIO.swift

@ -7,9 +7,10 @@
//
protocol ResendInteractorInput: class {
func fetchList(fromDate: String?, toDate: String?)
}
protocol ResendInteractorOutput: class {
func show(model: ResendListModel)
func show(error: Error)
}

2
GMERemittance/Module/Resend/Application Logic/Service/ResendServiceType.swift

@ -9,7 +9,7 @@
import Foundation
import Alamofire
protocol ResendServiceType: class {
protocol ResendServiceType: class , FetchResendService {
}

1
GMERemittance/Module/Resend/Module Interface/ResendModuleInterface.swift

@ -9,4 +9,5 @@
protocol ResendModuleInterface: class {
func viewIsReady()
func search(text: String)
func fetchList(fromDate: String, toDate: String)
}

17
GMERemittance/Module/Resend/User Interface/Presenter/ResendPresenter.swift

@ -22,10 +22,17 @@ class ResendPresenter {
// MARK: Resend module interface
extension ResendPresenter: ResendModuleInterface {
func fetchList(fromDate: String, toDate: String) {
self.interactor?.fetchList(fromDate: fromDate, toDate: toDate)
}
func viewIsReady() {
self.view?.showLoading()
self.interactor?.fetchList(fromDate: nil, toDate: nil)
}
func search(text: String) {
}
@ -36,5 +43,13 @@ extension ResendPresenter: ResendModuleInterface {
// MARK: Resend interactor output interface
extension ResendPresenter: ResendInteractorOutput {
func show(error: Error) {
self.view?.hideLoading()
self.view?.hideLoading()
}
func show(model: ResendListModel) {
self.view?.hideLoading()
self.view?.show(model: model)
}
}

27
GMERemittance/Module/Resend/User Interface/View/ResendViewController.swift

@ -7,7 +7,7 @@
//
import UIKit
import Localize_Swift
// func getParams(model: SendMoneyRequestModel, reciepient: Recipient) -> [String: String] { // last api call
class ResendRequestModel {
@ -101,7 +101,7 @@ class ResendViewController: UIViewController {
super.viewDidLoad()
self.setupNormalNavigation()
self.setup()
self.fetchList()
self.presenter?.viewIsReady()
}
override func viewWillAppear(_ animated: Bool) {
@ -144,23 +144,8 @@ class ResendViewController: UIViewController {
private func fetchList(fromDate: String? = nil, toDate: String? = nil) {
let userName = Utility.getMyUserName()
var param: [String: String] = [:]
if let fromDate = fromDate {
param["FromDate"] = fromDate
}
if let toDate = toDate {
param["ToDate"] = toDate
}
self.showLoading()
self.fetchResendService(user: userName, param: param, success: { (model) in
self.hideLoading()
self.model = model
}) { (error) in
self.hideLoading()
self.alert(message: error.localizedDescription)
}
guard let fromDate = fromDate, let toDate = toDate else { return }
self.presenter?.fetchList(fromDate: fromDate, toDate: toDate)
}
@ -222,6 +207,10 @@ class ResendViewController: UIViewController {
// MARK: TransactionHistoryViewInterface
extension ResendViewController: ResendViewInterface {
func show(model: ResendListModel) {
self.model = model
}
func showLoading() {
self.showProgressHud()
}

4
GMERemittance/Module/Resend/User Interface/View/ResendViewInterface.swift

@ -7,4 +7,8 @@
//
protocol ResendViewInterface: class {
func showLoading()
func hideLoading()
func show(model: ResendListModel)
func show(error: String)
}

3
GMERemittance/SideMenu/SideMenu.storyboard

@ -268,7 +268,7 @@
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="sm_managet_accounts" translatesAutoresizingMaskIntoConstraints="NO" id="gPd-WX-FHE">
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="sm_txn_report 2" translatesAutoresizingMaskIntoConstraints="NO" id="gPd-WX-FHE">
<rect key="frame" x="0.0" y="7.5" width="15" height="15"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
@ -638,5 +638,6 @@
<image name="settingsSetting" width="15" height="16"/>
<image name="settingsSupport" width="17" height="15"/>
<image name="sm_managet_accounts" width="54" height="45"/>
<image name="sm_txn_report 2" width="48" height="48"/>
</resources>
</document>
Loading…
Cancel
Save