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.

67 lines
2.5 KiB

6 years ago
6 years ago
6 years ago
6 years ago
  1. //
  2. // SendMoneyReceiptWireframe.swift
  3. // GMERemittance
  4. //
  5. // Created by gme_2 on 04/09/2018.
  6. //Copyright © 2018 Gobal Money Express Co. Ltd. All rights reserved.
  7. //
  8. import UIKit
  9. class SendMoneyReceiptWireframe {
  10. weak var view: UIViewController!
  11. var transactionId: String?
  12. var controlNo: String?
  13. var isFromTransactionReport = false
  14. var shouldShowCancelAmmendButton = false
  15. let mailboxwireFrame = MessageComposeWireframe()
  16. }
  17. extension SendMoneyReceiptWireframe: SendMoneyReceiptWireframeInput {
  18. var storyboardName: String {return "SendMoneyReceipt"}
  19. func getMainView() -> UIViewController {
  20. let service = SendMoneyReceiptService()
  21. let interactor = SendMoneyReceiptInteractor(service: service, transactionId: self.transactionId ?? "")
  22. let presenter = SendMoneyReceiptPresenter()
  23. let viewController = viewControllerFromStoryboard(of: SendMoneyReceiptViewController.self)
  24. viewController.controlNo = self.controlNo // todo: refractor later
  25. viewController.transactionId = self.transactionId // todo: refractor later
  26. viewController.shouldShowCancelAmmendButton = self.shouldShowCancelAmmendButton
  27. viewController.isFromTransactionHistory = self.isFromTransactionReport
  28. viewController.presenter = presenter
  29. interactor.output = presenter
  30. presenter.interactor = interactor
  31. presenter.wireframe = self
  32. presenter.view = viewController
  33. self.view = viewController
  34. return viewController
  35. }
  36. func openReciept(transactionId: String, source: UINavigationController) {
  37. self.transactionId = transactionId
  38. self.isFromTransactionReport = false
  39. self.pushMainView(in: source)
  40. }
  41. func openRecieptFromTransactionReport(controlNo: String, transactionId: String, shouldShowCancelAmmendButton: Bool, source: UINavigationController) {
  42. self.transactionId = transactionId
  43. self.isFromTransactionReport = true
  44. self.shouldShowCancelAmmendButton = shouldShowCancelAmmendButton
  45. self.controlNo = controlNo
  46. self.pushMainView(in: source)
  47. }
  48. func dismiss() {
  49. self.view.navigationController?.popViewController(animated: true)
  50. }
  51. func openMail(controlNO: String, transactionId: String, type: MailBoxType) {
  52. if let navigation = self.view.navigationController {
  53. mailboxwireFrame.openMail(controlNO: controlNO, transactionId: transactionId, type: type, source: navigation)
  54. }
  55. }
  56. }