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.
 
 
 
 

89 lines
2.6 KiB

//
// SendMoneyReceiptWireframe.swift
// GMERemittance
//
// Created by gme_2 on 04/09/2018.
//Copyright © 2018 Gobal Money Express Co. Ltd. All rights reserved.
//
import UIKit
class SendMoneyReceiptWireframe {
weak var view: UIViewController!
var transactionId: String?
var controlNo: String?
var isFromTransactionReport = false
var shouldShowCancelAmmendButton = false
let mailboxwireFrame = MessageComposeWireframe()
var receiptType: ReceiptType = .overseas
}
extension SendMoneyReceiptWireframe: SendMoneyReceiptWireframeInput {
var storyboardName: String {return "SendMoneyReceipt"}
func getMainView() -> UIViewController {
let service = SendMoneyReceiptService()
let interactor = SendMoneyReceiptInteractor(service: service, transactionId: self.transactionId ?? "")
let presenter = SendMoneyReceiptPresenter()
let viewController = viewControllerFromStoryboard(of: SendMoneyReceiptViewController.self)
viewController.controlNo = self.controlNo // todo: refractor later
viewController.transactionId = self.transactionId // todo: refractor later
viewController.shouldShowCancelAmmendButton = self.shouldShowCancelAmmendButton
viewController.isFromTransactionHistory = self.isFromTransactionReport
viewController.receiptType = receiptType
viewController.presenter = presenter
interactor.output = presenter
presenter.interactor = interactor
presenter.wireframe = self
presenter.view = viewController
self.view = viewController
return viewController
}
func openReciept(
type: ReceiptType = ReceiptType.overseas,
transactionId: String,
source: UINavigationController
) {
receiptType = type
isFromTransactionReport = false
self.transactionId = transactionId
self.pushMainView(in: source)
}
func openRecieptFromTransactionReport(
type: ReceiptType = ReceiptType.overseas,
controlNo: String,
transactionId: String,
shouldShowCancelAmmendButton: Bool,
source: UINavigationController
) {
receiptType = type
isFromTransactionReport = true
self.transactionId = transactionId
self.shouldShowCancelAmmendButton = shouldShowCancelAmmendButton
self.controlNo = controlNo
self.pushMainView(in: source)
}
func dismiss() {
self.view.navigationController?.popViewController(animated: true)
}
func openMail(controlNO: String, transactionId: String, type: MailBoxType) {
if let navigation = self.view.navigationController {
mailboxwireFrame.openMail(
controlNO: controlNO,
transactionId: transactionId,
type: type,
source: navigation
)
}
}
}