From f42a1a049538e040a0dff2a9c54c55b904ec0124 Mon Sep 17 00:00:00 2001 From: Zeeshan Sheikh Date: Thu, 3 Oct 2024 19:58:41 +0500 Subject: [PATCH] Update SettingsVC.swift --- .../Settings/Controller/SettingsVC.swift | 68 +++++++++---------- 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/LocationServices/LocationServices/Scenes/Settings/Controller/SettingsVC.swift b/LocationServices/LocationServices/Scenes/Settings/Controller/SettingsVC.swift index 352935c1..6ec8738a 100644 --- a/LocationServices/LocationServices/Scenes/Settings/Controller/SettingsVC.swift +++ b/LocationServices/LocationServices/Scenes/Settings/Controller/SettingsVC.swift @@ -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 { @@ -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 { @@ -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) @@ -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) } } @@ -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 } } @@ -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 } }