update review view after editing values
This commit is contained in:
parent
7694dd9506
commit
5f5fa8f331
|
@ -21,6 +21,7 @@ internal class SendCoordinator: BaseCoordinator {
|
||||||
private var paymentParser: PaymentParserProtocol
|
private var paymentParser: PaymentParserProtocol
|
||||||
|
|
||||||
private var payment: PaymentProtocol
|
private var payment: PaymentProtocol
|
||||||
|
private var reviewVC: ReviewVC?
|
||||||
|
|
||||||
internal init(navigationController: UINavigationController,
|
internal init(navigationController: UINavigationController,
|
||||||
iocContainer: IocContainerProtocol)
|
iocContainer: IocContainerProtocol)
|
||||||
|
@ -141,6 +142,10 @@ extension SendCoordinator: AddressVCDelegate {
|
||||||
|
|
||||||
func addressVCDelegateDoneButtonTouched(sender: AddressVC, address: String?) {
|
func addressVCDelegateDoneButtonTouched(sender: AddressVC, address: String?) {
|
||||||
self.payment.targetAddress = address
|
self.payment.targetAddress = address
|
||||||
|
|
||||||
|
reviewVC?.viewModel = getReviewViewModel()
|
||||||
|
reviewVC?.updateView()
|
||||||
|
|
||||||
self.navigationController.popViewController(animated: true)
|
self.navigationController.popViewController(animated: true)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -194,6 +199,10 @@ extension SendCoordinator: AmountVCDelegate {
|
||||||
|
|
||||||
func amountVCDelegateDoneButtonTouched(sender: AmountVC, amount: ZecInAtomicUnits) {
|
func amountVCDelegateDoneButtonTouched(sender: AmountVC, amount: ZecInAtomicUnits) {
|
||||||
self.payment.amount = amount
|
self.payment.amount = amount
|
||||||
|
|
||||||
|
reviewVC?.viewModel = getReviewViewModel()
|
||||||
|
reviewVC?.updateView()
|
||||||
|
|
||||||
self.navigationController.popViewController(animated: true)
|
self.navigationController.popViewController(animated: true)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -224,6 +233,10 @@ extension SendCoordinator: MemoVCDelegate {
|
||||||
|
|
||||||
func memoVCDelegateDoneButtonTouched(sender: MemoVC, memo: String?) {
|
func memoVCDelegateDoneButtonTouched(sender: MemoVC, memo: String?) {
|
||||||
self.payment.memo = memo
|
self.payment.memo = memo
|
||||||
|
|
||||||
|
reviewVC?.viewModel = getReviewViewModel()
|
||||||
|
reviewVC?.updateView()
|
||||||
|
|
||||||
self.navigationController.popViewController(animated: true)
|
self.navigationController.popViewController(animated: true)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -278,16 +291,20 @@ extension SendCoordinator: ReviewVCDelegate {
|
||||||
}
|
}
|
||||||
|
|
||||||
private func showReviewView() {
|
private func showReviewView() {
|
||||||
let vc = self.viewFactory.getReviewVC()
|
reviewVC = self.viewFactory.getReviewVC()
|
||||||
vc.delegate = self
|
if let vc = reviewVC {
|
||||||
vc.localizer = self.localizer
|
vc.delegate = self
|
||||||
|
vc.localizer = self.localizer
|
||||||
|
vc.viewModel = getReviewViewModel()
|
||||||
|
self.navigationController.pushViewController(vc, animated: true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private func getReviewViewModel() -> ReviewViewModel {
|
||||||
#warning("set view model")
|
#warning("set view model")
|
||||||
vc.viewModel = ReviewViewModel(amount: self.payment.amount ?? 0,
|
return ReviewViewModel(amount: self.payment.amount ?? 0,
|
||||||
fiatAmount: "22.08 CHF",
|
fiatAmount: "22.08 CHF",
|
||||||
receivingAddress: self.payment.targetAddress ?? "",
|
receivingAddress: self.payment.targetAddress ?? "",
|
||||||
memo: self.payment.memo)
|
memo: self.payment.memo)
|
||||||
|
|
||||||
self.navigationController.pushViewController(vc, animated: true)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,12 +54,14 @@ class ReviewVC: UIViewController {
|
||||||
self.summaryTableView.delegate = self
|
self.summaryTableView.delegate = self
|
||||||
}
|
}
|
||||||
|
|
||||||
private func updateView() {
|
public func updateView() {
|
||||||
guard let localizer = self.localizer else {
|
guard let localizer = self.localizer else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
self.titleLabel.text = localizer.localized("review.title")
|
self.titleLabel.text = localizer.localized("review.title")
|
||||||
|
|
||||||
|
self.summaryTableView.reloadData()
|
||||||
}
|
}
|
||||||
|
|
||||||
private var amountDescription: String {
|
private var amountDescription: String {
|
||||||
|
|
Loading…
Reference in New Issue