|
|
@ -142,7 +142,7 @@ extension RecipientsViewController { |
|
|
|
fetchTrigger: viewWillAppear, |
|
|
|
refreshTrigger: tableView.refreshControl!.rx.controlEvent(.valueChanged).asDriver(), |
|
|
|
// addTrigger: addRecipientTapGestureRecognizer.rx.event.mapToVoid().asDriverOnErrorJustComplete(), |
|
|
|
selectTrigger: tableView.rx.itemSelected.asDriver(), |
|
|
|
// selectTrigger: tableView.rx.itemSelected.asDriver(), |
|
|
|
editTrigger: editTrigger.asDriverOnErrorJustComplete(), |
|
|
|
deleteTrigger: deleteTrigger.asDriverOnErrorJustComplete(), |
|
|
|
needEditTrigger: needEditTrigger.asDriverOnErrorJustComplete(), |
|
|
@ -181,9 +181,10 @@ extension RecipientsViewController { |
|
|
|
.transactions.drive( |
|
|
|
onNext: {[weak self] _ in guard let `self` = self else { return } |
|
|
|
DispatchQueue.main.async { |
|
|
|
self.tableView.reloadData() |
|
|
|
self.viewWillLayoutSubviews() |
|
|
|
} |
|
|
|
self.tableView.reloadData() |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
).disposed(by: disposeBag) |
|
|
@ -193,10 +194,25 @@ extension RecipientsViewController { |
|
|
|
tableView.rx.items(cellIdentifier: "TransferListTableViewCell") |
|
|
|
) { [weak self] (_, element: RecentTransactions, cell: TransferListTableViewCell) in |
|
|
|
guard let `self` = self else { return } |
|
|
|
|
|
|
|
cell.selectionStyle = .none |
|
|
|
cell.setModel(with: element) |
|
|
|
cell.didTappedEditDetails = { [weak self] model in |
|
|
|
|
|
|
|
let recipientModel = Recipient( |
|
|
|
firstName: model?.user, |
|
|
|
middleName: "", |
|
|
|
lastName: "", |
|
|
|
localFirstName: model?.user, |
|
|
|
localMiddleName: "", |
|
|
|
localLastName: "", |
|
|
|
localFullName: model?.user, |
|
|
|
fullName: model?.user, |
|
|
|
address: "", |
|
|
|
city: "", |
|
|
|
email: "", |
|
|
|
mobile: "", |
|
|
|
idNumber: "" |
|
|
|
) |
|
|
|
self?.editTrigger.onNext(recipientModel) |
|
|
|
} |
|
|
|
// cell.hero.modifiers = [.fade, .scale(0.7)] |
|
|
|
// cell.delegate = self |
|
|
@ -267,24 +283,24 @@ extension RecipientsViewController: UITableViewDelegate { |
|
|
|
view.endEditing(true) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// MARK: - RecipientCellDelegate |
|
|
|
extension RecipientsViewController: RecipientCellDelegate { |
|
|
|
func edit(didSelect model: Recipient?) { |
|
|
|
guard let model = model else { return } |
|
|
|
self.editTrigger.onNext(model) |
|
|
|
} |
|
|
|
|
|
|
|
func delete(didSelect model: Recipient?) { |
|
|
|
self.alertWithOkCancel( |
|
|
|
message: "delete_recipient_confirmation_text".localized(), |
|
|
|
title: "alert_text".localized(), |
|
|
|
okAction: { |
|
|
|
guard let model = model else { return } |
|
|
|
self.deleteTrigger.onNext(model) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
// |
|
|
|
//// MARK: - RecipientCellDelegate |
|
|
|
//extension RecipientsViewController: RecipientCellDelegate { |
|
|
|
// func edit(didSelect model: Recipient?) { |
|
|
|
//// guard let model = model else { return } |
|
|
|
//// self.editTrigger.onNext(model) |
|
|
|
// } |
|
|
|
// |
|
|
|
// func delete(didSelect model: Recipient?) { |
|
|
|
// self.alertWithOkCancel( |
|
|
|
// message: "delete_recipient_confirmation_text".localized(), |
|
|
|
// title: "alert_text".localized(), |
|
|
|
// okAction: { |
|
|
|
// guard let model = model else { return } |
|
|
|
// self.deleteTrigger.onNext(model) |
|
|
|
// }) |
|
|
|
// } |
|
|
|
//} |
|
|
|
|
|
|
|
extension RecipientsViewController: UICollectionViewDelegate, UICollectionViewDataSource { |
|
|
|
|
|
|
|