Browse Source

forced logout

pull/1/head
gme_2 6 years ago
parent
commit
8807e9134d
  1. 6
      GMERemittance/Module/Home/Application Logic/Interactor/HomeInteractor.swift
  2. 1
      GMERemittance/Module/Home/Application Logic/Interactor/HomeInteractorIO.swift
  3. 4
      GMERemittance/Module/Home/Application Logic/Service/HomeServiceType.swift
  4. 1
      GMERemittance/Module/Home/Module Interface/HomeModuleInterface.swift
  5. 8
      GMERemittance/Module/Home/User Interface/Presenter/HomePresenter.swift
  6. 6
      GMERemittance/Module/Home/User Interface/View/HomeViewController.swift
  7. 1
      GMERemittance/Module/Home/User Interface/View/HomeViewInterface.swift
  8. 4
      GMERemittance/Module/Home/User Interface/Wireframe/HomeWireframe.swift
  9. 1
      GMERemittance/Module/Home/User Interface/Wireframe/HomeWireframeInput.swift
  10. 1
      GMERemittance/Utility/AppConstants.swift

6
GMERemittance/Module/Home/Application Logic/Interactor/HomeInteractor.swift

@ -34,6 +34,12 @@ extension HomeInteractor: HomeInteractorInput {
self.output?.show(model: user)
}) { error in
if let _error = error as? NSError {
if _error.code == AppConstants.emergencyLogoutErrorCode {
self.output?.show(panicError: error)
}
return
}
self.output?.show(error: error)
}
}

1
GMERemittance/Module/Home/Application Logic/Interactor/HomeInteractorIO.swift

@ -13,4 +13,5 @@ protocol HomeInteractorInput: class {
protocol HomeInteractorOutput: class {
func show(model: User)
func show(error: Error)
func show(panicError: Error)
}

4
GMERemittance/Module/Home/Application Logic/Service/HomeServiceType.swift

@ -8,6 +8,8 @@
import Foundation
protocol HomeServiceType: class, UserInfoService {
}
@ -22,7 +24,7 @@ extension UserInfoService {
let url = baseUrl + "mobile/CustomerProfile"
auth.request(method: .post, url: url, params: param, success: { (response: UserContainer ) in
if (response.errorCode ?? "") == "1" {
let error = NSError.init(domain: "Network", code: 0, userInfo: [NSLocalizedDescriptionKey : response.message ?? ""])
let error = NSError.init(domain: "Network", code: AppConstants.emergencyLogoutErrorCode, userInfo: [NSLocalizedDescriptionKey : response.message ?? ""])
failure(error)
}else {
if let model = response.data {

1
GMERemittance/Module/Home/Module Interface/HomeModuleInterface.swift

@ -13,4 +13,5 @@ protocol HomeModuleInterface: class {
func openTrackYourTransfer()
func showKyc()
func refreshData()
func logout()
}

8
GMERemittance/Module/Home/User Interface/Presenter/HomePresenter.swift

@ -45,6 +45,10 @@ extension HomePresenter: HomeModuleInterface {
func refreshData() {
self.interactor?.fetchUserInfo()
}
func logout() {
wireframe?.logOut()
}
}
// MARK: Home interactor output interface
@ -59,4 +63,8 @@ extension HomePresenter: HomeInteractorOutput {
self.view?.endRefreshing()
self.view?.show(error: error.localizedDescription)
}
func show(panicError: Error) {
self.view?.show(panicError: panicError.localizedDescription)
}
}

6
GMERemittance/Module/Home/User Interface/View/HomeViewController.swift

@ -360,6 +360,12 @@ extension HomeViewController: HomeViewInterface {
self.alert(message: error)
}
func show(panicError: String) {
self.alert(message: panicError, title: "Warning") {
self.presenter?.logout()
}
}
func showLoading() {
self.showProgressHud()
}

1
GMERemittance/Module/Home/User Interface/View/HomeViewInterface.swift

@ -12,4 +12,5 @@ protocol HomeViewInterface: class {
func showLoading()
func hideLoading()
func endRefreshing()
func show(panicError: String)
}

4
GMERemittance/Module/Home/User Interface/Wireframe/HomeWireframe.swift

@ -66,4 +66,8 @@ extension HomeWireframe: HomeWireframeInput {
self.kycWireFrame.pushMainView(in: navigation)
}
}
func logOut() {
MainWireframe.logout()
}
}

1
GMERemittance/Module/Home/User Interface/Wireframe/HomeWireframeInput.swift

@ -14,4 +14,5 @@ protocol HomeWireframeInput: WireframeInput {
func openSendMoney()
func openTrackYourTransfer()
func openKyc()
func logOut()
}

1
GMERemittance/Utility/AppConstants.swift

@ -17,6 +17,7 @@ class AppConstants {
static let themeRedColor = UIColor.init(hex: "#da3832")
static let themeBlueColor = UIColor.init(hex: "#010538")
static let themWhiteColor = UIColor.init(hex: "#ffffff")
static let emergencyLogoutErrorCode = -1111
}
enum Devices {

Loading…
Cancel
Save