diff --git a/IVPNClient/Scenes/AccountScreen/AccountViewController.swift b/IVPNClient/Scenes/AccountScreen/AccountViewController.swift index 5f251cd8..91487df3 100644 --- a/IVPNClient/Scenes/AccountScreen/AccountViewController.swift +++ b/IVPNClient/Scenes/AccountScreen/AccountViewController.swift @@ -79,7 +79,7 @@ class AccountViewController: UITableViewController { @IBAction func toggleAccountHidden(_ sender: Any) { let hidden = UserDefaults.shared.isAccountHidden - accountView.toggleAccountVisibility(hide: hidden) + accountView.toggleAccountVisibility(hide: !hidden) UserDefaults.shared.set(!hidden, forKey: UserDefaults.Key.isAccountHidden) } @@ -96,7 +96,6 @@ class AccountViewController: UITableViewController { override func viewDidAppear(_ animated: Bool) { super.viewDidAppear(animated) accountView.initQRCode(viewModel: viewModel) - accountView.toggleAccountVisibility(hide: UserDefaults.shared.isAccountHidden) sessionManager.getSessionStatus() } diff --git a/IVPNClient/Scenes/AccountScreen/View/AccountView.swift b/IVPNClient/Scenes/AccountScreen/View/AccountView.swift index 5c608972..63229774 100644 --- a/IVPNClient/Scenes/AccountScreen/View/AccountView.swift +++ b/IVPNClient/Scenes/AccountScreen/View/AccountView.swift @@ -59,25 +59,29 @@ class AccountView: UITableView { header.frame = CGRect(x: 0, y: 0, width: Int(header.frame.width), height: headerHeight) reloadData() layoutIfNeeded() + toggleAccountVisibility(hide: UserDefaults.shared.isAccountHidden) } func initQRCode(viewModel: AccountViewModel) { qrCodeImage.image = UIImage.generateQRCode(from: viewModel.accountId) + toggleAccountVisibility(hide: UserDefaults.shared.isAccountHidden) } func toggleAccountVisibility(hide: Bool) { if hide { - hideAccountButton.setImage(UIImage.init(systemName: "eye.fill"), for: .normal) - accountIdLabel.removeBlur() - accountIdLabel.alpha = 1 - qrCodeImage.removeBlur() - qrCodeImage.alpha = 1 - } else { hideAccountButton.setImage(UIImage.init(systemName: "eye.slash.fill"), for: .normal) + accountIdLabel.removeBlur() accountIdLabel.addBlur(2) accountIdLabel.alpha = 0.7 + qrCodeImage.removeBlur() qrCodeImage.addBlur(2) qrCodeImage.alpha = 0.5 + } else { + hideAccountButton.setImage(UIImage.init(systemName: "eye.fill"), for: .normal) + accountIdLabel.removeBlur() + accountIdLabel.alpha = 1 + qrCodeImage.removeBlur() + qrCodeImage.alpha = 1 } }