Merge pull request #4088 from eviltofu/#3819_Update_secondary_button_style_in_Verify_seed_phrase_screen

Created VerticalButtonsBar for VerifySeedPhraseViewController, renamed ButtonsBar to HorizontalButtonsBar
pull/4092/head
Jerome Chan 3 years ago committed by GitHub
commit 97315f486f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 12
      AlphaWallet.xcodeproj/project.pbxproj
  2. 2
      AlphaWallet/Activities/ViewControllers/ActivityViewController.swift
  3. 2
      AlphaWallet/Alerts/ViewControllers/EditPriceAlertViewController.swift
  4. 6
      AlphaWallet/Browser/ViewControllers/EditMyDappViewController.swift
  5. 4
      AlphaWallet/Browser/ViewControllers/SwitchChainRequestViewController.swift
  6. 4
      AlphaWallet/Core/ViewControllers/PromptViewController.swift
  7. 28
      AlphaWallet/Core/Views/ButtonsBar/ButtonsBar.swift
  8. 4
      AlphaWallet/Core/Views/ButtonsBar/ToolButtonsBarView.swift
  9. 108
      AlphaWallet/Core/Views/ButtonsBar/VerticalButtonsBar.swift
  10. 14
      AlphaWallet/Foundation/Repeat.swift
  11. 6
      AlphaWallet/Market/ViewControllers/ImportMagicTokenViewController.swift
  12. 6
      AlphaWallet/Redeem/ViewControllers/RedeemTokenCardQuantitySelectionViewController.swift
  13. 6
      AlphaWallet/Sell/ViewControllers/EnterSellTokensCardPriceQuantityViewController.swift
  14. 6
      AlphaWallet/Sell/ViewControllers/SetSellTokensCardExpiryDateViewController.swift
  15. 4
      AlphaWallet/Settings/ViewControllers/CheckTransactionStateViewController.swift
  16. 4
      AlphaWallet/Settings/ViewControllers/CollectUsersEmailViewController.swift
  17. 4
      AlphaWallet/Settings/ViewControllers/SaveCustomRpcBrowseViewController.swift
  18. 2
      AlphaWallet/Settings/Views/ExportJsonKeystoreFileView.swift
  19. 2
      AlphaWallet/Settings/Views/ExportJsonKeystorePasswordView.swift
  20. 2
      AlphaWallet/Settings/Views/SaveCustomRpcManualEntryView.swift
  21. 6
      AlphaWallet/Tokens/ViewControllers/NewTokenViewController.swift
  22. 2
      AlphaWallet/Tokens/ViewControllers/NonFungibleTokenViewController.swift
  23. 6
      AlphaWallet/Tokens/ViewControllers/TokenInstanceActionViewController.swift
  24. 2
      AlphaWallet/Tokens/ViewControllers/TokenViewController.swift
  25. 4
      AlphaWallet/Tokens/ViewControllers/TokensCardViewController.swift
  26. 6
      AlphaWallet/Transactions/ViewControllers/TransactionViewController.swift
  27. 2
      AlphaWallet/Transfer/Collectibles/ViewControllers/TransferTokenBatchCardsViaWalletAddressViewController.swift
  28. 6
      AlphaWallet/Transfer/ViewControllers/ChooseTokenCardTransferModeViewController.swift
  29. 2
      AlphaWallet/Transfer/ViewControllers/SendTransactionErrorViewController.swift
  30. 2
      AlphaWallet/Transfer/ViewControllers/SendViewController.swift
  31. 6
      AlphaWallet/Transfer/ViewControllers/SetTransferTokensCardExpiryDateViewController.swift
  32. 4
      AlphaWallet/Transfer/ViewControllers/SignatureConfirmationViewController.swift
  33. 4
      AlphaWallet/Transfer/ViewControllers/TransactionConfirmationViewController.swift
  34. 6
      AlphaWallet/Transfer/ViewControllers/TransactionInProgressViewController.swift
  35. 6
      AlphaWallet/Transfer/ViewControllers/TransferTokensCardQuantitySelectionViewController.swift
  36. 6
      AlphaWallet/Transfer/ViewControllers/TransferTokensCardViaWalletAddressViewController.swift
  37. 4
      AlphaWallet/UI/WhereIsWalletAddressFoundOverlayView.swift
  38. 10
      AlphaWallet/Wallet/ViewControllers/CreateInitialWalletViewController.swift
  39. 6
      AlphaWallet/Wallet/ViewControllers/ElevateWalletSecurityViewController.swift
  40. 4
      AlphaWallet/Wallet/ViewControllers/EnterKeystorePasswordViewController.swift
  41. 4
      AlphaWallet/Wallet/ViewControllers/ImportWalletViewController.swift
  42. 6
      AlphaWallet/Wallet/ViewControllers/KeystoreBackupIntroductionViewController.swift
  43. 2
      AlphaWallet/Wallet/ViewControllers/RenameWalletViewController.swift
  44. 2
      AlphaWallet/Wallet/ViewControllers/SeedPhraseBackupIntroductionViewController.swift
  45. 2
      AlphaWallet/Wallet/ViewControllers/ShowSeedPhraseIntroductionViewController.swift
  46. 6
      AlphaWallet/Wallet/ViewControllers/ShowSeedPhraseViewController.swift
  47. 37
      AlphaWallet/Wallet/ViewControllers/VerifySeedPhraseViewController.swift
  48. 4
      AlphaWallet/WalletConnect/ViewController/WalletConnectConnectionTimeoutViewController.swift
  49. 2
      AlphaWallet/WalletConnect/ViewController/WalletConnectSessionViewController.swift
  50. 4
      AlphaWallet/WalletConnect/ViewController/WalletConnectToSessionViewController.swift
  51. 22
      AlphaWalletTests/Foundation/RepeatTests.swift

@ -36,10 +36,13 @@
02B01A6327B3CD6F00379A00 /* ButtonsBarStyle.swift in Sources */ = {isa = PBXBuildFile; fileRef = 02B01A6227B3CD6F00379A00 /* ButtonsBarStyle.swift */; };
02C7AF6F2770C405005367EE /* RpcNetworkTestCase.swift in Sources */ = {isa = PBXBuildFile; fileRef = 02C7AF6E2770C405005367EE /* RpcNetworkTestCase.swift */; };
02C91C822770143E00EB10FB /* AvailableRpcNetwork.swift in Sources */ = {isa = PBXBuildFile; fileRef = 02C91C812770143E00EB10FB /* AvailableRpcNetwork.swift */; };
02D7F8CE27D8AAC900CA1140 /* VerticalButtonsBar.swift in Sources */ = {isa = PBXBuildFile; fileRef = 02D7F8CD27D8AAC900CA1140 /* VerticalButtonsBar.swift */; };
02D8BF89277D56F700EEE8E9 /* SaveCustomRpcManualEntryViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 02D8BF88277D56F700EEE8E9 /* SaveCustomRpcManualEntryViewModel.swift */; };
02D8BF8B277D570900EEE8E9 /* SaveCustomRpcManualEntryViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 02D8BF8A277D570900EEE8E9 /* SaveCustomRpcManualEntryViewController.swift */; };
02D8BF8D277D572600EEE8E9 /* SaveCustomRpcManualEntryView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 02D8BF8C277D572600EEE8E9 /* SaveCustomRpcManualEntryView.swift */; };
02E7B6782795352E00311218 /* Formatter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 02E7B6772795352E00311218 /* Formatter.swift */; };
02EFD0FA27DF0785008B5808 /* Repeat.swift in Sources */ = {isa = PBXBuildFile; fileRef = 02EFD0F927DF0785008B5808 /* Repeat.swift */; };
02EFD0FC27DF0815008B5808 /* RepeatTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 02EFD0FB27DF0815008B5808 /* RepeatTests.swift */; };
02F4E8B627715EA000D89C19 /* SaveCustomRpcOverallViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 02F4E8B527715EA000D89C19 /* SaveCustomRpcOverallViewController.swift */; };
02F4E8B827715EC100D89C19 /* SaveCustomRpcOverallView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 02F4E8B727715EC100D89C19 /* SaveCustomRpcOverallView.swift */; };
02F4E8BC2771763800D89C19 /* SaveCustomRpcOverallModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 02F4E8BB2771763800D89C19 /* SaveCustomRpcOverallModel.swift */; };
@ -1133,10 +1136,13 @@
02B01A6227B3CD6F00379A00 /* ButtonsBarStyle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ButtonsBarStyle.swift; sourceTree = "<group>"; };
02C7AF6E2770C405005367EE /* RpcNetworkTestCase.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RpcNetworkTestCase.swift; sourceTree = "<group>"; };
02C91C812770143E00EB10FB /* AvailableRpcNetwork.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AvailableRpcNetwork.swift; sourceTree = "<group>"; };
02D7F8CD27D8AAC900CA1140 /* VerticalButtonsBar.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VerticalButtonsBar.swift; sourceTree = "<group>"; };
02D8BF88277D56F700EEE8E9 /* SaveCustomRpcManualEntryViewModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SaveCustomRpcManualEntryViewModel.swift; sourceTree = "<group>"; };
02D8BF8A277D570900EEE8E9 /* SaveCustomRpcManualEntryViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SaveCustomRpcManualEntryViewController.swift; sourceTree = "<group>"; };
02D8BF8C277D572600EEE8E9 /* SaveCustomRpcManualEntryView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SaveCustomRpcManualEntryView.swift; sourceTree = "<group>"; };
02E7B6772795352E00311218 /* Formatter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Formatter.swift; sourceTree = "<group>"; };
02EFD0F927DF0785008B5808 /* Repeat.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Repeat.swift; sourceTree = "<group>"; };
02EFD0FB27DF0815008B5808 /* RepeatTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RepeatTests.swift; sourceTree = "<group>"; };
02F4E8B527715EA000D89C19 /* SaveCustomRpcOverallViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SaveCustomRpcOverallViewController.swift; sourceTree = "<group>"; };
02F4E8B727715EC100D89C19 /* SaveCustomRpcOverallView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SaveCustomRpcOverallView.swift; sourceTree = "<group>"; };
02F4E8BB2771763800D89C19 /* SaveCustomRpcOverallModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SaveCustomRpcOverallModel.swift; sourceTree = "<group>"; };
@ -2954,6 +2960,7 @@
61FC5ED01FCFBDEB00CCB12A /* EtherNumberFormatterTests.swift */,
73ED85A82034C42D00593BF3 /* StringFormatterTest.swift */,
0224D26627980664003D022A /* FormatterTests.swift */,
02EFD0FB27DF0815008B5808 /* RepeatTests.swift */,
);
path = Foundation;
sourceTree = "<group>";
@ -3093,6 +3100,7 @@
5E7C7AE608A39793F8BA3911 /* Eip681Parser.swift */,
5E7C7C4A58D1A4361E4F66E0 /* AddressOrEnsName.swift */,
02E7B6772795352E00311218 /* Formatter.swift */,
02EFD0F927DF0785008B5808 /* Repeat.swift */,
);
path = Foundation;
sourceTree = "<group>";
@ -4968,6 +4976,7 @@
879F185D26E74512000602F2 /* ButtonsBarBackgroundView.swift */,
879F185F26E74543000602F2 /* ToolButtonsBarView.swift */,
02B01A6227B3CD6F00379A00 /* ButtonsBarStyle.swift */,
02D7F8CD27D8AAC900CA1140 /* VerticalButtonsBar.swift */,
);
path = ButtonsBar;
sourceTree = "<group>";
@ -6449,6 +6458,7 @@
875F867F27ABC7A60071ABD1 /* NonFungibleTraitViewModel.swift in Sources */,
87ED843B24C564B5001A3747 /* NewTokenCoordinator.swift in Sources */,
8712A38326F475830009C376 /* PriceAlert.swift in Sources */,
02EFD0FA27DF0785008B5808 /* Repeat.swift in Sources */,
5E7C73092E428F9519787284 /* Core.swift in Sources */,
5E7C70397E7E3A9C88E995B1 /* WKWebViewExtension.swift in Sources */,
5E7C74E1ECC13899FA369E1C /* ClearDappBrowserCacheCoordinator.swift in Sources */,
@ -6671,6 +6681,7 @@
87584FAC27EB8139006A7CD1 /* OpenSeaNetworkProvider.swift in Sources */,
5E7C71FA0D6A918598005EF3 /* SendTransactionError.swift in Sources */,
5E7C715B5921162B65A9A706 /* PromptViewController.swift in Sources */,
02D7F8CE27D8AAC900CA1140 /* VerticalButtonsBar.swift in Sources */,
02D8BF8D277D572600EEE8E9 /* SaveCustomRpcManualEntryView.swift in Sources */,
5E7C785C39CC8243BEC1219C /* PromptViewModel.swift in Sources */,
87509A6026F8D63600D3EE85 /* ModalViewController.swift in Sources */,
@ -6751,6 +6762,7 @@
29BDF1961FEE43F40023A45F /* UnconfirmedTransaction.swift in Sources */,
29E14FD71F7F490000185568 /* Transaction.swift in Sources */,
296106CC1F776FD00006164B /* WalletCoordinatorTests.swift in Sources */,
02EFD0FC27DF0815008B5808 /* RepeatTests.swift in Sources */,
295B61D61FE7FC8300642E60 /* FakeTokensDataStore.swift in Sources */,
291E8FBF1F7DEA85003F0ECF /* EtherKeystoreTests.swift in Sources */,
732E0F542022786400B39C1F /* LockCreatePasscodeCoordinatorTest.swift in Sources */,

@ -16,7 +16,7 @@ class ActivityViewController: UIViewController {
private let roundedBackground = RoundedBackground()
private let wallet: Wallet
private let assetDefinitionStore: AssetDefinitionStore
private let buttonsBar = ButtonsBar(configuration: .primary(buttons: 1))
private let buttonsBar = HorizontalButtonsBar(configuration: .primary(buttons: 1))
private let tokenImageView = TokenImageView()
private let stateView = ActivityStateView()
private let titleLabel = UILabel()

@ -40,7 +40,7 @@ class EditPriceAlertViewController: UIViewController {
return view
}()
private let buttonsBar = ButtonsBar(configuration: .primary(buttons: 1))
private let buttonsBar = HorizontalButtonsBar(configuration: .primary(buttons: 1))
private lazy var containerView: ScrollableStackView = {
let view = ScrollableStackView()
return view

@ -14,7 +14,7 @@ class EditMyDappViewController: UIViewController {
private var imageHolder = ContainerViewWithShadow(aroundView: UIImageView())
private let titleTextField = TextField()
private let urlTextField = TextField()
private let buttonsBar = ButtonsBar(configuration: .primary(buttons: 1))
private let buttonsBar = HorizontalButtonsBar(configuration: .primary(buttons: 1))
private var viewModel: EditMyDappViewControllerViewModel?
weak var delegate: EditMyDappViewControllerDelegate?
@ -67,13 +67,13 @@ class EditMyDappViewController: UIViewController {
footerBar.leadingAnchor.constraint(equalTo: view.leadingAnchor),
footerBar.trailingAnchor.constraint(equalTo: view.trailingAnchor),
footerBar.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.bottomAnchor, constant: -ButtonsBar.buttonsHeight - ButtonsBar.marginAtBottomScreen),
footerBar.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.bottomAnchor, constant: -HorizontalButtonsBar.buttonsHeight - HorizontalButtonsBar.marginAtBottomScreen),
footerBar.bottomAnchor.constraint(equalTo: view.bottomAnchor),
buttonsBar.leadingAnchor.constraint(equalTo: footerBar.leadingAnchor),
buttonsBar.trailingAnchor.constraint(equalTo: footerBar.trailingAnchor),
buttonsBar.topAnchor.constraint(equalTo: footerBar.topAnchor),
buttonsBar.heightAnchor.constraint(equalToConstant: ButtonsBar.buttonsHeight),
buttonsBar.heightAnchor.constraint(equalToConstant: HorizontalButtonsBar.buttonsHeight),
stackView.leadingAnchor.constraint(equalTo: roundedBackground.leadingAnchor, constant: 37),
stackView.trailingAnchor.constraint(equalTo: roundedBackground.trailingAnchor, constant: -37),

@ -43,8 +43,8 @@ class SwitchChainRequestViewController: ModalViewController {
return button
}()
private lazy var buttonsBar: ButtonsBar = {
let buttonsBar = ButtonsBar(configuration: .primary(buttons: 1))
private lazy var buttonsBar: HorizontalButtonsBar = {
let buttonsBar = HorizontalButtonsBar(configuration: .primary(buttons: 1))
return buttonsBar
}()

@ -31,8 +31,8 @@ class PromptViewController: ModalViewController {
return v
}()
private lazy var buttonsBar: ButtonsBar = {
let buttonsBar = ButtonsBar(configuration: .primary(buttons: 1))
private lazy var buttonsBar: HorizontalButtonsBar = {
let buttonsBar = HorizontalButtonsBar(configuration: .primary(buttons: 1))
return buttonsBar
}()

@ -3,7 +3,7 @@
import Foundation
import UIKit
enum ButtonsBarConfiguration {
enum HorizontalButtonsBarConfiguration {
case empty
case combined(buttons: Int)
case primary(buttons: Int)
@ -22,7 +22,7 @@ enum ButtonsBarConfiguration {
return types
case .combined(let buttons):
let buttonsToShow: [ButtonsBarButtonType] = [.primary, .secondary]
if buttons > ButtonsBarConfiguration.maxCombinedButtons {
if buttons > HorizontalButtonsBarConfiguration.maxCombinedButtons {
let hiddenButtonsCount = buttons - buttonsToShow.count
return buttonsToShow + [ButtonsBarButtonType].init(repeating: .secondary, count: hiddenButtonsCount)
@ -41,7 +41,7 @@ enum ButtonsBarConfiguration {
case .custom:
return false
case .combined(let buttons):
return buttons >= ButtonsBarConfiguration.maxCombinedButtons && index >= ButtonsBarConfiguration.maxCombinedButtons
return buttons >= HorizontalButtonsBarConfiguration.maxCombinedButtons && index >= HorizontalButtonsBarConfiguration.maxCombinedButtons
case .empty:
return false
}
@ -54,7 +54,7 @@ enum ButtonsBarConfiguration {
case .custom:
return false
case .combined(let buttons):
return buttons > ButtonsBarConfiguration.maxCombinedButtons
return buttons > HorizontalButtonsBarConfiguration.maxCombinedButtons
case .empty:
return false
}
@ -102,8 +102,8 @@ protocol ButtonsBarViewType: UIView, ButtonObservationProtocol {
var buttons: [BarButton] { get }
}
class ButtonsBar: UIView, ButtonsBarViewType {
var height: CGFloat { ButtonsBar.buttonsHeight }
class HorizontalButtonsBar: UIView, ButtonsBarViewType {
var height: CGFloat { HorizontalButtonsBar.buttonsHeight }
static let buttonsHeight = CGFloat(ScreenChecker().isNarrowScreen ? 38 : 48)
//A gap so it doesn't stick to the bottom of devices without a bottom safe area
static let marginAtBottomScreen = CGFloat(3)
@ -131,7 +131,7 @@ class ButtonsBar: UIView, ButtonsBarViewType {
return configuration.barButtonTypes.isEmpty
}
var configuration: ButtonsBarConfiguration = .empty {
var configuration: HorizontalButtonsBarConfiguration = .empty {
didSet {
didUpdateView(with: configuration)
}
@ -139,7 +139,7 @@ class ButtonsBar: UIView, ButtonsBarViewType {
weak var viewController: UIViewController?
init(configuration: ButtonsBarConfiguration = .primary(buttons: 1)) {
init(configuration: HorizontalButtonsBarConfiguration = .primary(buttons: 1)) {
buttonsStackView = [UIView]().asStackView(axis: .horizontal, distribution: .fillEqually, spacing: 7)
innerStackView = [UIView]().asStackView(axis: .horizontal, distribution: .fill, spacing: 7)
@ -157,7 +157,7 @@ class ButtonsBar: UIView, ButtonsBarViewType {
let margin = CGFloat(20)
NSLayoutConstraint.activate([
heightAnchor.constraint(equalToConstant: ButtonsBar.buttonsHeight),
heightAnchor.constraint(equalToConstant: HorizontalButtonsBar.buttonsHeight),
innerStackView.anchorsConstraint(to: self, edgeInsets: .init(top: 0, left: margin, bottom: 0, right: margin)),
])
@ -184,10 +184,10 @@ class ButtonsBar: UIView, ButtonsBarViewType {
observation.flatMap { $0.invalidate() }
}
private func didUpdateView(with configuration: ButtonsBarConfiguration) {
private func didUpdateView(with configuration: HorizontalButtonsBarConfiguration) {
willChangeValue(for: \.buttons)
buttonContainerViews = ButtonsBar.bar(numberOfButtons: configuration.barButtonTypes.count)
buttonContainerViews = HorizontalButtonsBar.bar(numberOfButtons: configuration.barButtonTypes.count)
resetIsHiddenObservers()
for view in buttonContainerViews {
@ -197,7 +197,7 @@ class ButtonsBar: UIView, ButtonsBarViewType {
observations.append(observation)
}
moreButtonContainerViews = ButtonsBar.bar(numberOfButtons: configuration.showMoreButton ? 1 : 0)
moreButtonContainerViews = HorizontalButtonsBar.bar(numberOfButtons: configuration.showMoreButton ? 1 : 0)
for each in buttonsStackView.arrangedSubviews + innerStackView.arrangedSubviews {
each.removeFromSuperview()
@ -240,7 +240,7 @@ class ButtonsBar: UIView, ButtonsBarViewType {
observations.removeAll()
}
func configure(_ newConfiguration: ButtonsBarConfiguration? = nil) {
func configure(_ newConfiguration: HorizontalButtonsBarConfiguration? = nil) {
if let newConfiguration = newConfiguration {
configuration = newConfiguration
}
@ -376,7 +376,7 @@ struct ButtonsBarViewModel {
var disabledButtonTitleColor: UIColor = Colors.appWhite
var buttonCornerRadius: CGFloat {
return ButtonsBar.buttonsHeight / 2.0
return HorizontalButtonsBar.buttonsHeight / 2.0
}
var buttonShadowColor: UIColor {

@ -12,11 +12,11 @@ enum ToolbarConfiguration {
}
class ToolButtonsBarView: UIView, ButtonsBarViewType {
var height: CGFloat { ButtonsBar.buttonsHeight }
var height: CGFloat { HorizontalButtonsBar.buttonsHeight }
private let moreButtonIndex: Int = 2
private var moreButtons: [UIButton] = []
private let buttonsBar = ButtonsBar(configuration: .empty)
private let buttonsBar = HorizontalButtonsBar(configuration: .empty)
private let separatorLine: UIView = {
let view = UIView()
view.backgroundColor = R.color.mike()

@ -0,0 +1,108 @@
//
// VerticalButtonsBar.swift
// AlphaWallet
//
// Created by Jerome Chan on 9/3/22.
//
import UIKit
class VerticalButtonsBar: UIView {
// MARK: - Public properties
var buttons: [UIButton] = []
// MARK: Private properties
private var stackView: UIStackView = UIStackView()
// MARK: - Init
init(numberOfButtons: Int) {
super.init(frame: .zero)
setup(numberOfButtons: numberOfButtons)
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
// MARK: - Setup and creation
private func setup(numberOfButtons: Int) {
var buttonViews: [ContainerViewWithShadow<BarButton>] = [ContainerViewWithShadow<BarButton>]()
guard numberOfButtons > 0 else { return }
let primaryButton = createButton(viewModel: .primaryButton)
primaryButton.childView.borderWidth = 0
buttonViews.append(primaryButton)
guard numberOfButtons > 1 else { return }
(1 ..< numberOfButtons).forEach { _ in
buttonViews.append(createButton(viewModel: .secondaryButton))
}
setupStackView(views: buttonViews)
setupButtons(views: buttonViews)
setupView(numberOfButtons: numberOfButtons)
}
private func setupStackView(views: [UIView]) {
stackView.translatesAutoresizingMaskIntoConstraints = false
stackView.removeAllArrangedSubviews()
stackView.addArrangedSubviews(views)
stackView.axis = .vertical
stackView.distribution = .equalSpacing
stackView.spacing = 16.0
addSubview(stackView)
NSLayoutConstraint.activate([
topAnchor.constraint(equalTo: stackView.topAnchor),
bottomAnchor.constraint(equalTo: stackView.bottomAnchor),
leadingAnchor.constraint(equalTo: stackView.leadingAnchor),
trailingAnchor.constraint(equalTo: stackView.trailingAnchor),
])
}
private func setupButtons(views: [ContainerViewWithShadow<BarButton>]) {
buttons.removeAll()
views.forEach { view in
buttons.append(view.childView)
}
}
private func setupView(numberOfButtons: Int) {
translatesAutoresizingMaskIntoConstraints = false
}
private func createButton(viewModel: ButtonsBarViewModel) -> ContainerViewWithShadow<BarButton> {
let button = BarButton()
button.translatesAutoresizingMaskIntoConstraints = false
let containerView = ContainerViewWithShadow(aroundView: button)
containerView.translatesAutoresizingMaskIntoConstraints = false
setup(viewModel: viewModel, view: containerView)
NSLayoutConstraint.activate([
button.heightAnchor.constraint(equalToConstant: 50.0),
])
return containerView
}
// TODO: This function duplicates a function in ButtonsBar. Merge these two functions.
private func setup(viewModel: ButtonsBarViewModel, view: ContainerViewWithShadow<BarButton>) {
view.configureShadow(color: viewModel.buttonShadowColor, offset: viewModel.buttonShadowOffset, opacity: viewModel.buttonShadowOpacity, radius: viewModel.buttonShadowRadius, cornerRadius: viewModel.buttonCornerRadius)
let button = view.childView
button.setBackgroundColor(viewModel.buttonBackgroundColor, forState: .normal)
button.setBackgroundColor(viewModel.disabledButtonBackgroundColor, forState: .disabled)
viewModel.highlightedButtonBackgroundColor.flatMap { button.setBackgroundColor($0, forState: .highlighted) }
viewModel.highlightedButtonTitleColor.flatMap { button.setTitleColor($0, for: .highlighted) }
button.setTitleColor(viewModel.buttonTitleColor, for: .normal)
button.setTitleColor(viewModel.disabledButtonTitleColor, for: .disabled)
button.setBorderColor(viewModel.buttonBorderColor, for: .normal)
button.setBorderColor(viewModel.disabledButtonBorderColor, for: .disabled)
button.titleLabel?.font = viewModel.buttonFont
button.titleLabel?.adjustsFontSizeToFitWidth = true
//So long titles (that cause font to be adjusted) have some margins on the left and right
button.contentEdgeInsets = .init(top: 0, left: 3, bottom: 0, right: 3)
button.cornerRadius = viewModel.buttonCornerRadius
button.borderColor = viewModel.buttonBorderColor
button.borderWidth = viewModel.buttonBorderWidth
}
}

@ -0,0 +1,14 @@
//
// Repeat.swift
// AlphaWallet
//
// Created by Jerome Chan on 14/3/22.
//
import Foundation
func repeatTimes(_ times: Int, block: () -> Void) {
for _ in 0..<times {
block()
}
}

@ -25,7 +25,7 @@ class ImportMagicTokenViewController: UIViewController, OptionalTokenVerifiableS
private let ethCostLabel = UILabel()
private let dollarCostLabelLabel = UILabel()
private let dollarCostLabel = PaddedLabel()
private let buttonsBar = ButtonsBar(configuration: .primary(buttons: 2))
private let buttonsBar = HorizontalButtonsBar(configuration: .primary(buttons: 2))
private var viewModel: ImportMagicTokenViewControllerViewModel?
let server: RPCServer
@ -134,11 +134,11 @@ class ImportMagicTokenViewController: UIViewController, OptionalTokenVerifiableS
buttonsBar.leadingAnchor.constraint(equalTo: footerBar.leadingAnchor),
buttonsBar.trailingAnchor.constraint(equalTo: footerBar.trailingAnchor),
buttonsBar.topAnchor.constraint(equalTo: footerBar.topAnchor),
buttonsBar.heightAnchor.constraint(equalToConstant: ButtonsBar.buttonsHeight),
buttonsBar.heightAnchor.constraint(equalToConstant: HorizontalButtonsBar.buttonsHeight),
footerBar.leadingAnchor.constraint(equalTo: view.leadingAnchor),
footerBar.trailingAnchor.constraint(equalTo: view.trailingAnchor),
footerBar.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.bottomAnchor, constant: -ButtonsBar.buttonsHeight - ButtonsBar.marginAtBottomScreen),
footerBar.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.bottomAnchor, constant: -HorizontalButtonsBar.buttonsHeight - HorizontalButtonsBar.marginAtBottomScreen),
footerBar.bottomAnchor.constraint(equalTo: view.bottomAnchor),
statusLabel.widthAnchor.constraint(equalTo: tokenCardRowView.widthAnchor, constant: -20),

@ -21,7 +21,7 @@ class RedeemTokenCardQuantitySelectionViewController: UIViewController, TokenVer
private let subtitleLabel = UILabel()
private let quantityStepper = NumberStepper()
private let tokenRowView: TokenRowView & UIView
private let buttonsBar = ButtonsBar(configuration: .primary(buttons: 1))
private let buttonsBar = HorizontalButtonsBar(configuration: .primary(buttons: 1))
private var viewModel: RedeemTokenCardQuantitySelectionViewModel
var contract: AlphaWallet.Address {
@ -97,11 +97,11 @@ class RedeemTokenCardQuantitySelectionViewController: UIViewController, TokenVer
buttonsBar.leadingAnchor.constraint(equalTo: footerBar.leadingAnchor),
buttonsBar.trailingAnchor.constraint(equalTo: footerBar.trailingAnchor),
buttonsBar.topAnchor.constraint(equalTo: footerBar.topAnchor),
buttonsBar.heightAnchor.constraint(equalToConstant: ButtonsBar.buttonsHeight),
buttonsBar.heightAnchor.constraint(equalToConstant: HorizontalButtonsBar.buttonsHeight),
footerBar.leadingAnchor.constraint(equalTo: view.leadingAnchor),
footerBar.trailingAnchor.constraint(equalTo: view.trailingAnchor),
footerBar.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.bottomAnchor, constant: -ButtonsBar.buttonsHeight - ButtonsBar.marginAtBottomScreen),
footerBar.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.bottomAnchor, constant: -HorizontalButtonsBar.buttonsHeight - HorizontalButtonsBar.marginAtBottomScreen),
footerBar.bottomAnchor.constraint(equalTo: view.bottomAnchor),
] + roundedBackground.createConstraintsWithContainer(view: view))
}

@ -23,7 +23,7 @@ class EnterSellTokensCardPriceQuantityViewController: UIViewController, TokenVer
private let dollarCostLabelLabel = UILabel()
private let dollarCostLabel = PaddedLabel()
private let tokenRowView: TokenRowView & UIView
private let buttonsBar = ButtonsBar(configuration: .primary(buttons: 1))
private let buttonsBar = HorizontalButtonsBar(configuration: .primary(buttons: 1))
private var viewModel: EnterSellTokensCardPriceQuantityViewControllerViewModel
private var totalEthCost: Ether {
if let ethCostPerToken = Ether(string: pricePerTokenField.ethCost) {
@ -203,11 +203,11 @@ class EnterSellTokensCardPriceQuantityViewController: UIViewController, TokenVer
buttonsBar.leadingAnchor.constraint(equalTo: footerBar.leadingAnchor),
buttonsBar.trailingAnchor.constraint(equalTo: footerBar.trailingAnchor),
buttonsBar.topAnchor.constraint(equalTo: footerBar.topAnchor),
buttonsBar.heightAnchor.constraint(equalToConstant: ButtonsBar.buttonsHeight),
buttonsBar.heightAnchor.constraint(equalToConstant: HorizontalButtonsBar.buttonsHeight),
footerBar.leadingAnchor.constraint(equalTo: view.leadingAnchor),
footerBar.trailingAnchor.constraint(equalTo: view.trailingAnchor),
footerBar.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.bottomAnchor, constant: -ButtonsBar.buttonsHeight - ButtonsBar.marginAtBottomScreen),
footerBar.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.bottomAnchor, constant: -HorizontalButtonsBar.buttonsHeight - HorizontalButtonsBar.marginAtBottomScreen),
footerBar.bottomAnchor.constraint(equalTo: view.bottomAnchor),
scrollView.leadingAnchor.constraint(equalTo: view.leadingAnchor),

@ -25,7 +25,7 @@ class SetSellTokensCardExpiryDateViewController: UIViewController, TokenVerifiab
private let noteLabel = UILabel()
private let noteBorderView = UIView()
private let tokenRowView: TokenRowView & UIView
private let buttonsBar = ButtonsBar(configuration: .primary(buttons: 1))
private let buttonsBar = HorizontalButtonsBar(configuration: .primary(buttons: 1))
private let datePicker = UIDatePicker()
private let timePicker = UIDatePicker()
private var viewModel: SetSellTokensCardExpiryDateViewControllerViewModel
@ -216,11 +216,11 @@ class SetSellTokensCardExpiryDateViewController: UIViewController, TokenVerifiab
buttonsBar.leadingAnchor.constraint(equalTo: footerBar.leadingAnchor),
buttonsBar.trailingAnchor.constraint(equalTo: footerBar.trailingAnchor),
buttonsBar.topAnchor.constraint(equalTo: footerBar.topAnchor),
buttonsBar.heightAnchor.constraint(equalToConstant: ButtonsBar.buttonsHeight),
buttonsBar.heightAnchor.constraint(equalToConstant: HorizontalButtonsBar.buttonsHeight),
footerBar.leadingAnchor.constraint(equalTo: view.leadingAnchor),
footerBar.trailingAnchor.constraint(equalTo: view.trailingAnchor),
footerBar.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.bottomAnchor, constant: -ButtonsBar.buttonsHeight - ButtonsBar.marginAtBottomScreen),
footerBar.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.bottomAnchor, constant: -HorizontalButtonsBar.buttonsHeight - HorizontalButtonsBar.marginAtBottomScreen),
footerBar.bottomAnchor.constraint(equalTo: view.bottomAnchor),
scrollView.leadingAnchor.constraint(equalTo: view.leadingAnchor),

@ -46,8 +46,8 @@ class CheckTransactionStateViewController: ModalViewController {
return view
}()
private lazy var buttonsBar: ButtonsBar = {
let buttonsBar = ButtonsBar(configuration: .primary(buttons: 1))
private lazy var buttonsBar: HorizontalButtonsBar = {
let buttonsBar = HorizontalButtonsBar(configuration: .primary(buttons: 1))
return buttonsBar
}()

@ -52,8 +52,8 @@ class CollectUsersEmailViewController: ModalViewController {
return tx
}()
private lazy var buttonsBar: ButtonsBar = {
let buttonsBar = ButtonsBar(configuration: .primary(buttons: 1))
private lazy var buttonsBar: HorizontalButtonsBar = {
let buttonsBar = HorizontalButtonsBar(configuration: .primary(buttons: 1))
return buttonsBar
}()

@ -63,8 +63,8 @@ class SaveCustomRpcBrowseViewController: UIViewController {
return emptyView
}()
private lazy var buttonsBar: ButtonsBar = {
let buttonsBar = ButtonsBar(configuration: .primary(buttons: 1))
private lazy var buttonsBar: HorizontalButtonsBar = {
let buttonsBar = HorizontalButtonsBar(configuration: .primary(buttons: 1))
buttonsBar.translatesAutoresizingMaskIntoConstraints = false
return buttonsBar
}()

@ -36,7 +36,7 @@ class ExportJsonKeystoreFileView: UIView {
textView.autocorrectionType = .no
return textView
}()
private lazy var buttonsBar = ButtonsBar(configuration: .primary(buttons: 1))
private lazy var buttonsBar = HorizontalButtonsBar(configuration: .primary(buttons: 1))
convenience init() {
self.init(frame: .zero)

@ -40,7 +40,7 @@ class ExportJsonKeystorePasswordView: UIView {
textField.autocorrectionType = .no
return textField
}()
private let buttonsBar = ButtonsBar(configuration: .primary(buttons: 1))
private let buttonsBar = HorizontalButtonsBar(configuration: .primary(buttons: 1))
var bottomConstraint: NSLayoutConstraint!

@ -15,7 +15,7 @@ import UIKit
class SaveCustomRpcManualEntryView: UIView {
private let buttonsBar = ButtonsBar(configuration: .primary(buttons: 1))
private let buttonsBar = HorizontalButtonsBar(configuration: .primary(buttons: 1))
private var scrollViewBottomConstraint: NSLayoutConstraint!
private let roundedBackground = RoundedBackground()
private let scrollView = UIScrollView()

@ -71,7 +71,7 @@ class NewTokenViewController: UIViewController {
private let decimalsTextField = TextField()
private let balanceTextField = TextField()
private let nameTextField = TextField()
private let buttonsBar = ButtonsBar(configuration: .primary(buttons: 1))
private let buttonsBar = HorizontalButtonsBar(configuration: .primary(buttons: 1))
private let changeServerButton = UIButton()
private var scrollViewBottomAnchorConstraint: NSLayoutConstraint!
private var shouldFireDetectionWhenAppear: Bool
@ -162,11 +162,11 @@ class NewTokenViewController: UIViewController {
buttonsBar.leadingAnchor.constraint(equalTo: footerBar.leadingAnchor),
buttonsBar.trailingAnchor.constraint(equalTo: footerBar.trailingAnchor),
buttonsBar.topAnchor.constraint(equalTo: footerBar.topAnchor),
buttonsBar.heightAnchor.constraint(equalToConstant: ButtonsBar.buttonsHeight),
buttonsBar.heightAnchor.constraint(equalToConstant: HorizontalButtonsBar.buttonsHeight),
footerBar.leadingAnchor.constraint(equalTo: view.leadingAnchor),
footerBar.trailingAnchor.constraint(equalTo: view.trailingAnchor),
footerBar.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.bottomAnchor, constant: -ButtonsBar.buttonsHeight - ButtonsBar.marginAtBottomScreen),
footerBar.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.bottomAnchor, constant: -HorizontalButtonsBar.buttonsHeight - HorizontalButtonsBar.marginAtBottomScreen),
footerBar.bottomAnchor.constraint(equalTo: view.bottomAnchor),
scrollView.leadingAnchor.constraint(equalTo: view.leadingAnchor),

@ -20,7 +20,7 @@ class NonFungibleTokenViewController: UIViewController, TokenVerifiableStatusVie
private let analyticsCoordinator: AnalyticsCoordinator
private (set) var viewModel: NonFungibleTokenViewModel
private let bigImageView = WebImageView()
private let buttonsBar = ButtonsBar(configuration: .combined(buttons: 3))
private let buttonsBar = HorizontalButtonsBar(configuration: .combined(buttons: 3))
private lazy var containerView: ScrollableStackView = ScrollableStackView()
private let mode: TokenInstanceViewMode
private lazy var attributesStackView = GridStackView(viewModel: .init(edgeInsets: .init(top: 0, left: 20, bottom: 15, right: 20)))

@ -30,7 +30,7 @@ class TokenInstanceActionViewController: UIViewController, TokenVerifiableStatus
}()
//TODO might have to change the number of buttons? if the action type change or should we just go back since the flow may be broken if we remain in this screen
private let buttonsBar = ButtonsBar(configuration: .primary(buttons: 1))
private let buttonsBar = HorizontalButtonsBar(configuration: .primary(buttons: 1))
private var isFungible: Bool {
switch tokenObject.type {
case .nativeCryptocurrency:
@ -106,11 +106,11 @@ class TokenInstanceActionViewController: UIViewController, TokenVerifiableStatus
buttonsBar.leadingAnchor.constraint(equalTo: footerBar.leadingAnchor),
buttonsBar.trailingAnchor.constraint(equalTo: footerBar.trailingAnchor),
buttonsBar.topAnchor.constraint(equalTo: footerBar.topAnchor),
buttonsBar.heightAnchor.constraint(equalToConstant: ButtonsBar.buttonsHeight),
buttonsBar.heightAnchor.constraint(equalToConstant: HorizontalButtonsBar.buttonsHeight),
footerBar.leadingAnchor.constraint(equalTo: view.leadingAnchor),
footerBar.trailingAnchor.constraint(equalTo: view.trailingAnchor),
footerBar.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.bottomAnchor, constant: -ButtonsBar.buttonsHeight - ButtonsBar.marginAtBottomScreen),
footerBar.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.bottomAnchor, constant: -HorizontalButtonsBar.buttonsHeight - HorizontalButtonsBar.marginAtBottomScreen),
footerBar.bottomAnchor.constraint(equalTo: view.bottomAnchor),
] + roundedBackground.createConstraintsWithContainer(view: view))
}

@ -26,7 +26,7 @@ class TokenViewController: UIViewController {
private let assetDefinitionStore: AssetDefinitionStore
private let transactionType: TransactionType
private let analyticsCoordinator: AnalyticsCoordinator
private let buttonsBar = ButtonsBar(configuration: .combined(buttons: 2))
private let buttonsBar = HorizontalButtonsBar(configuration: .combined(buttons: 2))
private lazy var tokenScriptFileStatusHandler = XMLHandler(token: tokenObject, assetDefinitionStore: assetDefinitionStore)
weak var delegate: TokenViewControllerDelegate?

@ -23,8 +23,8 @@ class TokensCardViewController: UIViewController {
private let assetDefinitionStore: AssetDefinitionStore
private let eventsDataStore: NonActivityEventsDataStore
private let analyticsCoordinator: AnalyticsCoordinator
private lazy var buttonsBar: ButtonsBar = {
let buttonsBar = ButtonsBar(configuration: .empty)
private lazy var buttonsBar: HorizontalButtonsBar = {
let buttonsBar = HorizontalButtonsBar(configuration: .empty)
buttonsBar.viewController = self
return buttonsBar

@ -20,7 +20,7 @@ class TransactionViewController: UIViewController {
}()
private let roundedBackground = RoundedBackground()
private let scrollView = UIScrollView()
private let buttonsBar = ButtonsBar(configuration: .primary(buttons: 1))
private let buttonsBar = HorizontalButtonsBar(configuration: .primary(buttons: 1))
private let session: WalletSession
private let transactionRow: TransactionRow
@ -91,11 +91,11 @@ class TransactionViewController: UIViewController {
buttonsBar.leadingAnchor.constraint(equalTo: footerBar.leadingAnchor),
buttonsBar.trailingAnchor.constraint(equalTo: footerBar.trailingAnchor),
buttonsBar.topAnchor.constraint(equalTo: footerBar.topAnchor),
buttonsBar.heightAnchor.constraint(equalToConstant: ButtonsBar.buttonsHeight),
buttonsBar.heightAnchor.constraint(equalToConstant: HorizontalButtonsBar.buttonsHeight),
footerBar.leadingAnchor.constraint(equalTo: view.leadingAnchor),
footerBar.trailingAnchor.constraint(equalTo: view.trailingAnchor),
footerBar.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.bottomAnchor, constant: -ButtonsBar.buttonsHeight - ButtonsBar.marginAtBottomScreen),
footerBar.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.bottomAnchor, constant: -HorizontalButtonsBar.buttonsHeight - HorizontalButtonsBar.marginAtBottomScreen),
footerBar.bottomAnchor.constraint(equalTo: view.bottomAnchor),
] + roundedBackground.createConstraintsWithContainer(view: view))

@ -53,7 +53,7 @@ class TransferTokenBatchCardsViaWalletAddressViewController: UIViewController, T
return view
}()
private let buttonsBar = ButtonsBar(configuration: .primary(buttons: 1))
private let buttonsBar = HorizontalButtonsBar(configuration: .primary(buttons: 1))
private var viewModel: TransferTokenBatchCardsViaWalletAddressViewControllerViewModel
var contract: AlphaWallet.Address {

@ -13,7 +13,7 @@ class ChooseTokenCardTransferModeViewController: UIViewController, TokenVerifiab
private let roundedBackground = RoundedBackground()
private let header = TokensCardViewControllerTitleHeader()
private let tokenRowView: TokenRowView & UIView
private let buttonsBar = ButtonsBar(configuration: .primary(buttons: 2))
private let buttonsBar = HorizontalButtonsBar(configuration: .primary(buttons: 2))
private var viewModel: ChooseTokenCardTransferModeViewControllerViewModel
private let analyticsCoordinator: AnalyticsCoordinator
private let tokenHolder: TokenHolder
@ -87,11 +87,11 @@ class ChooseTokenCardTransferModeViewController: UIViewController, TokenVerifiab
buttonsBar.leadingAnchor.constraint(equalTo: footerBar.leadingAnchor),
buttonsBar.trailingAnchor.constraint(equalTo: footerBar.trailingAnchor),
buttonsBar.topAnchor.constraint(equalTo: footerBar.topAnchor),
buttonsBar.heightAnchor.constraint(equalToConstant: ButtonsBar.buttonsHeight),
buttonsBar.heightAnchor.constraint(equalToConstant: HorizontalButtonsBar.buttonsHeight),
footerBar.leadingAnchor.constraint(equalTo: view.leadingAnchor),
footerBar.trailingAnchor.constraint(equalTo: view.trailingAnchor),
footerBar.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.bottomAnchor, constant: -ButtonsBar.buttonsHeight - ButtonsBar.marginAtBottomScreen),
footerBar.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.bottomAnchor, constant: -HorizontalButtonsBar.buttonsHeight - HorizontalButtonsBar.marginAtBottomScreen),
footerBar.bottomAnchor.constraint(equalTo: view.bottomAnchor),
] + roundedBackground.createConstraintsWithContainer(view: view))
}

@ -14,7 +14,7 @@ class SendTransactionErrorViewController: UIViewController {
private let error: SendTransactionNotRetryableError
private lazy var viewModel = SendTransactionErrorViewModel(server: server, error: error)
private lazy var headerView = ConfirmationHeaderView(viewModel: .init(title: "", isMinimalMode: true))
private let buttonsBar = ButtonsBar(configuration: .primary(buttons: 1))
private let buttonsBar = HorizontalButtonsBar(configuration: .primary(buttons: 1))
private var titleLabel: UILabel = {
let v = UILabel()

@ -18,7 +18,7 @@ protocol SendViewControllerDelegate: class, CanOpenURL {
class SendViewController: UIViewController {
private let recipientHeader = SendViewSectionHeader()
private let amountHeader = SendViewSectionHeader()
private let buttonsBar = ButtonsBar(configuration: .primary(buttons: 1))
private let buttonsBar = HorizontalButtonsBar(configuration: .primary(buttons: 1))
private var viewModel: SendViewModel
private let session: WalletSession
private var currentSubscribableKeyForNativeCryptoCurrencyBalance: Subscribable<BalanceBaseViewModel>.SubscribableKey?

@ -22,7 +22,7 @@ class SetTransferTokensCardExpiryDateViewController: UIViewController, TokenVeri
private let noteTitleLabel = UILabel()
private let noteLabel = UILabel()
private let noteBorderView = UIView()
private let buttonsBar = ButtonsBar(configuration: .primary(buttons: 1))
private let buttonsBar = HorizontalButtonsBar(configuration: .primary(buttons: 1))
private var viewModel: SetTransferTokensCardExpiryDateViewControllerViewModel
private let analyticsCoordinator: AnalyticsCoordinator
private let tokenHolder: TokenHolder
@ -181,11 +181,11 @@ class SetTransferTokensCardExpiryDateViewController: UIViewController, TokenVeri
buttonsBar.leadingAnchor.constraint(equalTo: footerBar.leadingAnchor),
buttonsBar.trailingAnchor.constraint(equalTo: footerBar.trailingAnchor),
buttonsBar.topAnchor.constraint(equalTo: footerBar.topAnchor),
buttonsBar.heightAnchor.constraint(equalToConstant: ButtonsBar.buttonsHeight),
buttonsBar.heightAnchor.constraint(equalToConstant: HorizontalButtonsBar.buttonsHeight),
footerBar.leadingAnchor.constraint(equalTo: view.leadingAnchor),
footerBar.trailingAnchor.constraint(equalTo: view.trailingAnchor),
footerBar.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.bottomAnchor, constant: -ButtonsBar.buttonsHeight - ButtonsBar.marginAtBottomScreen),
footerBar.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.bottomAnchor, constant: -HorizontalButtonsBar.buttonsHeight - HorizontalButtonsBar.marginAtBottomScreen),
footerBar.bottomAnchor.constraint(equalTo: view.bottomAnchor),
scrollView.leadingAnchor.constraint(equalTo: view.leadingAnchor),

@ -15,7 +15,7 @@ protocol SignatureConfirmationViewControllerDelegate: AnyObject {
class SignatureConfirmationViewController: UIViewController {
private lazy var headerView = ConfirmationHeaderView(viewModel: .init(title: viewModel.navigationTitle))
private let buttonsBar = ButtonsBar(configuration: .empty)
private let buttonsBar = HorizontalButtonsBar(configuration: .empty)
private (set) var viewModel: SignatureConfirmationViewModel
private let stackView: UIStackView = {
@ -136,7 +136,7 @@ class SignatureConfirmationViewController: UIViewController {
buttonsBar.topAnchor.constraint(equalTo: footerBar.topAnchor, constant: 20),
buttonsBar.leadingAnchor.constraint(equalTo: footerBar.leadingAnchor),
buttonsBar.trailingAnchor.constraint(equalTo: footerBar.trailingAnchor),
buttonsBar.heightAnchor.constraint(equalToConstant: ButtonsBar.buttonsHeight),
buttonsBar.heightAnchor.constraint(equalToConstant: HorizontalButtonsBar.buttonsHeight),
])
headerView.closeButton.addTarget(self, action: #selector(dismissViewController), for: .touchUpInside)

@ -21,7 +21,7 @@ class TransactionConfirmationViewController: UIViewController {
}
private lazy var headerView = ConfirmationHeaderView(viewModel: .init(title: viewModel.navigationTitle))
private let buttonsBar = ButtonsBar(configuration: .primary(buttons: 1))
private let buttonsBar = HorizontalButtonsBar(configuration: .primary(buttons: 1))
private var viewModel: TransactionConfirmationViewModel
private var timerToReenableConfirmButton: Timer?
private let separatorLine: UIView = {
@ -86,7 +86,7 @@ class TransactionConfirmationViewController: UIViewController {
buttonsBar.topAnchor.constraint(equalTo: footerBar.topAnchor, constant: 20),
buttonsBar.leadingAnchor.constraint(equalTo: footerBar.leadingAnchor),
buttonsBar.trailingAnchor.constraint(equalTo: footerBar.trailingAnchor),
buttonsBar.heightAnchor.constraint(equalToConstant: ButtonsBar.buttonsHeight),
buttonsBar.heightAnchor.constraint(equalToConstant: HorizontalButtonsBar.buttonsHeight),
loadingIndicatorView.topAnchor.constraint(equalTo: footerBar.topAnchor, constant: 20),
loadingIndicatorView.centerXAnchor.constraint(equalTo: footerBar.centerXAnchor)

@ -22,7 +22,7 @@ class TransactionInProgressViewController: UIViewController {
view.addSubview(buttonsBar)
return view
}()
private lazy var buttonsBar = ButtonsBar(configuration: .primary(buttons: 1))
private lazy var buttonsBar = HorizontalButtonsBar(configuration: .primary(buttons: 1))
private lazy var titleLabel: UILabel = {
let label = UILabel()
label.translatesAutoresizingMaskIntoConstraints = false
@ -67,7 +67,7 @@ class TransactionInProgressViewController: UIViewController {
buttonsBar.leadingAnchor.constraint(equalTo: footerBar.leadingAnchor),
buttonsBar.trailingAnchor.constraint(equalTo: footerBar.trailingAnchor),
buttonsBar.topAnchor.constraint(equalTo: footerBar.topAnchor),
buttonsBar.heightAnchor.constraint(equalToConstant: ButtonsBar.buttonsHeight),
buttonsBar.heightAnchor.constraint(equalToConstant: HorizontalButtonsBar.buttonsHeight),
subtitleLabel.leadingAnchor.constraint(equalTo: view.leadingAnchor),
subtitleLabel.trailingAnchor.constraint(equalTo: view.trailingAnchor),
@ -75,7 +75,7 @@ class TransactionInProgressViewController: UIViewController {
footerBar.leadingAnchor.constraint(equalTo: view.leadingAnchor),
footerBar.trailingAnchor.constraint(equalTo: view.trailingAnchor),
footerBar.heightAnchor.constraint(equalToConstant: ButtonsBar.buttonsHeight),
footerBar.heightAnchor.constraint(equalToConstant: HorizontalButtonsBar.buttonsHeight),
footerBar.bottomAnchor.constraint(equalTo: view.safeAreaLayoutGuide.bottomAnchor, constant: -16)
])
}

@ -13,7 +13,7 @@ class TransferTokensCardQuantitySelectionViewController: UIViewController, Token
private let subtitleLabel = UILabel()
private let quantityStepper = NumberStepper()
private let tokenRowView: TokenRowView & UIView
private let buttonsBar = ButtonsBar(configuration: .primary(buttons: 1))
private let buttonsBar = HorizontalButtonsBar(configuration: .primary(buttons: 1))
private var viewModel: TransferTokensCardQuantitySelectionViewModel
private let token: TokenObject
@ -100,11 +100,11 @@ class TransferTokensCardQuantitySelectionViewController: UIViewController, Token
buttonsBar.leadingAnchor.constraint(equalTo: footerBar.leadingAnchor),
buttonsBar.trailingAnchor.constraint(equalTo: footerBar.trailingAnchor),
buttonsBar.topAnchor.constraint(equalTo: footerBar.topAnchor),
buttonsBar.heightAnchor.constraint(equalToConstant: ButtonsBar.buttonsHeight),
buttonsBar.heightAnchor.constraint(equalToConstant: HorizontalButtonsBar.buttonsHeight),
footerBar.leadingAnchor.constraint(equalTo: view.leadingAnchor),
footerBar.trailingAnchor.constraint(equalTo: view.trailingAnchor),
footerBar.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.bottomAnchor, constant: -ButtonsBar.buttonsHeight - ButtonsBar.marginAtBottomScreen),
footerBar.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.bottomAnchor, constant: -HorizontalButtonsBar.buttonsHeight - HorizontalButtonsBar.marginAtBottomScreen),
footerBar.bottomAnchor.constraint(equalTo: view.bottomAnchor),
] + roundedBackground.createConstraintsWithContainer(view: view))
}

@ -17,7 +17,7 @@ class TransferTokensCardViaWalletAddressViewController: UIViewController, TokenV
private let tokenRowView: TokenRowView & UIView
private let targetAddressLabel = UILabel()
private let targetAddressTextField = AddressTextField()
private let buttonsBar = ButtonsBar(configuration: .primary(buttons: 1))
private let buttonsBar = HorizontalButtonsBar(configuration: .primary(buttons: 1))
private (set) var viewModel: TransferTokensCardViaWalletAddressViewControllerViewModel
private var tokenHolder: TokenHolder
private var paymentFlow: PaymentFlow
@ -132,11 +132,11 @@ class TransferTokensCardViaWalletAddressViewController: UIViewController, TokenV
buttonsBar.leadingAnchor.constraint(equalTo: footerBar.leadingAnchor),
buttonsBar.trailingAnchor.constraint(equalTo: footerBar.trailingAnchor),
buttonsBar.topAnchor.constraint(equalTo: footerBar.topAnchor),
buttonsBar.heightAnchor.constraint(equalToConstant: ButtonsBar.buttonsHeight),
buttonsBar.heightAnchor.constraint(equalToConstant: HorizontalButtonsBar.buttonsHeight),
footerBar.leadingAnchor.constraint(equalTo: view.leadingAnchor),
footerBar.trailingAnchor.constraint(equalTo: view.trailingAnchor),
footerBar.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.bottomAnchor, constant: -ButtonsBar.buttonsHeight - ButtonsBar.marginAtBottomScreen),
footerBar.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.bottomAnchor, constant: -HorizontalButtonsBar.buttonsHeight - HorizontalButtonsBar.marginAtBottomScreen),
footerBar.bottomAnchor.constraint(equalTo: view.bottomAnchor),
] + roundedBackground.createConstraintsWithContainer(view: view))

@ -83,7 +83,7 @@ private protocol DialogDelegate: AnyObject {
private class Dialog: UIView {
private let titleLabel = UILabel()
private let descriptionLabel = UILabel()
private let buttonsBar = ButtonsBar(configuration: .primary(buttons: 1))
private let buttonsBar = HorizontalButtonsBar(configuration: .primary(buttons: 1))
weak var delegate: DialogDelegate?
@ -101,7 +101,7 @@ private class Dialog: UIView {
addSubview(stackView)
NSLayoutConstraint.activate([
buttonsBar.heightAnchor.constraint(equalToConstant: ButtonsBar.buttonsHeight),
buttonsBar.heightAnchor.constraint(equalToConstant: HorizontalButtonsBar.buttonsHeight),
widthAnchor.constraint(equalToConstant: 300),
heightAnchor.constraint(equalToConstant: 250),

@ -15,10 +15,10 @@ class CreateInitialWalletViewController: UIViewController {
private let roundedBackground = RoundedBackground()
private let subtitleLabel = UILabel()
private let imageView = UIImageView()
private let createWalletButtonBar = ButtonsBar(configuration: .primary(buttons: 1))
private let createWalletButtonBar = HorizontalButtonsBar(configuration: .primary(buttons: 1))
private let separator = UIView.spacer(height: 1)
private let haveWalletLabel = UILabel()
private let buttonsBar = ButtonsBar(configuration: .secondary(buttons: 2))
private let buttonsBar = HorizontalButtonsBar(configuration: .secondary(buttons: 2))
private var imageViewDimension: CGFloat {
if ScreenChecker().isNarrowScreen {
@ -78,16 +78,16 @@ class CreateInitialWalletViewController: UIViewController {
stackView.topAnchor.constraint(equalTo: view.topAnchor),
stackView.bottomAnchor.constraint(equalTo: footerBar.topAnchor),
createWalletButtonBar.heightAnchor.constraint(equalToConstant: ButtonsBar.buttonsHeight),
createWalletButtonBar.heightAnchor.constraint(equalToConstant: HorizontalButtonsBar.buttonsHeight),
buttonsBar.leadingAnchor.constraint(equalTo: footerBar.leadingAnchor),
buttonsBar.trailingAnchor.constraint(equalTo: footerBar.trailingAnchor),
buttonsBar.topAnchor.constraint(equalTo: footerBar.topAnchor),
buttonsBar.heightAnchor.constraint(equalToConstant: ButtonsBar.buttonsHeight),
buttonsBar.heightAnchor.constraint(equalToConstant: HorizontalButtonsBar.buttonsHeight),
footerBar.leadingAnchor.constraint(equalTo: view.leadingAnchor),
footerBar.trailingAnchor.constraint(equalTo: view.trailingAnchor),
footerBar.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.bottomAnchor, constant: -ButtonsBar.buttonsHeight - ButtonsBar.marginAtBottomScreen),
footerBar.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.bottomAnchor, constant: -HorizontalButtonsBar.buttonsHeight - HorizontalButtonsBar.marginAtBottomScreen),
footerBar.bottomAnchor.constraint(equalTo: view.bottomAnchor),
roundedBackground.createConstraintsWithContainer(view: view),

@ -16,7 +16,7 @@ class ElevateWalletSecurityViewController: UIViewController {
private let imageView = UIImageView()
private let descriptionLabel = UILabel()
private let cancelButton = UIButton(type: .system)
private let buttonsBar = ButtonsBar(configuration: .primary(buttons: 1))
private let buttonsBar = HorizontalButtonsBar(configuration: .primary(buttons: 1))
private var imageViewDimension: CGFloat {
if ScreenChecker().isNarrowScreen {
@ -76,11 +76,11 @@ class ElevateWalletSecurityViewController: UIViewController {
buttonsBar.leadingAnchor.constraint(equalTo: footerBar.leadingAnchor),
buttonsBar.trailingAnchor.constraint(equalTo: footerBar.trailingAnchor),
buttonsBar.topAnchor.constraint(equalTo: footerBar.topAnchor),
buttonsBar.heightAnchor.constraint(equalToConstant: ButtonsBar.buttonsHeight),
buttonsBar.heightAnchor.constraint(equalToConstant: HorizontalButtonsBar.buttonsHeight),
footerBar.leadingAnchor.constraint(equalTo: view.leadingAnchor),
footerBar.trailingAnchor.constraint(equalTo: view.trailingAnchor),
footerBar.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.bottomAnchor, constant: -ButtonsBar.buttonsHeight - ButtonsBar.marginAtBottomScreen),
footerBar.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.bottomAnchor, constant: -HorizontalButtonsBar.buttonsHeight - HorizontalButtonsBar.marginAtBottomScreen),
footerBar.bottomAnchor.constraint(equalTo: view.bottomAnchor),
] + roundedBackground.createConstraintsWithContainer(view: view))
}

@ -129,8 +129,8 @@ private class EnterKeystorePasswordView: UIView {
return textField
}()
lazy var buttonsBar: ButtonsBar = {
let buttonsBar = ButtonsBar(configuration: .primary(buttons: 1))
lazy var buttonsBar: HorizontalButtonsBar = {
let buttonsBar = HorizontalButtonsBar(configuration: .primary(buttons: 1))
buttonsBar.configure()
return buttonsBar

@ -141,7 +141,7 @@ class ImportWalletViewController: UIViewController {
label.translatesAutoresizingMaskIntoConstraints = false
return label
}()
private let buttonsBar = ButtonsBar(configuration: .primary(buttons: 1))
private let buttonsBar = HorizontalButtonsBar(configuration: .primary(buttons: 1))
private var footerBottomConstraint: NSLayoutConstraint!
private lazy var keyboardChecker = KeyboardChecker(self)
private var mnemonicSuggestions: [String] = .init() {
@ -257,7 +257,7 @@ class ImportWalletViewController: UIViewController {
footerBar.leadingAnchor.constraint(equalTo: view.leadingAnchor),
footerBar.trailingAnchor.constraint(equalTo: view.trailingAnchor),
footerBar.heightAnchor.constraint(equalToConstant: ButtonsBar.buttonsHeight),
footerBar.heightAnchor.constraint(equalToConstant: HorizontalButtonsBar.buttonsHeight),
footerBottomConstraint,
scrollView.leadingAnchor.constraint(equalTo: view.leadingAnchor),

@ -12,7 +12,7 @@ class KeystoreBackupIntroductionViewController: UIViewController {
private let subtitleLabel = UILabel()
private let imageView = UIImageView()
private let descriptionLabel = UILabel()
private let buttonsBar = ButtonsBar(configuration: .primary(buttons: 1))
private let buttonsBar = HorizontalButtonsBar(configuration: .primary(buttons: 1))
private var imageViewDimension: CGFloat {
if ScreenChecker().isNarrowScreen {
@ -63,11 +63,11 @@ class KeystoreBackupIntroductionViewController: UIViewController {
buttonsBar.leadingAnchor.constraint(equalTo: footerBar.leadingAnchor),
buttonsBar.trailingAnchor.constraint(equalTo: footerBar.trailingAnchor),
buttonsBar.topAnchor.constraint(equalTo: footerBar.topAnchor),
buttonsBar.heightAnchor.constraint(equalToConstant: ButtonsBar.buttonsHeight),
buttonsBar.heightAnchor.constraint(equalToConstant: HorizontalButtonsBar.buttonsHeight),
footerBar.leadingAnchor.constraint(equalTo: view.leadingAnchor),
footerBar.trailingAnchor.constraint(equalTo: view.trailingAnchor),
footerBar.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.bottomAnchor, constant: -ButtonsBar.buttonsHeight - ButtonsBar.marginAtBottomScreen),
footerBar.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.bottomAnchor, constant: -HorizontalButtonsBar.buttonsHeight - HorizontalButtonsBar.marginAtBottomScreen),
footerBar.bottomAnchor.constraint(equalTo: view.bottomAnchor),
] + roundedBackground.createConstraintsWithContainer(view: view))
}

@ -29,7 +29,7 @@ class RenameWalletViewController: UIViewController {
return textField
}()
private let buttonsBar = ButtonsBar(configuration: .primary(buttons: 1))
private let buttonsBar = HorizontalButtonsBar(configuration: .primary(buttons: 1))
private var footerBottomConstraint: NSLayoutConstraint!
private lazy var keyboardChecker = KeyboardChecker(self)
private let roundedBackground = RoundedBackground()

@ -15,7 +15,7 @@ class SeedPhraseBackupIntroductionViewController: UIViewController {
private let imageView = UIImageView()
// NOTE: internal level, for test cases
let descriptionLabel1 = UILabel()
let buttonsBar = ButtonsBar(configuration: .primary(buttons: 1))
let buttonsBar = HorizontalButtonsBar(configuration: .primary(buttons: 1))
private var imageViewDimension: CGFloat {
return ScreenChecker.size(big: 250, medium: 250, small: 220)

@ -18,7 +18,7 @@ class ShowSeedPhraseIntroductionViewController: UIViewController {
private let subtitleLabel = UILabel()
private let imageView = UIImageView()
private let descriptionLabel1 = UILabel()
private let buttonsBar = ButtonsBar(configuration: .primary(buttons: 1))
private let buttonsBar = HorizontalButtonsBar(configuration: .primary(buttons: 1))
private var imageViewDimension: CGFloat {
return ScreenChecker.size(big: 250, medium: 250, small: 250)

@ -51,7 +51,7 @@ class ShowSeedPhraseViewController: UIViewController {
}
}
private let seedPhraseCollectionView = SeedPhraseCollectionView()
private let buttonsBar = ButtonsBar(configuration: .primary(buttons: 1))
private let buttonsBar = HorizontalButtonsBar(configuration: .primary(buttons: 1))
private var notDisplayingSeedPhrase: Bool {
switch state {
case .notDisplayedSeedPhrase:
@ -116,11 +116,11 @@ class ShowSeedPhraseViewController: UIViewController {
buttonsBar.leadingAnchor.constraint(equalTo: footerBar.leadingAnchor),
buttonsBar.trailingAnchor.constraint(equalTo: footerBar.trailingAnchor),
buttonsBar.topAnchor.constraint(equalTo: footerBar.topAnchor),
buttonsBar.heightAnchor.constraint(equalToConstant: ButtonsBar.buttonsHeight),
buttonsBar.heightAnchor.constraint(equalToConstant: HorizontalButtonsBar.buttonsHeight),
footerBar.leadingAnchor.constraint(equalTo: view.leadingAnchor),
footerBar.trailingAnchor.constraint(equalTo: view.trailingAnchor),
footerBar.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.bottomAnchor, constant: -ButtonsBar.buttonsHeight - ButtonsBar.marginAtBottomScreen),
footerBar.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.bottomAnchor, constant: -HorizontalButtonsBar.buttonsHeight - HorizontalButtonsBar.marginAtBottomScreen),
footerBar.bottomAnchor.constraint(equalTo: view.bottomAnchor),
roundedBackground.createConstraintsWithContainer(view: view),

@ -39,8 +39,7 @@ class VerifySeedPhraseViewController: UIViewController {
private let seedPhraseTextView = UITextView()
private let seedPhraseCollectionView = SeedPhraseCollectionView()
private let errorLabel = UILabel()
private let clearChooseSeedPhraseButton = UIButton(type: .system)
private let buttonsBar = ButtonsBar(configuration: .primary(buttons: 1))
private let buttonsBar = VerticalButtonsBar(numberOfButtons: 2)
private var state: State {
didSet {
switch state {
@ -92,6 +91,9 @@ class VerifySeedPhraseViewController: UIViewController {
}
}
private var clearChooseSeedPhraseButton: UIButton {
return buttonsBar.buttons[1]
}
private var continueButton: UIButton {
return buttonsBar.buttons[0]
}
@ -131,18 +133,8 @@ class VerifySeedPhraseViewController: UIViewController {
roundedBackground.addSubview(stackView)
clearChooseSeedPhraseButton.isHidden = true
clearChooseSeedPhraseButton.translatesAutoresizingMaskIntoConstraints = false
roundedBackground.addSubview(clearChooseSeedPhraseButton)
continueButton.isEnabled = false
let footerBar = UIView()
footerBar.translatesAutoresizingMaskIntoConstraints = false
footerBar.backgroundColor = .clear
roundedBackground.addSubview(footerBar)
footerBar.addSubview(buttonsBar)
roundedBackground.addSubview(buttonsBar)
seedPhraseTextView.becomeFirstResponder()
NSLayoutConstraint.activate([
@ -151,21 +143,11 @@ class VerifySeedPhraseViewController: UIViewController {
stackView.leadingAnchor.constraint(equalTo: view.leadingAnchor, constant: 20),
stackView.trailingAnchor.constraint(equalTo: view.trailingAnchor, constant: -20),
stackView.topAnchor.constraint(equalTo: view.topAnchor),
stackView.bottomAnchor.constraint(equalTo: clearChooseSeedPhraseButton.topAnchor, constant: -7),
clearChooseSeedPhraseButton.leadingAnchor.constraint(equalTo: footerBar.leadingAnchor, constant: 10),
clearChooseSeedPhraseButton.trailingAnchor.constraint(equalTo: footerBar.trailingAnchor, constant: -10),
clearChooseSeedPhraseButton.bottomAnchor.constraint(equalTo: footerBar.topAnchor, constant: -10),
buttonsBar.leadingAnchor.constraint(equalTo: footerBar.leadingAnchor),
buttonsBar.trailingAnchor.constraint(equalTo: footerBar.trailingAnchor),
buttonsBar.topAnchor.constraint(equalTo: footerBar.topAnchor),
buttonsBar.heightAnchor.constraint(equalToConstant: ButtonsBar.buttonsHeight),
stackView.bottomAnchor.constraint(equalTo: buttonsBar.topAnchor),
footerBar.leadingAnchor.constraint(equalTo: view.leadingAnchor),
footerBar.trailingAnchor.constraint(equalTo: view.trailingAnchor),
footerBar.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.bottomAnchor, constant: -ButtonsBar.buttonsHeight - ButtonsBar.marginAtBottomScreen),
footerBar.bottomAnchor.constraint(equalTo: view.bottomAnchor),
buttonsBar.leadingAnchor.constraint(equalTo: view.leadingAnchor, constant: 16.0),
buttonsBar.trailingAnchor.constraint(equalTo: view.trailingAnchor, constant: -16.0),
buttonsBar.bottomAnchor.constraint(equalTo: view.safeAreaLayoutGuide.bottomAnchor),
roundedBackground.createConstraintsWithContainer(view: view),
])
@ -252,7 +234,6 @@ class VerifySeedPhraseViewController: UIViewController {
clearChooseSeedPhraseButton.titleLabel?.font = viewModel.importKeystoreJsonButtonFont
clearChooseSeedPhraseButton.titleLabel?.adjustsFontSizeToFitWidth = true
buttonsBar.configure()
continueButton.setTitle(R.string.localizable.walletsVerifySeedPhraseTitle(), for: .normal)
continueButton.addTarget(self, action: #selector(verify), for: .touchUpInside)
}

@ -50,8 +50,8 @@ class WalletConnectConnectionTimeoutViewController: ModalViewController {
return v
}()
private lazy var buttonsBar: ButtonsBar = {
let buttonsBar = ButtonsBar(configuration: .primary(buttons: 1))
private lazy var buttonsBar: HorizontalButtonsBar = {
let buttonsBar = HorizontalButtonsBar(configuration: .primary(buttons: 1))
return buttonsBar
}()

@ -48,7 +48,7 @@ class WalletConnectSessionViewController: UIViewController {
private let dappUrlRow = WalletConnectRowView()
private let chainRow = WalletConnectRowView()
private let methodsRow = WalletConnectRowView()
private let buttonsBar = ButtonsBar(configuration: .empty)
private let buttonsBar = HorizontalButtonsBar(configuration: .empty)
var rpcServers: [RPCServer] {
viewModel.rpcServers
}

@ -16,7 +16,7 @@ protocol WalletConnectToSessionViewControllerDelegate: AnyObject {
class WalletConnectToSessionViewController: UIViewController {
private lazy var headerView = ConfirmationHeaderView(viewModel: .init(title: viewModel.navigationTitle))
private let buttonsBar = ButtonsBar(configuration: .custom(types: []))
private let buttonsBar = HorizontalButtonsBar(configuration: .custom(types: []))
private var viewModel: WalletConnectToSessionViewModel
private let stackView: UIStackView = {
@ -137,7 +137,7 @@ class WalletConnectToSessionViewController: UIViewController {
buttonsBar.topAnchor.constraint(equalTo: footerBar.topAnchor, constant: 20),
buttonsBar.leadingAnchor.constraint(equalTo: footerBar.leadingAnchor),
buttonsBar.trailingAnchor.constraint(equalTo: footerBar.trailingAnchor),
buttonsBar.heightAnchor.constraint(equalToConstant: ButtonsBar.buttonsHeight),
buttonsBar.heightAnchor.constraint(equalToConstant: HorizontalButtonsBar.buttonsHeight),
])
headerView.closeButton.addTarget(self, action: #selector(dismissViewController), for: .touchUpInside)

@ -0,0 +1,22 @@
//
// RepeatTests.swift
// AlphaWalletTests
//
// Created by Jerome Chan on 14/3/22.
//
import XCTest
@testable import AlphaWallet
class RepeatTests: XCTestCase {
func testRepeat() throws {
let repeatLoop = Int.random(in: 100...500)
var times = 0
repeatTimes(repeatLoop) {
times+=1
}
XCTAssertEqual(times, repeatLoop)
}
}
Loading…
Cancel
Save