Skip to content

Commit

Permalink
fix your wallets presentable
Browse files Browse the repository at this point in the history
  • Loading branch information
ERussel committed Jan 7, 2025
1 parent 57818bb commit 0ff97bd
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 14 deletions.
6 changes: 3 additions & 3 deletions novawallet/Common/Protocols/YourWalletsPresentable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ protocol YourWalletsPresentable {
address: AccountAddress?,
delegate: YourWalletsDelegate
)
func hideYourWallets(from view: ControllerBackedProtocol?)
func hideYourWallets(from view: YourWalletsPresentationProtocol)
}

extension YourWalletsPresentable {
Expand All @@ -32,7 +32,7 @@ extension YourWalletsPresentable {
view?.controller.present(viewController.controller, animated: true)
}

func hideYourWallets(from view: ControllerBackedProtocol?) {
view?.controller.dismiss(animated: true)
func hideYourWallets(from view: YourWalletsPresentationProtocol) {
view.controller.dismiss(animated: true)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -291,14 +291,18 @@ extension StakingSetupProxyPresenter: ModalPickerViewControllerDelegate {
}

extension StakingSetupProxyPresenter: YourWalletsDelegate {
func didSelectYourWallet(address: AccountAddress) {
wireframe.hideYourWallets(from: view)
func yourWallets(
selectionView: YourWalletsPresentationProtocol,
didSelect address: AccountAddress
) {
wireframe.hideYourWallets(from: selectionView)

view?.didReceiveYourWallets(state: .inactive)
updateRecepientAddress(address)
provideInputViewModel()
}

func didCloseYourWalletSelection() {
func yourWalletsDidClose(selectionView _: YourWalletsPresentationProtocol) {
view?.didReceiveYourWallets(state: .inactive)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -512,15 +512,20 @@ extension TransferSetupPresenter: AddressScanDelegate {
}

extension TransferSetupPresenter: YourWalletsDelegate {
func didSelectYourWallet(address: AccountAddress) {
wireframe.hideYourWallets(from: view)
func yourWallets(
selectionView: YourWalletsPresentationProtocol,
didSelect address: AccountAddress
) {
wireframe.hideYourWallets(from: selectionView)

childPresenter?.changeRecepient(address: address)
view?.changeYourWalletsViewState(.inactive)
recipientAddress = .address(address)
}

func didCloseYourWalletSelection() {
func yourWalletsDidClose(
selectionView _: YourWalletsPresentationProtocol
) {
view?.changeYourWalletsViewState(.inactive)
}
}
12 changes: 10 additions & 2 deletions novawallet/Modules/YourWallets/YourWalletsPresenter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -161,11 +161,19 @@ extension YourWalletsPresenter: YourWalletsPresenterProtocol {
func didSelect(viewModel: YourWalletsCellViewModel.CommonModel) {
selectedAddress = viewModel.displayAddress.address
updateSelectedCell()
delegate?.didSelectYourWallet(address: viewModel.displayAddress.address)

if let view {
delegate?.yourWallets(
selectionView: view,
didSelect: viewModel.displayAddress.address
)
}
}

func viewWillDisappear() {
delegate?.didCloseYourWalletSelection()
if let view {
delegate?.yourWalletsDidClose(selectionView: view)
}
}
}

Expand Down
8 changes: 5 additions & 3 deletions novawallet/Modules/YourWallets/YourWalletsProtocols.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import UIKit

protocol YourWalletsViewProtocol: ControllerBackedProtocol {
protocol YourWalletsPresentationProtocol: ControllerBackedProtocol {}

protocol YourWalletsViewProtocol: YourWalletsPresentationProtocol {
func update(viewModel: [YourWalletsViewSectionModel])
func update(header: String)
func calculateEstimatedHeight(sections: Int, items: Int) -> CGFloat
Expand All @@ -13,8 +15,8 @@ protocol YourWalletsPresenterProtocol: AnyObject {
}

protocol YourWalletsDelegate: AnyObject {
func didSelectYourWallet(address: AccountAddress)
func didCloseYourWalletSelection()
func yourWallets(selectionView: YourWalletsPresentationProtocol, didSelect address: AccountAddress)
func yourWalletsDidClose(selectionView: YourWalletsPresentationProtocol)
}

extension YourWalletsDelegate {
Expand Down

0 comments on commit 0ff97bd

Please sign in to comment.