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 33a9992 commit f42a1a0
Showing 1 changed file with 34 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,21 +32,21 @@ final class SettingsVC: UIViewController {
return tableView
}()

// private lazy var logoutButton: SettingsLogoutButtonView = {
// let view = SettingsLogoutButtonView()
// view.isUserInteractionEnabled = true
// let tap = UITapGestureRecognizer(target: self, action: #selector(logoutAction))
// 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
// }()
private lazy var logoutButton: SettingsLogoutButtonView = {
let view = SettingsLogoutButtonView()
view.isUserInteractionEnabled = true
let tap = UITapGestureRecognizer(target: self, action: #selector(logoutAction))
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,8 +86,8 @@ final class SettingsVC: UIViewController {

private func setupViews() {
self.view.addSubview(headerTitle)
// self.view.addSubview(disconnectButton)
// self.view.addSubview(logoutButton)
self.view.addSubview(disconnectButton)
self.view.addSubview(logoutButton)
self.view.addSubview(tableView)
tableView.accessibilityIdentifier = "settingsTableView"
headerTitle.snp.makeConstraints {
Expand All @@ -96,17 +96,17 @@ final class SettingsVC: UIViewController {
$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.bottom.equalTo(view.safeAreaInsets).offset(-16)
// $0.leading.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.bottom.equalTo(disconnectButton.snp.top)
$0.leading.trailing.equalToSuperview()
}

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

Expand All @@ -125,14 +125,14 @@ 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
self.logoutButton.isHidden = UserDefaultsHelper.getAppState() != .loggedIn
self.disconnectButton.isHidden = UserDefaultsHelper.getAppState() != .customAWSConnected
}
}

Expand All @@ -145,7 +145,7 @@ extension SettingsVC: SettingsViewModelOutputDelegate {

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

0 comments on commit f42a1a0

Please sign in to comment.