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.

88 lines
1.8 KiB

6 years ago
6 years ago
6 years ago
6 years ago
  1. //
  2. // HomePresenter.swift
  3. // GMERemittance
  4. //
  5. // Created by gme_2 on 21/09/2018.
  6. //Copyright © 2018 Gobal Money Express Co. Ltd. All rights reserved.
  7. //
  8. import Foundation
  9. class HomePresenter {
  10. // MARK: Properties
  11. weak var view: HomeViewInterface?
  12. var interactor: HomeInteractorInput?
  13. var wireframe: HomeWireframeInput?
  14. // MARK: Converting entities
  15. }
  16. // MARK: Home module interface
  17. extension HomePresenter: HomeModuleInterface {
  18. func openTransactionHistory() {
  19. wireframe?.openTransactionHistory()
  20. }
  21. func openTodaysRate() {
  22. wireframe?.openTodaysRate()
  23. }
  24. func openTrackYourTransfer() {
  25. wireframe?.openTrackYourTransfer()
  26. }
  27. func openSendMoney() {
  28. wireframe?.openSendMoney()
  29. }
  30. func showAppUpdate() {
  31. wireframe?.showAppUpdate()
  32. }
  33. func showKyc() {
  34. self.wireframe?.openKyc()
  35. }
  36. func showPennyTest() {
  37. self.wireframe?.showPennyTest()
  38. }
  39. func showPennyTestSubmit() {
  40. self.wireframe?.showPennyTestSubmit()
  41. }
  42. func refreshData() {
  43. self.interactor?.fetchUserInfo()
  44. }
  45. func viewIsReady() {
  46. self.view?.showLoading()
  47. self.interactor?.fetchUserInfo()
  48. }
  49. func logout() {
  50. wireframe?.logOut()
  51. }
  52. }
  53. // MARK: Home interactor output interface
  54. extension HomePresenter: HomeInteractorOutput {
  55. func show(model: User) {
  56. self.view?.endRefreshing()
  57. self.view?.hideLoading()
  58. self.view?.show(model: model)
  59. }
  60. func show(error: Error) {
  61. self.view?.endRefreshing()
  62. self.view?.show(error: error.localizedDescription)
  63. }
  64. func show(panicError: Error) {
  65. self.view?.hideLoading()
  66. self.view?.show(panicError: panicError.localizedDescription)
  67. }
  68. }