diff --git a/UnstoppableWallet/UnstoppableWallet/Modules/Cex/CexDeposit/CexDepositViewItemFactory.swift b/UnstoppableWallet/UnstoppableWallet/Modules/Cex/CexDeposit/CexDepositViewItemFactory.swift index ef4cf2d01b..f11bd19db4 100644 --- a/UnstoppableWallet/UnstoppableWallet/Modules/Cex/CexDeposit/CexDepositViewItemFactory.swift +++ b/UnstoppableWallet/UnstoppableWallet/Modules/Cex/CexDeposit/CexDepositViewItemFactory.swift @@ -8,8 +8,7 @@ class CexDepositViewItemFactory: IReceiveAddressViewItemFactory { let qrItem = ReceiveAddressModule.QrItem( address: item.address, - text: "deposit.qr_code_description".localized(item.coinCode), - imageUrl: item.imageUrl + text: "deposit.qr_code_description".localized(item.coinCode) ) sections.append([.qrItem(qrItem)]) diff --git a/UnstoppableWallet/UnstoppableWallet/Modules/Send/Platforms/BaseSendViewController.swift b/UnstoppableWallet/UnstoppableWallet/Modules/Send/Platforms/BaseSendViewController.swift index 15f553e135..4644b46a48 100644 --- a/UnstoppableWallet/UnstoppableWallet/Modules/Send/Platforms/BaseSendViewController.swift +++ b/UnstoppableWallet/UnstoppableWallet/Modules/Send/Platforms/BaseSendViewController.swift @@ -65,7 +65,9 @@ class BaseSendViewController: ThemeViewController, SectionsDataSource { title = "send.title".localized(viewModel.token.coin.code) - navigationItem.leftBarButtonItem = UIBarButtonItem(customView: iconImageView) + if (navigationController?.viewControllers.count ?? 0) == 1 { + navigationItem.leftBarButtonItem = UIBarButtonItem(customView: iconImageView) + } if feeSettingsFactory == nil { navigationItem.rightBarButtonItem = UIBarButtonItem(title: "button.cancel".localized, style: .plain, target: self, action: #selector(didTapCancel)) diff --git a/UnstoppableWallet/UnstoppableWallet/Modules/Send/Platforms/SendModule.swift b/UnstoppableWallet/UnstoppableWallet/Modules/Send/Platforms/SendModule.swift index 33b55617e9..52ac3361b4 100644 --- a/UnstoppableWallet/UnstoppableWallet/Modules/Send/Platforms/SendModule.swift +++ b/UnstoppableWallet/UnstoppableWallet/Modules/Send/Platforms/SendModule.swift @@ -154,7 +154,7 @@ class SendModule { feeCautionViewModel: feeCautionViewModel ) - return ThemeNavigationController(rootViewController: viewController) + return viewController } private static func viewController(token: Token, adapter: ISendBinanceAdapter) -> UIViewController? { @@ -246,7 +246,7 @@ class SendModule { feeWarningViewModel: feeWarningViewModel ) - return ThemeNavigationController(rootViewController: viewController) + return viewController } private static func viewController(token: Token, adapter: ISendZcashAdapter) -> UIViewController? { @@ -335,7 +335,7 @@ class SendModule { feeViewModel: feeViewModel ) - return ThemeNavigationController(rootViewController: viewController) + return viewController } } diff --git a/UnstoppableWallet/UnstoppableWallet/Modules/SendEvm/SendEvmModule.swift b/UnstoppableWallet/UnstoppableWallet/Modules/SendEvm/SendEvmModule.swift index e02efd27ad..727c1539b4 100644 --- a/UnstoppableWallet/UnstoppableWallet/Modules/SendEvm/SendEvmModule.swift +++ b/UnstoppableWallet/UnstoppableWallet/Modules/SendEvm/SendEvmModule.swift @@ -56,7 +56,7 @@ class SendEvmModule { recipientViewModel: recipientViewModel ) - return ThemeNavigationController(rootViewController: viewController) + return viewController } } diff --git a/UnstoppableWallet/UnstoppableWallet/Modules/SendEvm/SendEvmViewController.swift b/UnstoppableWallet/UnstoppableWallet/Modules/SendEvm/SendEvmViewController.swift index a0e07dd655..bdabd1abe2 100644 --- a/UnstoppableWallet/UnstoppableWallet/Modules/SendEvm/SendEvmViewController.swift +++ b/UnstoppableWallet/UnstoppableWallet/Modules/SendEvm/SendEvmViewController.swift @@ -50,7 +50,10 @@ class SendEvmViewController: ThemeViewController { title = "send.title".localized(viewModel.token.coin.code) - navigationItem.leftBarButtonItem = UIBarButtonItem(customView: iconImageView) + + if (navigationController?.viewControllers.count ?? 0) == 1 { + navigationItem.leftBarButtonItem = UIBarButtonItem(customView: iconImageView) + } navigationItem.rightBarButtonItem = UIBarButtonItem(title: "button.cancel".localized, style: .plain, target: self, action: #selector(didTapCancel)) navigationItem.backBarButtonItem = UIBarButtonItem(title: "", style: .plain, target: nil, action: nil) diff --git a/UnstoppableWallet/UnstoppableWallet/Modules/SendTron/SendTronModule.swift b/UnstoppableWallet/UnstoppableWallet/Modules/SendTron/SendTronModule.swift index 03232ae386..c38f66f08e 100644 --- a/UnstoppableWallet/UnstoppableWallet/Modules/SendTron/SendTronModule.swift +++ b/UnstoppableWallet/UnstoppableWallet/Modules/SendTron/SendTronModule.swift @@ -45,7 +45,7 @@ class SendTronModule { recipientViewModel: recipientViewModel ) - return ThemeNavigationController(rootViewController: viewController) + return viewController } } diff --git a/UnstoppableWallet/UnstoppableWallet/Modules/SendTron/SendTronViewController.swift b/UnstoppableWallet/UnstoppableWallet/Modules/SendTron/SendTronViewController.swift index a5445a0405..3f17059ef0 100644 --- a/UnstoppableWallet/UnstoppableWallet/Modules/SendTron/SendTronViewController.swift +++ b/UnstoppableWallet/UnstoppableWallet/Modules/SendTron/SendTronViewController.swift @@ -50,7 +50,9 @@ class SendTronViewController: ThemeViewController { title = "send.title".localized(viewModel.token.coin.code) - navigationItem.leftBarButtonItem = UIBarButtonItem(customView: iconImageView) + if (navigationController?.viewControllers.count ?? 0) == 1 { + navigationItem.leftBarButtonItem = UIBarButtonItem(customView: iconImageView) + } navigationItem.rightBarButtonItem = UIBarButtonItem(title: "button.cancel".localized, style: .plain, target: self, action: #selector(didTapCancel)) navigationItem.backBarButtonItem = UIBarButtonItem(title: "", style: .plain, target: nil, action: nil) diff --git a/UnstoppableWallet/UnstoppableWallet/Modules/Wallet/Receive/Address/ReceiveAddressModule.swift b/UnstoppableWallet/UnstoppableWallet/Modules/Wallet/Receive/Address/ReceiveAddressModule.swift index af7b680228..943ac7e701 100644 --- a/UnstoppableWallet/UnstoppableWallet/Modules/Wallet/Receive/Address/ReceiveAddressModule.swift +++ b/UnstoppableWallet/UnstoppableWallet/Modules/Wallet/Receive/Address/ReceiveAddressModule.swift @@ -32,7 +32,6 @@ extension ReceiveAddressModule { struct QrItem { let address: String let text: String - let imageUrl: String? } struct DescriptionItem { diff --git a/UnstoppableWallet/UnstoppableWallet/Modules/Wallet/Receive/Address/ReceiveAddressViewController.swift b/UnstoppableWallet/UnstoppableWallet/Modules/Wallet/Receive/Address/ReceiveAddressViewController.swift index b84c7ae924..0b5632bc4d 100644 --- a/UnstoppableWallet/UnstoppableWallet/Modules/Wallet/Receive/Address/ReceiveAddressViewController.swift +++ b/UnstoppableWallet/UnstoppableWallet/Modules/Wallet/Receive/Address/ReceiveAddressViewController.swift @@ -178,7 +178,7 @@ class ReceiveAddressViewController RowProtocol { + private func qrRow(address: String, text: String) -> RowProtocol { Row( id: "qr-code", dynamicHeight: { width in @@ -186,7 +186,6 @@ extension ReceiveAddressViewController: SectionsDataSource { }, bind: { [weak self] cell, _ in cell.set(qrCodeString: address, text: text) - cell.set(tokenUrl: imageUrl) cell.onTap = { self?.onTapCopy() } @@ -275,7 +274,7 @@ extension ReceiveAddressViewController: SectionsDataSource { viewItems.enumerated().forEach { index, viewItem in switch viewItem { case let .qrItem(item): - rows.append(qrRow(address: item.address, imageUrl: item.imageUrl, text: item.text)) + rows.append(qrRow(address: item.address, text: item.text)) case let .value(title, value, copyable): let rowInfo = RowInfo(index: index, count: viewItems.count) rows.append(valueRow(title: title, value: value, copyable: copyable, rowInfo: rowInfo)) diff --git a/UnstoppableWallet/UnstoppableWallet/Modules/Wallet/Receive/Address/ReceiveAddressViewItemFactory.swift b/UnstoppableWallet/UnstoppableWallet/Modules/Wallet/Receive/Address/ReceiveAddressViewItemFactory.swift index f2dae6e6d2..d61639897e 100644 --- a/UnstoppableWallet/UnstoppableWallet/Modules/Wallet/Receive/Address/ReceiveAddressViewItemFactory.swift +++ b/UnstoppableWallet/UnstoppableWallet/Modules/Wallet/Receive/Address/ReceiveAddressViewItemFactory.swift @@ -11,8 +11,7 @@ class ReceiveAddressViewItemFactory: IReceiveAddressViewItemFactory { let text = (item.watchAccount ? "deposit.qr_code_description.watch" : "deposit.qr_code_description").localized(item.coinCode) let qrItem = ReceiveAddressModule.QrItem( address: item.address.address, - text: text, - imageUrl: item.imageUrl + text: text ) sections.append([.qrItem(qrItem)]) diff --git a/UnstoppableWallet/UnstoppableWallet/Modules/Wallet/Receive/SelectCoin/ReceiveSelectCoinViewController.swift b/UnstoppableWallet/UnstoppableWallet/Modules/Wallet/Receive/SelectCoin/ReceiveSelectCoinViewController.swift index 5baf9b6c81..1759f066c9 100644 --- a/UnstoppableWallet/UnstoppableWallet/Modules/Wallet/Receive/SelectCoin/ReceiveSelectCoinViewController.swift +++ b/UnstoppableWallet/UnstoppableWallet/Modules/Wallet/Receive/SelectCoin/ReceiveSelectCoinViewController.swift @@ -94,7 +94,6 @@ extension ReceiveSelectCoinViewController: SectionsDataSource { image: .url(viewItem.imageUrl, placeholder: "placeholder_circle_32"), title: .body(viewItem.title), description: .subhead2(viewItem.description), - accessoryType: .disclosure, backgroundStyle: .transparent, autoDeselect: true, isLast: isLast diff --git a/UnstoppableWallet/UnstoppableWallet/Modules/Wallet/Token/DataSources/WalletTokenBalance/WalletTokenBalanceDataSource.swift b/UnstoppableWallet/UnstoppableWallet/Modules/Wallet/Token/DataSources/WalletTokenBalance/WalletTokenBalanceDataSource.swift index 5baca52e0b..768053f400 100644 --- a/UnstoppableWallet/UnstoppableWallet/Modules/Wallet/Token/DataSources/WalletTokenBalance/WalletTokenBalanceDataSource.swift +++ b/UnstoppableWallet/UnstoppableWallet/Modules/Wallet/Token/DataSources/WalletTokenBalance/WalletTokenBalanceDataSource.swift @@ -152,7 +152,7 @@ class WalletTokenBalanceDataSource: NSObject { case .wallet(let wallet): cell.actions[.send] = { [weak self] in if let viewController = SendModule.controller(wallet: wallet) { - self?.parentViewController?.present(viewController, animated: true) + self?.parentViewController?.present(ThemeNavigationController(rootViewController: viewController), animated: true) } } cell.actions[.swap] = { [weak self] in diff --git a/UnstoppableWallet/UnstoppableWallet/Modules/Wallet/TokenList/WalletTokenCell.swift b/UnstoppableWallet/UnstoppableWallet/Modules/Wallet/TokenList/WalletTokenCell.swift index 5c3f28cecc..0835cfc751 100644 --- a/UnstoppableWallet/UnstoppableWallet/Modules/Wallet/TokenList/WalletTokenCell.swift +++ b/UnstoppableWallet/UnstoppableWallet/Modules/Wallet/TokenList/WalletTokenCell.swift @@ -4,6 +4,7 @@ import SnapKit import ComponentKit class WalletTokenCell: UITableViewCell { + private let topSeparatorView = UIView() private let topView = BalanceTopView() private let separatorView = UIView() @@ -12,6 +13,13 @@ class WalletTokenCell: UITableViewCell { backgroundColor = .clear + contentView.addSubview(topSeparatorView) + topSeparatorView.snp.makeConstraints { maker in + maker.leading.top.trailing.equalToSuperview() + maker.height.equalTo(CGFloat.heightOneDp) + } + + topSeparatorView.backgroundColor = .themeSteel20 contentView.addSubview(topView) topView.snp.makeConstraints { maker in maker.leading.top.trailing.equalToSuperview() @@ -32,7 +40,8 @@ class WalletTokenCell: UITableViewCell { fatalError("not implemented") } - func bind(viewItem: BalanceViewItem, animated: Bool = false, duration: TimeInterval = 0.2, onTapError: (() -> ())?) { + func bind(viewItem: BalanceViewItem, first: Bool = false, animated: Bool = false, duration: TimeInterval = 0.2, onTapError: (() -> ())?) { + topSeparatorView.isHidden = !first topView.bind(viewItem: viewItem.topViewItem, onTapError: onTapError) topView.layoutIfNeeded() diff --git a/UnstoppableWallet/UnstoppableWallet/Modules/Wallet/TokenList/WalletTokenListService.swift b/UnstoppableWallet/UnstoppableWallet/Modules/Wallet/TokenList/WalletTokenListService.swift index 6af597c675..ad7b091488 100644 --- a/UnstoppableWallet/UnstoppableWallet/Modules/Wallet/TokenList/WalletTokenListService.swift +++ b/UnstoppableWallet/UnstoppableWallet/Modules/Wallet/TokenList/WalletTokenListService.swift @@ -301,14 +301,6 @@ extension WalletTokenListService { } } - func refresh() { - elementService.refresh() - - queue.async { - self.coinPriceService.refresh() - } - } - } extension WalletTokenListService { diff --git a/UnstoppableWallet/UnstoppableWallet/Modules/Wallet/TokenList/WalletTokenListViewController.swift b/UnstoppableWallet/UnstoppableWallet/Modules/Wallet/TokenList/WalletTokenListViewController.swift index e7241b07d1..d0ceb7ce94 100644 --- a/UnstoppableWallet/UnstoppableWallet/Modules/Wallet/TokenList/WalletTokenListViewController.swift +++ b/UnstoppableWallet/UnstoppableWallet/Modules/Wallet/TokenList/WalletTokenListViewController.swift @@ -17,7 +17,6 @@ class WalletTokenListViewController: ThemeSearchViewController { private let disposeBag = DisposeBag() private let tableView = UITableView(frame: .zero, style: .plain) - private let refreshControl = UIRefreshControl() private let spinner = HUDActivityView.create(with: .medium24) @@ -55,10 +54,6 @@ class WalletTokenListViewController: ThemeSearchViewController { navigationItem.backBarButtonItem = UIBarButtonItem(title: "", style: .plain, target: nil, action: nil) navigationItem.searchController?.searchBar.placeholder = "add_token.coin_name".localized - refreshControl.tintColor = .themeLeah - refreshControl.alpha = 0.6 - refreshControl.addTarget(self, action: #selector(onRefresh), for: .valueChanged) - view.addSubview(tableView) tableView.snp.makeConstraints { maker in maker.edges.equalToSuperview() @@ -71,6 +66,7 @@ class WalletTokenListViewController: ThemeSearchViewController { tableView.dataSource = self tableView.delegate = self tableView.registerCell(forClass: WalletTokenCell.self) + tableView.registerCell(forClass: EmptyCell.self) view.addSubview(spinner) spinner.snp.makeConstraints { make in @@ -129,24 +125,10 @@ class WalletTokenListViewController: ThemeSearchViewController { tableView.deselectCell(withCoordinator: transitionCoordinator, animated: animated) } - override func viewDidAppear(_ animated: Bool) { - super.viewDidAppear(animated) - - tableView.refreshControl = refreshControl - } - @objc func onTapClose() { dismiss(animated: true) } - @objc func onRefresh() { - viewModel.onTriggerRefresh() - - DispatchQueue.main.asyncAfter(deadline: .now() + 1) { [weak self] in - self?.refreshControl.endRefreshing() - } - } - @objc private func onTapRetry() { // todo } @@ -233,14 +215,15 @@ class WalletTokenListViewController: ThemeSearchViewController { updateIndexes.forEach { if let cell = tableView.cellForRow(at: IndexPath(row: $0, section: 0)) as? WalletTokenCell { - bind(cell: cell, viewItem: viewItems[$0], animated: true) + bind(cell: cell, viewItem: viewItems[$0], first: $0 == 0, animated: true) } } } - private func bind(cell: WalletTokenCell, viewItem: BalanceViewItem, animated: Bool = false) { + private func bind(cell: WalletTokenCell, viewItem: BalanceViewItem, first: Bool = false, animated: Bool = false) { cell.bind( viewItem: viewItem, + first: first, animated: animated, duration: animationDuration, onTapError: { [weak self] in @@ -273,15 +256,23 @@ class WalletTokenListViewController: ThemeSearchViewController { extension WalletTokenListViewController: UITableViewDataSource { func numberOfSections(in tableView: UITableView) -> Int { - 1 + 2 } func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { - viewItems.count + switch section { + case 0: return viewItems.count + case 1: return 1 + default: return 0 + } } func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { - tableView.dequeueReusableCell(withIdentifier: String(describing: WalletTokenCell.self), for: indexPath) + switch indexPath.section { + case 0: return tableView.dequeueReusableCell(withIdentifier: String(describing: WalletTokenCell.self), for: indexPath) + default: return tableView.dequeueReusableCell(withIdentifier: String(describing: EmptyCell.self), for: indexPath) + } + } } @@ -290,12 +281,15 @@ extension WalletTokenListViewController: UITableViewDelegate { func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) { if let cell = cell as? WalletTokenCell { - bind(cell: cell, viewItem: viewItems[indexPath.row]) + bind(cell: cell, viewItem: viewItems[indexPath.row], first: indexPath.row == 0) } } func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { - WalletTokenCell.height + switch indexPath.section { + case 0: return WalletTokenCell.height + default: return .margin32 + } } func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { diff --git a/UnstoppableWallet/UnstoppableWallet/Modules/Wallet/TokenList/WalletTokenListViewModel.swift b/UnstoppableWallet/UnstoppableWallet/Modules/Wallet/TokenList/WalletTokenListViewModel.swift index 00af53174d..88353791df 100644 --- a/UnstoppableWallet/UnstoppableWallet/Modules/Wallet/TokenList/WalletTokenListViewModel.swift +++ b/UnstoppableWallet/UnstoppableWallet/Modules/Wallet/TokenList/WalletTokenListViewModel.swift @@ -151,10 +151,6 @@ extension WalletTokenListViewModel { openSyncErrorRelay.accept((wallet, error)) } - func onTriggerRefresh() { - service.refresh() - } - func didSelect(item: BalanceViewItem) { if item.topViewItem.indefiniteSearchCircle || item.topViewItem.syncSpinnerProgress != nil { showSyncingRelay.accept(()) diff --git a/UnstoppableWallet/UnstoppableWallet/Modules/Wallet/Views/BalanceButtonsView.swift b/UnstoppableWallet/UnstoppableWallet/Modules/Wallet/Views/BalanceButtonsView.swift index 77c70022a6..f9e40051b2 100644 --- a/UnstoppableWallet/UnstoppableWallet/Modules/Wallet/Views/BalanceButtonsView.swift +++ b/UnstoppableWallet/UnstoppableWallet/Modules/Wallet/Views/BalanceButtonsView.swift @@ -71,7 +71,7 @@ class BalanceButtonsView: UIView { maker.width.equalTo(sendButton) } - receiveButton.set(style: .gray) + receiveButton.set(style: .gray, accessoryType: .icon(image: UIImage(named: "arrow_medium_2_down_left_24"))) receiveButton.setTitle("balance.receive".localized, for: .normal) receiveButton.addTarget(self, action: #selector(onReceive), for: .touchUpInside) diff --git a/UnstoppableWallet/UnstoppableWallet/Modules/Wallet/Views/BalanceTopView.swift b/UnstoppableWallet/UnstoppableWallet/Modules/Wallet/Views/BalanceTopView.swift index 335bc98cec..ad6fb0036b 100644 --- a/UnstoppableWallet/UnstoppableWallet/Modules/Wallet/Views/BalanceTopView.swift +++ b/UnstoppableWallet/UnstoppableWallet/Modules/Wallet/Views/BalanceTopView.swift @@ -5,7 +5,6 @@ import ComponentKit class BalanceTopView: UIView { static let height: CGFloat = 62 - static let expandedMargin: CGFloat = 6 private let coinIconView = BalanceCoinIconHolder() private let testnetImageView = UIImageView() diff --git a/UnstoppableWallet/UnstoppableWallet/Modules/Wallet/WalletViewItemFactory.swift b/UnstoppableWallet/UnstoppableWallet/Modules/Wallet/WalletViewItemFactory.swift index 82dee534a8..da6e27e4a6 100644 --- a/UnstoppableWallet/UnstoppableWallet/Modules/Wallet/WalletViewItemFactory.swift +++ b/UnstoppableWallet/UnstoppableWallet/Modules/Wallet/WalletViewItemFactory.swift @@ -7,9 +7,6 @@ class WalletViewItemFactory { private let minimumProgress = 10 private let infiniteProgress = 50 - init() { - } - private func topViewItem(item: WalletService.Item, balancePrimaryValue: BalancePrimaryValue, balanceHidden: Bool) -> BalanceTopViewItem { let state = item.state @@ -147,7 +144,7 @@ class WalletViewItemFactory { return [ .send: .enabled, .receive: .enabled, -// .swap: .enabled + .swap: .enabled ] case .evmAddress, .tronAddress: return [:] } diff --git a/UnstoppableWallet/UnstoppableWallet/UserInterface/Cells/QrCodeCell.swift b/UnstoppableWallet/UnstoppableWallet/UserInterface/Cells/QrCodeCell.swift index e266fc16d2..5ada854ced 100644 --- a/UnstoppableWallet/UnstoppableWallet/UserInterface/Cells/QrCodeCell.swift +++ b/UnstoppableWallet/UnstoppableWallet/UserInterface/Cells/QrCodeCell.swift @@ -73,6 +73,7 @@ class QrCodeCell: UITableViewCell { tokenWrapperView.isUserInteractionEnabled = false tokenWrapperView.cornerRadius = .cornerRadius8 tokenWrapperView.backgroundColor = .themeWhite + tokenWrapperView.clipsToBounds = true tokenWrapperView.addSubview(tokenImageView) tokenImageView.snp.makeConstraints { maker in @@ -80,6 +81,10 @@ class QrCodeCell: UITableViewCell { maker.size.equalTo(CGFloat.iconSize32) } + tokenImageView.contentMode = .scaleAspectFit + tokenImageView.image = UIImage(named: AppIcon.main.imageName) + tokenImageView.cornerRadius = 6 + wrapperView.addSubview(label) label.snp.makeConstraints { make in make.leading.trailing.equalToSuperview().inset(Self.textHorizontalMargin) @@ -107,13 +112,6 @@ class QrCodeCell: UITableViewCell { label.text = text } - func set(tokenUrl: String?) { - guard let tokenUrl else { - return - } - tokenImageView.setImage(withUrlString: tokenUrl, placeholder: nil) - } - } extension QrCodeCell {