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 5e2fc54 commit d2d45b8
Showing 1 changed file with 14 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,27 +85,34 @@ final class SettingsVC: UIViewController {
}

private func setupViews() {
let stackView = UIStackView()
stackView.addSubview(disconnectButton)
stackView.addSubview(logoutButton)

self.view.addSubview(headerTitle)
self.view.addSubview(tableView)
self.view.addSubview(disconnectButton)
self.view.addSubview(logoutButton)
self.view.addSubview(stackView)

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

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

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

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

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

Expand All @@ -130,8 +137,8 @@ final class SettingsVC: UIViewController {
private func updateLogoutButtonVisibility() {
// show logout button only if we are not signed in
DispatchQueue.main.async {
//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 Down

0 comments on commit d2d45b8

Please sign in to comment.