Merge pull request #3131 from vladyslav-iosdev/#3118

QR scan button missing on the iOS version #3118
pull/3133/head
Hwee-Boon Yar 3 years ago committed by GitHub
commit cc3c56f7d3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 21
      AlphaWallet/Assets.xcassets/qrRounded.imageset/Contents.json
  2. BIN
      AlphaWallet/Assets.xcassets/qrRounded.imageset/qrRounded.pdf
  3. 14
      AlphaWallet/Core/Views/BlockieImageView.swift
  4. 4
      AlphaWallet/Extensions/UIBarButtonItem.swift
  5. 4
      AlphaWallet/Tokens/Coordinators/TokensCoordinator.swift
  6. 23
      AlphaWallet/Tokens/ViewControllers/TokensViewController.swift

@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "qrRounded.pdf",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

@ -76,3 +76,17 @@ class BlockieImageView: UIView {
}
}
extension BlockieImageView {
static var defaultBlockieImageView: BlockieImageView {
let imageView = BlockieImageView()
imageView.translatesAutoresizingMaskIntoConstraints = false
imageView.clipsToBounds = true
NSLayoutConstraint.activate([
imageView.widthAnchor.constraint(equalToConstant: 24),
imageView.heightAnchor.constraint(equalToConstant: 24),
])
return imageView
}
}

@ -29,6 +29,10 @@ extension UIBarButtonItem {
return .init(image: R.image.qr_code_icon(), style: .plain, target: target, action: selector)
}
static func myqrCodeBarButton(_ target: AnyObject, selector: Selector) -> UIBarButtonItem {
return .init(image: R.image.qrRounded(), style: .plain, target: target, action: selector)
}
static func addBarButton(_ target: AnyObject, selector: Selector) -> UIBarButtonItem {
return .init(image: R.image.add_hide_tokens(), style: .plain, target: target, action: selector)
}

@ -183,6 +183,10 @@ class TokensCoordinator: Coordinator {
extension TokensCoordinator: TokensViewControllerDelegate {
func myQRCodeButtonSelected(in viewController: UIViewController) {
delegate?.didPress(for: .request, server: config.anyEnabledServer(), inViewController: .none, in: self)
}
func blockieSelected(in viewController: UIViewController) {
delegate?.blockieSelected(in: self)
}

@ -11,6 +11,7 @@ protocol TokensViewControllerDelegate: AnyObject {
func didHide(token: TokenObject, in viewController: UIViewController)
func didTapOpenConsole(in viewController: UIViewController)
func scanQRCodeSelected(in viewController: UIViewController)
func myQRCodeButtonSelected(in viewController: UIViewController)
func blockieSelected(in viewController: UIViewController)
func walletConnectSelected(in viewController: UIViewController)
}
@ -100,17 +101,7 @@ class TokensViewController: UIViewController {
return collectionView
}()
private lazy var blockieImageView: BlockieImageView = {
let imageView = BlockieImageView()
imageView.translatesAutoresizingMaskIntoConstraints = false
imageView.clipsToBounds = true
NSLayoutConstraint.activate([
imageView.widthAnchor.constraint(equalToConstant: 24),
imageView.heightAnchor.constraint(equalToConstant: 24),
])
return imageView
}()
private lazy var blockieImageView: BlockieImageView = .defaultBlockieImageView
private var currentCollectiblesContractsDisplayed = [AlphaWallet.Address]()
private let searchController: UISearchController
private var consoleButton: UIButton {
@ -124,7 +115,6 @@ class TokensViewController: UIViewController {
return TableViewHeader(consoleButton: UIButton(type: .system), promptBackupWalletViewHolder: UIView())
}()
private var isSearchBarConfigured = false
private let hideTokenWidth: CGFloat = 170
private var bottomConstraint: NSLayoutConstraint!
private lazy var keyboardChecker = KeyboardChecker(self, resetHeightDefaultValue: 0, ignoreBottomSafeArea: true)
private let config: Config
@ -249,7 +239,10 @@ class TokensViewController: UIViewController {
setupFilteringWithKeyword()
navigationItem.rightBarButtonItem = UIBarButtonItem.qrCodeBarButton(self, selector: #selector(scanQRCodeButtonSelected))
navigationItem.rightBarButtonItems = [
UIBarButtonItem.myqrCodeBarButton(self, selector: #selector(myQRCodeButtonSelected)),
UIBarButtonItem.qrCodeBarButton(self, selector: #selector(scanQRCodeButtonSelected))
]
navigationItem.leftBarButtonItem = UIBarButtonItem(customView: blockieImageView)
walletConnectCoordinator.sessionsToURLServersMap.subscribe { [weak self] value in
@ -303,6 +296,10 @@ class TokensViewController: UIViewController {
delegate?.scanQRCodeSelected(in: self)
}
@objc private func myQRCodeButtonSelected(_ sender: UIBarButtonItem) {
delegate?.myQRCodeButtonSelected(in: self)
}
private func getWalletName() {
title = viewModel.walletDefaultTitle

Loading…
Cancel
Save