Browse Source

1. change swipe gesture only use at home view controller

2. add isPartnerChanged field
pull/1/head
InKwon James Kim 5 years ago
parent
commit
dec8ddde82
  1. 3
      GME Remit/Extensions/UIViewController+Ext.swift
  2. 3
      GME Remit/Modules/Home/User Interface/Presenter/HomePresenter.swift
  3. 13
      GME Remit/Modules/Home/User Interface/View/HomeViewController.swift
  4. 8
      GME Remit/Modules/Main/User Interface/Wireframe/MainWireframe.swift
  5. 4
      GME Remit/Modules/RecipientModules/Recipients/Application Logic/Model/Recipient/Recipient.swift
  6. 1
      GME Remit/Modules/RecipientModules/Recipients/User Interface/Presenter/RecipientsPresenter.swift
  7. 39
      GME Remit/Modules/RecipientModules/Recipients/User Interface/View/RecipientsViewController.swift
  8. 12
      GME Remit/Modules/RecipientModules/Recipients/User Interface/View/ViewModel/RecipientsViewModel.swift
  9. 1
      GME Remit/Modules/RecipientModules/Recipients/User Interface/Wireframe/RecipientsWireframe.swift
  10. 1
      GME Remit/Modules/RegisterModules/KYC/Kyc/User Interface/Presenter/KycPresenter.swift
  11. 3
      GME Remit/MultiLanguages/en.lproj/Localizable.strings

3
GME Remit/Extensions/UIViewController+Ext.swift

@ -16,6 +16,7 @@ extension UIViewController {
func setupPicturedNavBar(sideMenuAction: Selector? = nil) {
self.navigationController?.isNavigationBarHidden = false
self.navigationController?.navigationBar.isTranslucent = false
if let selector = sideMenuAction {
let leftButton = UIBarButtonItem(
image: UIImage(named: "ic_hamburger"),
@ -27,6 +28,8 @@ extension UIViewController {
self.navigationController?.navigationBar.tintColor = .themeRed
self.navigationItem.leftBarButtonItem = leftButton
self.navigationItem.leftBarButtonItem?.tintColor = UIColor.white
} else {
self.navigationItem.leftBarButtonItem = nil
}
self.navigationController?.navigationBar.tintColor = .white

3
GME Remit/Modules/Home/User Interface/Presenter/HomePresenter.swift

@ -75,6 +75,8 @@ extension HomePresenter: HomeModuleInterface {
extension HomePresenter: HomeInteractorOutput {
func setHotLine(with model: [HotLine]?) {
self.view?.endRefreshing()
self.view?.hideLoading()
self.view?.setHotLine(with: model)
}
@ -86,6 +88,7 @@ extension HomePresenter: HomeInteractorOutput {
func show(error: Error) {
self.view?.endRefreshing()
self.view?.hideLoading()
self.view?.show(error: error.localizedDescription)
}

13
GME Remit/Modules/Home/User Interface/View/HomeViewController.swift

@ -126,6 +126,8 @@ class HomeViewController: UIViewController {
override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)
self.navigationItem.title = ""
blobView.removeFromSuperview()
MainWireframe.shared?.isUseSwipeGesture = false
}
override func viewDidAppear(_ animated: Bool) {
@ -565,9 +567,7 @@ class HomeViewController: UIViewController {
// MARK: - Manage Message View
extension HomeViewController {
private func setMessageView() {
let redirect = GMEDB.shared.user.string(.redirectTo) ?? ""
switch redirect {
switch GMEDB.shared.user.string(.redirectTo) ?? "" {
case "autodebit":
setNavBar(isUseMenu: false)
showAutoDebitMessage()
@ -580,9 +580,6 @@ extension HomeViewController {
private func showAutoDebitMessage() {
showMessageView(isHidden: false)
(MainWireframe.shared?.window?.rootViewController as? LGSideMenuController)?
.isLeftViewSwipeGestureEnabled = false
messageTitleLabel.text = "add_auto_debit_account_text".localized()
messageLabel.text = "autodebit_account_required_message".localized()
messageLeftImageview.image = #imageLiteral(resourceName: "ic_home_verified")
@ -599,8 +596,6 @@ extension HomeViewController {
}
@objc private func tapMessageView(_ sender: UITapGestureRecognizer) {
blobView.removeFromSuperview()
let navigationVC = UINavigationController(rootViewController: AutoDebitWireframe().getMainView())
tabBarController?.present(navigationVC, animated: true, completion: nil)
}
@ -634,6 +629,8 @@ extension HomeViewController {
let selector = #selector(self.showSideMenu)
isUseMenu ? setupPicturedNavBar(sideMenuAction: selector) : setupPicturedNavBar(sideMenuAction: nil)
MainWireframe.shared?.isUseSwipeGesture = isUseMenu
}
@objc func showSideMenu() {

8
GME Remit/Modules/Main/User Interface/Wireframe/MainWireframe.swift

@ -7,10 +7,18 @@
import Foundation
import UIKit
import LGSideMenuController
class MainWireframe {
static var shared: MainWireframe? = MainWireframe()
weak var view: UIViewController!
var isUseSwipeGesture = true {
didSet {
let sideMenuVC = (MainWireframe.shared?.window?.rootViewController as? LGSideMenuController)
sideMenuVC?.isLeftViewSwipeGestureEnabled = isUseSwipeGesture
}
}
}
extension MainWireframe: MainWireframeInput {

4
GME Remit/Modules/RecipientModules/Recipients/Application Logic/Model/Recipient/Recipient.swift

@ -56,6 +56,8 @@ struct Recipient: Mappable {
var nativeCountryCode: String?
var nativeCountryID: String?
var isPartnerChanged: String?
init?(map: Map) {}
init() {
agent = AgentModel()
@ -132,7 +134,7 @@ struct Recipient: Mappable {
nativeCountry <- map["nativeCountry"]
nativeCountryCode <- map["nativeCountryCode"]
nativeCountryID <- map["nativeCountryID"]
isPartnerChanged <- map["isPartnerChanged"]
}
func serialize() -> [String : String] {

1
GME Remit/Modules/RecipientModules/Recipients/User Interface/Presenter/RecipientsPresenter.swift

@ -31,6 +31,7 @@ extension RecipientsPresenter: RecipientsModuleInterface {
}
func openEditRecipient(who recipient: Recipient, with delegate: SetupRecipientDelegate) {
viewModel?.progress(isShow: true)
wireframe?.openEditRecipient(who: recipient, with: delegate)
}

39
GME Remit/Modules/RecipientModules/Recipients/User Interface/View/RecipientsViewController.swift

@ -81,6 +81,9 @@ extension RecipientsViewController {
private func setup() {
viewAddRecipient.hero.id = "setupRecipient"
navigationController?.interactivePopGestureRecognizer?.delegate = self
navigationController?.interactivePopGestureRecognizer?.isEnabled = true
// all setup should be done here
setBinding()
tableView.separatorColor = .themeBorderColor
@ -120,6 +123,15 @@ extension RecipientsViewController {
let output = viewModel.transform(input: input)
output
.recipients
.map { $0.count == 0 }
.drive(onNext: {
self.searchBar.isHidden = $0
self.labelSwipeInfo.isHidden = $0
})
.disposed(by: disposeBag)
output
.recipients
.drive(
@ -159,6 +171,23 @@ extension RecipientsViewController {
})
.disposed(by: disposeBag)
output
.isPartnerChanged
.drive(
onNext: {
DispatchQueue.main.async {
self.alertWithOkCancel(
type: .normal,
message: "recipient_bank_update_prompt_text".localized(),
okTitle: "ok_text".localized(),
cancelTitle: "cancel_text".localized(),
okAction: { needEditTrigger.onNext(()) },
cancelAction: nil
)
}
})
.disposed(by: disposeBag)
tableView.rx.setDelegate(self).disposed(by: disposeBag)
}
}
@ -193,3 +222,13 @@ extension RecipientsViewController: UITableViewDelegate {
return [delete, edit]
}
}
// MARK: - UIGestureRecognizerDelegate
extension RecipientsViewController: UIGestureRecognizerDelegate {
func gestureRecognizer(
_ gestureRecognizer: UIGestureRecognizer,
shouldBeRequiredToFailBy otherGestureRecognizer: UIGestureRecognizer
) -> Bool {
return true
}
}

12
GME Remit/Modules/RecipientModules/Recipients/User Interface/View/ViewModel/RecipientsViewModel.swift

@ -25,6 +25,7 @@ class RecipientsViewModel: ViewModelType {
struct Output {
let recipients: Driver<[Recipient]>
let isNeedEdit: Driver<Void>
let isPartnerChanged: Driver<Void>
let isError: Driver<Error>
let isProgress: Driver<Bool>
}
@ -46,6 +47,7 @@ class RecipientsViewModel: ViewModelType {
private var selectedRecipient: Recipient?
private var isNeedEditRecipient = PublishSubject<Void>()
private var isPartnerChanged = PublishSubject<Void>()
func transform(input: Input) -> Output {
input
@ -62,7 +64,6 @@ class RecipientsViewModel: ViewModelType {
return recipients.filter {( $0.fullName?.lowercased().contains(searchText.lowercased()) ?? false )}
}.asDriverOnErrorJustComplete()
// Select
input.selectTrigger
.withLatestFrom(recipients) { (indexPath, recipients) -> Recipient in
return recipients[indexPath.row]
@ -75,12 +76,16 @@ class RecipientsViewModel: ViewModelType {
return
}
if self.selectedRecipient?.isPartnerChanged == "1" {
self.isPartnerChanged.onNext(())
return
}
let accounts = try? self.accountsLinker.value()
self.presenter?.openSelectAccount(with: accounts ?? [])
})
.disposed(by: disposeBag)
// Edit
input.editTrigger
.withLatestFrom(recipients) { (indexPath, recipients) -> Recipient in
return recipients[indexPath.row]
@ -88,7 +93,6 @@ class RecipientsViewModel: ViewModelType {
.drive(onNext: { self.presenter?.openEditRecipient(who: $0, with: self) })
.disposed(by: disposeBag)
// Delete
input.deleteTrigger
.withLatestFrom(recipients) { (indexPath, recipients) -> Recipient in
return recipients[indexPath.row]
@ -96,7 +100,6 @@ class RecipientsViewModel: ViewModelType {
.drive(onNext: { self.presenter?.deleteRecipient(who: $0) })
.disposed(by: disposeBag)
// Add
input.addTrigger
.drive(onNext: { self.presenter?.openAddRecipient(with: self) })
.disposed(by: disposeBag)
@ -111,6 +114,7 @@ class RecipientsViewModel: ViewModelType {
return Output(
recipients: recipients,
isNeedEdit: isNeedEditRecipient.asDriverOnErrorJustComplete(),
isPartnerChanged: isPartnerChanged.asDriverOnErrorJustComplete(),
isError: errorLinker.asDriverOnErrorJustComplete(),
isProgress: progressLinker.asDriverOnErrorJustComplete()
)

1
GME Remit/Modules/RecipientModules/Recipients/User Interface/Wireframe/RecipientsWireframe.swift

@ -48,7 +48,6 @@ extension RecipientsWireframe: RecipientsWireframeInput {
SetupRecipientWireframe().openNew(with: delegate, on: view) {
self.output?.openedSetupRecipient()
}
}
func openEditRecipient(who recipient: Recipient, with delegate: SetupRecipientDelegate) {

1
GME Remit/Modules/RegisterModules/KYC/Kyc/User Interface/Presenter/KycPresenter.swift

@ -34,6 +34,7 @@ extension KycPresenter: KycModuleInterface {
extension KycPresenter: KycInteractorOutput {
func submitSuccess() {
self.view?.hideLoading()
wireframe?.goToPennyTest()
}

3
GME Remit/MultiLanguages/en.lproj/Localizable.strings

@ -595,9 +595,10 @@
"reason_placeholder_text" = "Select Transfer Reason";
"recipient_add_success_message_text" = "Do you want to send money to\n xxx?";
"recipient_profile_update_prompt_text" = "Recipient profile update is necessary inorder to proceed. Do you want to update it now?";
"recipient_profile_update_prompt_text" = "Your recipient information is not up-to-date. Do you want to update it now?";
"general_length_error_text" = "It must be at least xxx and less than ooo characters.";
"recipient_bank_update_prompt_text" = "Your selected bank is not currently available at moment. Please select another bank in order to proceed.";
// Indicator
"loading_text" = "Loading";
Loading…
Cancel
Save