From ee22704aa35704adc4d000b02168433e7bd28c2e Mon Sep 17 00:00:00 2001 From: gme_2 Date: Tue, 4 Sep 2018 10:53:22 +0900 Subject: [PATCH] shown success message --- GMERemittance/Extension/UIViewControllerExtension.swift | 6 ++++++ .../User Interface/View/EditReciepientViewController.swift | 1 - .../Interactor/SendMoneyVerificationInteractorIO.swift | 2 +- .../Service/SendMoneyVerificationServiceType.swift | 6 +++--- .../Presenter/SendMoneyVerificationPresenter.swift | 2 +- .../View/SendMoneyVerificationViewController.swift | 7 +++++-- .../View/SendMoneyVerificationViewInterface.swift | 2 +- 7 files changed, 17 insertions(+), 9 deletions(-) diff --git a/GMERemittance/Extension/UIViewControllerExtension.swift b/GMERemittance/Extension/UIViewControllerExtension.swift index d4eb5c7c..2cec2503 100644 --- a/GMERemittance/Extension/UIViewControllerExtension.swift +++ b/GMERemittance/Extension/UIViewControllerExtension.swift @@ -45,6 +45,12 @@ extension UIViewController { self.present(alertController, animated: true, completion: nil) } + func alertWithOk(message: String?, title: String? = "Error", okTitle: String? = "Ok", style: UIAlertControllerStyle? = .alert, OkStyle: UIAlertActionStyle = .default, okAction: (()->())? = nil) { + let alertController = getAlert(message: message, title: title, style: style) + alertController.addAction(title: okTitle,style: OkStyle, handler: okAction) + self.present(alertController, animated: true, completion: nil) + } + private func getAlert(message: String?, title: String?, style: UIAlertControllerStyle? = .alert) -> UIAlertController { return UIAlertController(title: title, message: message, preferredStyle: style ?? .alert) } diff --git a/GMERemittance/Module/EditReciepient/User Interface/View/EditReciepientViewController.swift b/GMERemittance/Module/EditReciepient/User Interface/View/EditReciepientViewController.swift index a51ed037..d66d61e7 100644 --- a/GMERemittance/Module/EditReciepient/User Interface/View/EditReciepientViewController.swift +++ b/GMERemittance/Module/EditReciepient/User Interface/View/EditReciepientViewController.swift @@ -83,7 +83,6 @@ class EditReciepientViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() self.setup() - self.setup() self.setupDelegates() self.setupTargets() self.presenter?.viewIsReady() diff --git a/GMERemittance/Module/SendMoneyVerification/Application Logic/Interactor/SendMoneyVerificationInteractorIO.swift b/GMERemittance/Module/SendMoneyVerification/Application Logic/Interactor/SendMoneyVerificationInteractorIO.swift index b62d2a55..15c2d039 100644 --- a/GMERemittance/Module/SendMoneyVerification/Application Logic/Interactor/SendMoneyVerificationInteractorIO.swift +++ b/GMERemittance/Module/SendMoneyVerification/Application Logic/Interactor/SendMoneyVerificationInteractorIO.swift @@ -12,5 +12,5 @@ protocol SendMoneyVerificationInteractorInput: class { protocol SendMoneyVerificationInteractorOutput: class { func show(error: Error) - func show(model: SendMoneySubmitModel?) + func show(model: SendMoneySubmitModelContainer?) } diff --git a/GMERemittance/Module/SendMoneyVerification/Application Logic/Service/SendMoneyVerificationServiceType.swift b/GMERemittance/Module/SendMoneyVerification/Application Logic/Service/SendMoneyVerificationServiceType.swift index 0d1795c9..a534b80c 100644 --- a/GMERemittance/Module/SendMoneyVerification/Application Logic/Service/SendMoneyVerificationServiceType.swift +++ b/GMERemittance/Module/SendMoneyVerification/Application Logic/Service/SendMoneyVerificationServiceType.swift @@ -14,19 +14,19 @@ protocol SendMoneyVerificationServiceType: class, SendMoneyVerificationSubmitApi protocol SendMoneyVerificationSubmitApi: ApiServiceType { - func submit(params: [String: String], success: @escaping (SendMoneySubmitModel?) -> (), failure: @escaping (Error) -> ()) + func submit(params: [String: String], success: @escaping (SendMoneySubmitModelContainer?) -> (), failure: @escaping (Error) -> ()) } extension SendMoneyVerificationSubmitApi { - func submit(params: [String: String], success: @escaping (SendMoneySubmitModel?) -> (), failure: @escaping (Error) -> ()) { + func submit(params: [String: String], success: @escaping (SendMoneySubmitModelContainer?) -> (), failure: @escaping (Error) -> ()) { let url = baseUrl + "mobile/sendmoney/dotransaction" self.auth.request(method: .post, url: url, params: params, success: { (response: SendMoneySubmitModelContainer) in if (response.errorCode ?? "") == "1" { let error = NSError.init(domain: "Network", code: 0, userInfo: [NSLocalizedDescriptionKey : response.message ?? ""]) failure(error) }else { - let model = response.data + let model = response success(model) } }) { (error) in diff --git a/GMERemittance/Module/SendMoneyVerification/User Interface/Presenter/SendMoneyVerificationPresenter.swift b/GMERemittance/Module/SendMoneyVerification/User Interface/Presenter/SendMoneyVerificationPresenter.swift index f39d01a5..217eabdc 100644 --- a/GMERemittance/Module/SendMoneyVerification/User Interface/Presenter/SendMoneyVerificationPresenter.swift +++ b/GMERemittance/Module/SendMoneyVerification/User Interface/Presenter/SendMoneyVerificationPresenter.swift @@ -38,7 +38,7 @@ extension SendMoneyVerificationPresenter: SendMoneyVerificationInteractorOutput self.view?.show(error: error.localizedDescription) } - func show(model: SendMoneySubmitModel?) { + func show(model: SendMoneySubmitModelContainer?) { self.view?.hideLoading() self.view?.show(model: model) } diff --git a/GMERemittance/Module/SendMoneyVerification/User Interface/View/SendMoneyVerificationViewController.swift b/GMERemittance/Module/SendMoneyVerification/User Interface/View/SendMoneyVerificationViewController.swift index dc6fcc09..b4ddc353 100644 --- a/GMERemittance/Module/SendMoneyVerification/User Interface/View/SendMoneyVerificationViewController.swift +++ b/GMERemittance/Module/SendMoneyVerification/User Interface/View/SendMoneyVerificationViewController.swift @@ -140,8 +140,11 @@ class SendMoneyVerificationViewController: UITableViewController { // MARK: SendMoneyVerificationViewInterface extension SendMoneyVerificationViewController: SendMoneyVerificationViewInterface { - func show(model: SendMoneySubmitModel?) { - print(model?.charge) + func show(model: SendMoneySubmitModelContainer?) { + + self.alertWithOk(message: model?.message , title: "Alert!", okTitle: "OK", style: UIAlertControllerStyle.alert, OkStyle: .default) { + print("go to reciept") + } } func show(error: String) { diff --git a/GMERemittance/Module/SendMoneyVerification/User Interface/View/SendMoneyVerificationViewInterface.swift b/GMERemittance/Module/SendMoneyVerification/User Interface/View/SendMoneyVerificationViewInterface.swift index 28bac250..16457c35 100644 --- a/GMERemittance/Module/SendMoneyVerification/User Interface/View/SendMoneyVerificationViewInterface.swift +++ b/GMERemittance/Module/SendMoneyVerification/User Interface/View/SendMoneyVerificationViewInterface.swift @@ -10,5 +10,5 @@ protocol SendMoneyVerificationViewInterface: class { func show(error: String) func showLoading() func hideLoading() - func show(model: SendMoneySubmitModel?) + func show(model: SendMoneySubmitModelContainer?) }