Skip to content

Commit

Permalink
Update SettingsVC.swift
Browse files Browse the repository at this point in the history
  • Loading branch information
zeeshanmakeen committed Oct 3, 2024
1 parent 2714b4d commit a6b1fae
Showing 1 changed file with 22 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@ final class SettingsVC: UIViewController {
return view
}()

// private lazy var disconnectButton: SettingsDisconnectButtonView = {
// let view = SettingsDisconnectButtonView()
// view.isUserInteractionEnabled = true
// let tap = UITapGestureRecognizer(target: self, action: #selector(disconnectAction))
// view.addGestureRecognizer(tap)
// return view
// }()
private lazy var disconnectButton: SettingsDisconnectButtonView = {
let view = SettingsDisconnectButtonView()
view.isUserInteractionEnabled = true
let tap = UITapGestureRecognizer(target: self, action: #selector(disconnectAction))
view.addGestureRecognizer(tap)
return view
}()

var viewModel: SettingsViewModelProtocol! {
didSet {
Expand Down Expand Up @@ -86,26 +86,27 @@ final class SettingsVC: UIViewController {

private func setupViews() {
self.view.addSubview(headerTitle)
//self.view.addSubview(disconnectButton)
self.view.addSubview(logoutButton)
self.view.addSubview(tableView)
self.view.addSubview(disconnectButton)
self.view.addSubview(logoutButton)

tableView.accessibilityIdentifier = "settingsTableView"
headerTitle.snp.makeConstraints {
$0.top.equalTo(self.view.safeAreaLayoutGuide)
$0.leading.equalToSuperview().offset(Constants.horizontalOffset)
$0.trailing.equalToSuperview()
}

// disconnectButton.snp.makeConstraints {
// $0.height.equalTo(72)
// $0.bottom.equalTo(view.safeAreaInsets).offset(-16)
// $0.leading.trailing.equalToSuperview()
// }

logoutButton.snp.makeConstraints {
$0.height.equalTo(72)
$0.leading.trailing.equalToSuperview()
$0.bottom.equalTo(view.safeAreaInsets).offset(-16)
}

disconnectButton.snp.makeConstraints {
$0.height.equalTo(72)
$0.leading.trailing.equalToSuperview()
$0.bottom.equalTo(logoutButton.snp.top)
}

tableView.snp.makeConstraints {
Expand All @@ -115,7 +116,7 @@ final class SettingsVC: UIViewController {
} else {
$0.leading.trailing.equalToSuperview().inset(Constants.horizontalOffset)
}
$0.bottom.equalTo(logoutButton.snp.top)
$0.bottom.equalTo(disconnectButton.snp.top)
}
}

Expand All @@ -124,15 +125,15 @@ final class SettingsVC: UIViewController {
}

@objc private func authorizationStatusChanged(_ notification: Notification) {
DispatchQueue.main.async {
self.updateLogoutButtonVisibility()
}
self.updateLogoutButtonVisibility()
}

private func updateLogoutButtonVisibility() {
// show logout button only if we are not signed in
self.logoutButton.isHidden = UserDefaultsHelper.getAppState() != .loggedIn
//self.disconnectButton.isHidden = UserDefaultsHelper.getAppState() != .customAWSConnected
DispatchQueue.main.async {
self.logoutButton.isHidden = UserDefaultsHelper.getAppState() != .loggedIn
self.disconnectButton.isHidden = UserDefaultsHelper.getAppState() != .customAWSConnected
}
}
}

Expand Down

0 comments on commit a6b1fae

Please sign in to comment.