diff --git a/accounts-journey/presentation/ui/account_detail/AccountDetailsUsageRowView.swift b/accounts-journey/presentation/ui/account_detail/AccountDetailsUsageRowView.swift index a1385d8..e0c200a 100644 --- a/accounts-journey/presentation/ui/account_detail/AccountDetailsUsageRowView.swift +++ b/accounts-journey/presentation/ui/account_detail/AccountDetailsUsageRowView.swift @@ -25,6 +25,7 @@ final class AccountDetailsUsageRowView: UIView { private lazy var stackView: UIStackView = { let view = UIStackView(arrangedSubviews: [titleLabel, subtitleLabel]) + view.translatesAutoresizingMaskIntoConstraints = false view.axis = .vertical view.distribution = .fill view.spacing = DesignSystem.shared.spacer.sm @@ -65,8 +66,11 @@ final class AccountDetailsUsageRowView: UIView { } private func setupConstraints() { - stackView.snp.makeConstraints { make in - make.edges.equalToSuperview() - } + NSLayoutConstraint.activate([ + stackView.topAnchor.constraint(equalTo: self.topAnchor), + stackView.bottomAnchor.constraint(equalTo: self.bottomAnchor), + stackView.leadingAnchor.constraint(equalTo: self.leadingAnchor), + stackView.trailingAnchor.constraint(equalTo: self.trailingAnchor) + ]) } } diff --git a/accounts-journey/presentation/ui/account_detail/AccountDetailsUsageView.swift b/accounts-journey/presentation/ui/account_detail/AccountDetailsUsageView.swift index f8cf651..adda0b8 100644 --- a/accounts-journey/presentation/ui/account_detail/AccountDetailsUsageView.swift +++ b/accounts-journey/presentation/ui/account_detail/AccountDetailsUsageView.swift @@ -7,7 +7,6 @@ import UIKit import Resolver -import SnapKit import BackbaseDesignSystem final class AccountDetailsUsageView: UIView { @@ -18,6 +17,7 @@ final class AccountDetailsUsageView: UIView { view.axis = .vertical view.alignment = .fill view.spacing = DesignSystem.shared.spacer.md + view.translatesAutoresizingMaskIntoConstraints = false return view }() @@ -29,6 +29,7 @@ final class AccountDetailsUsageView: UIView { private lazy var card: Card = { let card = Card(DesignSystem.shared.styles.cardView) + card.translatesAutoresizingMaskIntoConstraints = false return card }() @@ -66,16 +67,23 @@ final class AccountDetailsUsageView: UIView { // MARK: - Private Methods private func setupConstraints() { - titleLabel.snp.makeConstraints { make in - make.top.equalToSuperview() - make.leading.trailing.equalToSuperview().inset(DesignSystem.shared.spacer.lg) - } - card.snp.makeConstraints { make in - make.top.equalTo(titleLabel.snp.bottom).offset(DesignSystem.shared.spacer.xs) - make.leading.trailing.bottom.equalToSuperview().inset(DesignSystem.shared.spacer.md) - } - stackView.snp.makeConstraints { make in - make.edges.equalToSuperview().inset(DesignSystem.shared.spacer.md) - } + NSLayoutConstraint.activate([ + // Title Label + titleLabel.topAnchor.constraint(equalTo: self.topAnchor), + titleLabel.leadingAnchor.constraint(equalTo: self.leadingAnchor, constant: DesignSystem.shared.spacer.lg), + titleLabel.trailingAnchor.constraint(equalTo: self.trailingAnchor, constant: -DesignSystem.shared.spacer.lg), + + // Card + card.topAnchor.constraint(equalTo: titleLabel.bottomAnchor, constant: DesignSystem.shared.spacer.xs), + card.leadingAnchor.constraint(equalTo: self.leadingAnchor, constant: DesignSystem.shared.spacer.md), + card.trailingAnchor.constraint(equalTo: self.trailingAnchor, constant: -DesignSystem.shared.spacer.md), + card.bottomAnchor.constraint(equalTo: self.bottomAnchor, constant: -DesignSystem.shared.spacer.md), + + // StackView + stackView.topAnchor.constraint(equalTo: card.topAnchor, constant: DesignSystem.shared.spacer.md), + stackView.leadingAnchor.constraint(equalTo: card.leadingAnchor, constant: DesignSystem.shared.spacer.md), + stackView.trailingAnchor.constraint(equalTo: card.trailingAnchor, constant: -DesignSystem.shared.spacer.md), + stackView.bottomAnchor.constraint(equalTo: card.bottomAnchor, constant: -DesignSystem.shared.spacer.md) + ]) } } diff --git a/accounts-journey/presentation/ui/account_detail/AccountDetailsViewController.swift b/accounts-journey/presentation/ui/account_detail/AccountDetailsViewController.swift index 6d47b57..4148652 100644 --- a/accounts-journey/presentation/ui/account_detail/AccountDetailsViewController.swift +++ b/accounts-journey/presentation/ui/account_detail/AccountDetailsViewController.swift @@ -6,7 +6,6 @@ // import UIKit -import SnapKit import Combine import Resolver import BackbaseDesignSystem @@ -22,7 +21,11 @@ final class AccountDetailsViewController: UIViewController { // MARK: - UI Properties private var stateView: StateView? - private let loadingView = LoadingView() + private let loadingView: LoadingView = { + let view = LoadingView() + view.translatesAutoresizingMaskIntoConstraints = false + return view + }() private let header = SummaryStackView() @@ -31,12 +34,14 @@ final class AccountDetailsViewController: UIViewController { stackView.spacing = DesignSystem.shared.spacer.sm stackView.axis = .vertical stackView.distribution = .equalSpacing + stackView.translatesAutoresizingMaskIntoConstraints = false return stackView }() private lazy var scrollView: UIScrollView = { let scrollView = UIScrollView() scrollView.alwaysBounceVertical = true + scrollView.translatesAutoresizingMaskIntoConstraints = false return scrollView }() @@ -93,22 +98,26 @@ final class AccountDetailsViewController: UIViewController { } private func setupLayout() { - scrollView.snp.makeConstraints { make in - make.edges.width.equalToSuperview() - } - - stackView.snp.makeConstraints { make in - make.leading.trailing.width.equalToSuperview() - make.top.equalToSuperview().inset(DesignSystem.shared.spacer.sm) - make.bottom.equalToSuperview().inset(DesignSystem.shared.spacer.md) - } - - loadingView.snp.makeConstraints { make in - make.leading.trailing.equalToSuperview() - .inset(DesignSystem.shared.spacer.md) - make.centerY.equalToSuperview() - } - + NSLayoutConstraint.activate([ + // ScrollView + scrollView.topAnchor.constraint(equalTo: view.topAnchor), + scrollView.bottomAnchor.constraint(equalTo: view.bottomAnchor), + scrollView.leadingAnchor.constraint(equalTo: view.leadingAnchor), + scrollView.trailingAnchor.constraint(equalTo: view.trailingAnchor), + scrollView.widthAnchor.constraint(equalTo: view.widthAnchor), + + // StackView + stackView.leadingAnchor.constraint(equalTo: scrollView.leadingAnchor), + stackView.trailingAnchor.constraint(equalTo: scrollView.trailingAnchor), + stackView.widthAnchor.constraint(equalTo: scrollView.widthAnchor), + stackView.topAnchor.constraint(equalTo: scrollView.topAnchor, constant: DesignSystem.shared.spacer.sm), + stackView.bottomAnchor.constraint(equalTo: scrollView.bottomAnchor, constant: -DesignSystem.shared.spacer.md), + + // LoadingView + loadingView.leadingAnchor.constraint(equalTo: view.leadingAnchor, constant: DesignSystem.shared.spacer.md), + loadingView.trailingAnchor.constraint(equalTo: view.trailingAnchor, constant: -DesignSystem.shared.spacer.md), + loadingView.centerYAnchor.constraint(equalTo: view.centerYAnchor) + ]) } private func setupBindings() { @@ -246,16 +255,12 @@ final class AccountDetailsViewController: UIViewController { stateView.accessibilityIdentifier = "AccountDetailsStateView" view.addSubview(stateView) - stateView.snp.makeConstraints { make in - make - .leading - .trailing - .equalToSuperview() - .inset(DesignSystem.shared.spacer.md) - make - .centerY - .equalToSuperview() - } + + NSLayoutConstraint.activate([ + stateView.leadingAnchor.constraint(equalTo: view.leadingAnchor, constant: DesignSystem.shared.spacer.md), + stateView.trailingAnchor.constraint(equalTo: view.trailingAnchor, constant: -DesignSystem.shared.spacer.md), + stateView.centerYAnchor.constraint(equalTo: view.centerYAnchor) + ]) } private func removeStateView() { diff --git a/accounts-journey/presentation/ui/accounts_list/AccountListItemTableCell.swift b/accounts-journey/presentation/ui/accounts_list/AccountListItemTableCell.swift index 96508f7..82016d9 100644 --- a/accounts-journey/presentation/ui/accounts_list/AccountListItemTableCell.swift +++ b/accounts-journey/presentation/ui/accounts_list/AccountListItemTableCell.swift @@ -7,7 +7,6 @@ import UIKit import Resolver -import SnapKit import BackbaseDesignSystem final class AccountListItemTableCell: UITableViewCell, Reusable, CellCornerModifier { @@ -21,6 +20,7 @@ final class AccountListItemTableCell: UITableViewCell, Reusable, CellCornerModif stackView.alignment = .leading stackView.spacing = DesignSystem.shared.sizer.sm stackView.backgroundColor = .clear + stackView.translatesAutoresizingMaskIntoConstraints = false return stackView }() @@ -99,12 +99,13 @@ final class AccountListItemTableCell: UITableViewCell, Reusable, CellCornerModif infoStackView.addArrangedSubview(accountNameLabel) infoStackView.addArrangedSubview(accountStateLabel) infoStackView.addArrangedSubview(accountBalanceLabel) - - containerStackView.snp.makeConstraints { make in - make.leading.top.trailing.bottom - .equalToSuperview().inset(DesignSystem.shared.spacer.md) - } - + + NSLayoutConstraint.activate([ + containerStackView.leadingAnchor.constraint(equalTo: contentView.leadingAnchor, constant: DesignSystem.shared.spacer.md), + containerStackView.topAnchor.constraint(equalTo: contentView.topAnchor, constant: DesignSystem.shared.spacer.md), + containerStackView.trailingAnchor.constraint(equalTo: contentView.trailingAnchor, constant: -DesignSystem.shared.spacer.md), + containerStackView.bottomAnchor.constraint(equalTo: contentView.bottomAnchor, constant: -DesignSystem.shared.spacer.md) + ]) } func setup(_ account: AccountUIModel?) { diff --git a/accounts-journey/presentation/ui/accounts_list/AccountListSearchBarHeaderView.swift b/accounts-journey/presentation/ui/accounts_list/AccountListSearchBarHeaderView.swift index c55d91f..bf0af0b 100644 --- a/accounts-journey/presentation/ui/accounts_list/AccountListSearchBarHeaderView.swift +++ b/accounts-journey/presentation/ui/accounts_list/AccountListSearchBarHeaderView.swift @@ -9,7 +9,11 @@ import Combine final class AccountListSearchBarHeaderView: UIView { private let configuration: AccountsJourney.Configuration = Resolver.resolve() - private let searchBar = UISearchBar(frame: .zero) + private let searchBar: UISearchBar = { + let view = UISearchBar(frame: .zero) + view.translatesAutoresizingMaskIntoConstraints = false + return view + }() let textChangeSubject = PassthroughSubject() init() { @@ -25,15 +29,12 @@ final class AccountListSearchBarHeaderView: UIView { private func setupSubviews() { addSubview(searchBar) - searchBar.snp.makeConstraints { make in - make.top.equalToSuperview() - make.bottom - .equalToSuperview() - .inset(DesignSystem.shared.spacer.md) - make.leading.trailing - .equalToSuperview() - .inset(-DesignSystem.shared.spacer.sm) - } + NSLayoutConstraint.activate([ + searchBar.topAnchor.constraint(equalTo: self.topAnchor), + searchBar.bottomAnchor.constraint(equalTo: self.bottomAnchor, constant: -DesignSystem.shared.spacer.md), + searchBar.leadingAnchor.constraint(equalTo: self.leadingAnchor, constant: DesignSystem.shared.spacer.sm), + searchBar.trailingAnchor.constraint(equalTo: self.trailingAnchor, constant: -DesignSystem.shared.spacer.sm) + ]) } private func setupConfiguration() { diff --git a/accounts-journey/presentation/ui/accounts_list/AccountsListViewController.swift b/accounts-journey/presentation/ui/accounts_list/AccountsListViewController.swift index 6e904e9..e8bceec 100644 --- a/accounts-journey/presentation/ui/accounts_list/AccountsListViewController.swift +++ b/accounts-journey/presentation/ui/accounts_list/AccountsListViewController.swift @@ -10,7 +10,6 @@ import Combine import BackbaseObservability import Resolver import BackbaseDesignSystem -import SnapKit final class AccountsListViewController: UIViewController { @@ -35,15 +34,22 @@ final class AccountsListViewController: UIViewController { // MARK: - UI Properties private var refreshControl: UIRefreshControl { let refreshControl = UIRefreshControl() + refreshControl.translatesAutoresizingMaskIntoConstraints = false refreshControl.addTarget(self, action: #selector(handleRefreshControl), for: .valueChanged) return refreshControl } private var stateView: StateView? - private let loadingView = LoadingView() + + private let loadingView: LoadingView = { + let view = LoadingView() + view.translatesAutoresizingMaskIntoConstraints = false + return view + }() private lazy var accountsListTableView: UITableView = { let table = UITableView() + table.translatesAutoresizingMaskIntoConstraints = false let inset = DesignSystem.shared.spacer.md table.contentInset = UIEdgeInsets(top: inset, left: 0, bottom: inset, right: 0) table.alwaysBounceVertical = false @@ -83,20 +89,15 @@ final class AccountsListViewController: UIViewController { } private func setupLayout() { - accountsListTableView.snp.makeConstraints { make in - make.trailing.leading - .equalToSuperview() - .inset(DesignSystem.shared.spacer.md) - make.top.bottom.equalTo(view.safeAreaLayoutGuide) - } - - loadingView.snp.makeConstraints { make in - make.leading.trailing - .equalToSuperview() - .inset(DesignSystem.shared.spacer.md) - make.centerY - .equalToSuperview() - } + NSLayoutConstraint.activate([ + accountsListTableView.leadingAnchor.constraint(equalTo: view.leadingAnchor, constant: DesignSystem.shared.spacer.md), + accountsListTableView.trailingAnchor.constraint(equalTo: view.trailingAnchor, constant: -DesignSystem.shared.spacer.md), + accountsListTableView.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor), + accountsListTableView.bottomAnchor.constraint(equalTo: view.safeAreaLayoutGuide.bottomAnchor), + loadingView.leadingAnchor.constraint(equalTo: view.leadingAnchor, constant: DesignSystem.shared.spacer.md), + loadingView.trailingAnchor.constraint(equalTo: view.trailingAnchor, constant: -DesignSystem.shared.spacer.md), + loadingView.centerYAnchor.constraint(equalTo: view.centerYAnchor) + ]) } private func setupBindings() { @@ -175,20 +176,21 @@ final class AccountsListViewController: UIViewController { // Add state view to the view hierarchy if isEmptyState { accountsListTableView.addSubview(stateView) - stateView.snp.makeConstraints { make in - make.center.equalToSuperview() - } + NSLayoutConstraint.activate([ + stateView.centerXAnchor.constraint(equalTo: view.centerXAnchor), + stateView.centerYAnchor.constraint(equalTo: view.superview!.centerYAnchor) + ]) } else { // HIDE TABLE accountsListTableView.isHidden = true // Add state view to the view hierarchy view.addSubview(stateView) - - stateView.snp.makeConstraints { make in - make.leading.trailing.equalToSuperview() - .inset(DesignSystem.shared.spacer.md) - make.centerY.equalToSuperview() - } + + NSLayoutConstraint.activate([ + stateView.leadingAnchor.constraint(equalTo: view.leadingAnchor, constant: DesignSystem.shared.spacer.md), + stateView.trailingAnchor.constraint(equalTo: view.trailingAnchor, constant: -DesignSystem.shared.spacer.md), + stateView.centerYAnchor.constraint(equalTo: view.centerYAnchor) + ]) } } diff --git a/accounts-journey/presentation/ui/accounts_list/ReusableViews/LoadingView.swift b/accounts-journey/presentation/ui/accounts_list/ReusableViews/LoadingView.swift index eedf285..88289aa 100644 --- a/accounts-journey/presentation/ui/accounts_list/ReusableViews/LoadingView.swift +++ b/accounts-journey/presentation/ui/accounts_list/ReusableViews/LoadingView.swift @@ -8,15 +8,21 @@ import Foundation import UIKit import BackbaseDesignSystem -import SnapKit import Resolver final class LoadingView: UIView { - private lazy var containerView = UIView() + + private lazy var containerView: UIView = { + let view = UIView() + view.translatesAutoresizingMaskIntoConstraints = false + return view + }() + private lazy var activityIndicator: UIActivityIndicatorView = { let activityIndicator = UIActivityIndicatorView() activityIndicator.style = .large activityIndicator.tintColor = DesignSystem.shared.colors.primary.lighter + activityIndicator.translatesAutoresizingMaskIntoConstraints = false return activityIndicator }() @@ -49,17 +55,15 @@ final class LoadingView: UIView { } private func configureDesign() { addSubview(containerView) - - containerView.snp.makeConstraints { make in - make.centerX.equalToSuperview() - make.centerY.equalToSuperview() - } containerView.addSubview(activityIndicator) - activityIndicator.snp.makeConstraints { make in - make.top.equalToSuperview() - make.centerX.equalToSuperview() - make.width.equalTo(DesignSystem.shared.sizer.xl) - make.height.equalTo(DesignSystem.shared.sizer.xl) - } + + NSLayoutConstraint.activate([ + containerView.centerXAnchor.constraint(equalTo: self.centerXAnchor ), + containerView.centerYAnchor.constraint(equalTo: self.centerYAnchor), + activityIndicator.topAnchor.constraint(equalTo: containerView.topAnchor), + activityIndicator.centerXAnchor.constraint(equalTo: containerView.centerXAnchor), + activityIndicator.widthAnchor.constraint(equalToConstant: DesignSystem.shared.sizer.xl), + activityIndicator.heightAnchor.constraint(equalToConstant: DesignSystem.shared.sizer.xl) + ]) } } diff --git a/app/Extensions/AppDelegate+Workspaces.swift b/app/Extensions/AppDelegate+Workspaces.swift index 54a667f..f079ceb 100644 --- a/app/Extensions/AppDelegate+Workspaces.swift +++ b/app/Extensions/AppDelegate+Workspaces.swift @@ -38,6 +38,7 @@ extension AppDelegate { func getWorkspacesConfiguration() -> Workspaces.Configuration { var configuration = Workspaces.Configuration() let didSelect = configuration.selector.router.didSelectWorkspaceV2 + configuration.selector.autoSelectSingleWorkspace = true let dashboardHelper = DashboardHelper() configuration.selector.router.didSelectWorkspaceV2 = { [weak self] navigationController in diff --git a/app/ViewControllers/DemoViewController.swift b/app/ViewControllers/DemoViewController.swift index 340456f..bcb94ee 100644 --- a/app/ViewControllers/DemoViewController.swift +++ b/app/ViewControllers/DemoViewController.swift @@ -21,9 +21,12 @@ final class DemoViewController: UIViewController { let stateView = getStateView() stateView.translatesAutoresizingMaskIntoConstraints = false view.addSubview(stateView) - stateView.snp.makeConstraints { make in - make.trailing.leading.centerY.equalToSuperview() - } + + NSLayoutConstraint.activate([ + stateView.trailingAnchor.constraint(equalTo: view.trailingAnchor), + stateView.leadingAnchor.constraint(equalTo: view.leadingAnchor), + stateView.centerYAnchor.constraint(equalTo: view.centerYAnchor), + ]) view.backgroundColor = DesignSystem.shared.colors.surfacePrimary.default } diff --git a/appUITests/Tests/AccountsTests/AccountsListTests.swift b/appUITests/Tests/AccountsTests/AccountsListTests.swift index 2a8f562..2fbab65 100644 --- a/appUITests/Tests/AccountsTests/AccountsListTests.swift +++ b/appUITests/Tests/AccountsTests/AccountsListTests.swift @@ -17,7 +17,6 @@ final class AccountsListTests: BaseTestCase { override func setUp() { super.setUp() LoginScreen().authenticateUserWith(name: UserEnrollment.userName, password: UserEnrollment.password) - WorkspacesSelectorScreen().selectServiceAgreementIfNeeded(workspaceName: UserEnrollment.defaultWorkspace) } func testAccountIsDisplayedInTheList() {