diff options
| author | Jon Petersson <jon.petersson@mullvad.net> | 2026-02-27 16:25:03 +0100 |
|---|---|---|
| committer | Jon Petersson <jon.petersson@mullvad.net> | 2026-02-27 16:25:03 +0100 |
| commit | 6676acf301c498a8dcb71a35f409b89968b3a750 (patch) | |
| tree | d59d5398b6a3d03f2e2b04498e02d2546610ea3f /ios/MullvadVPN/Containers | |
| parent | fe84f9bad91e222ed768ede172fce1e2ada29bea (diff) | |
| download | mullvadvpn-debug-view.tar.xz mullvadvpn-debug-view.zip | |
Add debug viewdebug-view
Diffstat (limited to 'ios/MullvadVPN/Containers')
| -rw-r--r-- | ios/MullvadVPN/Containers/Root/HeaderBarView.swift | 4 | ||||
| -rw-r--r-- | ios/MullvadVPN/Containers/Root/RootContainerViewController.swift | 28 |
2 files changed, 30 insertions, 2 deletions
diff --git a/ios/MullvadVPN/Containers/Root/HeaderBarView.swift b/ios/MullvadVPN/Containers/Root/HeaderBarView.swift index adae341e5d..e7e08b066c 100644 --- a/ios/MullvadVPN/Containers/Root/HeaderBarView.swift +++ b/ios/MullvadVPN/Containers/Root/HeaderBarView.swift @@ -12,8 +12,6 @@ class HeaderBarView: UIView { private let brandNameImage = UIImage(named: "LogoText")? .withTintColor(UIColor.HeaderBar.brandNameColor, renderingMode: .alwaysOriginal) - private let logoImageView = UIImageView(image: UIImage(named: "LogoIcon")) - private lazy var brandNameImageView: UIImageView = { let imageView = UIImageView(image: brandNameImage) imageView.contentMode = .scaleAspectFill @@ -61,6 +59,8 @@ class HeaderBarView: UIView { return layer }() + let logoImageView = UIImageView(image: UIImage(named: "LogoIcon")) + let accountButton: UIButton = { let button = makeHeaderBarButton(with: UIImage.Buttons.account) button.setAccessibilityIdentifier(.accountButton) diff --git a/ios/MullvadVPN/Containers/Root/RootContainerViewController.swift b/ios/MullvadVPN/Containers/Root/RootContainerViewController.swift index e735264a29..680e08bbaf 100644 --- a/ios/MullvadVPN/Containers/Root/RootContainerViewController.swift +++ b/ios/MullvadVPN/Containers/Root/RootContainerViewController.swift @@ -62,6 +62,11 @@ extension RootContainment { } protocol RootContainerViewControllerDelegate: AnyObject, Sendable { + func rootContainerViewControllerShouldShowDebugView( + _ controller: RootContainerViewController, + animated: Bool + ) + func rootContainerViewControllerShouldShowAccount( _ controller: RootContainerViewController, animated: Bool @@ -293,6 +298,14 @@ class RootContainerViewController: UIViewController { updateHeaderBarHiddenFromChildPreferences(animated: UIView.areAnimationsEnabled) } + /// Request to display debug view + func showDebugView(animated: Bool) { + delegate?.rootContainerViewControllerShouldShowDebugView( + self, + animated: animated + ) + } + /// Request to display settings controller func showAccount(animated: Bool) { delegate?.rootContainerViewControllerShouldShowAccount( @@ -361,6 +374,15 @@ class RootContainerViewController: UIViewController { // Prevent automatic layout margins adjustment as we manually control them. headerBarView.insetsLayoutMarginsFromSafeArea = false + #if DEBUG + headerBarView.logoImageView.isUserInteractionEnabled = true + headerBarView.logoImageView.addGestureRecognizer( + UITapGestureRecognizer( + target: self, + action: #selector(handleLogoTap(_:))) + ) + #endif + headerBarView.accountButton.addTarget( self, action: #selector(handleAccountButtonTap), @@ -418,6 +440,12 @@ class RootContainerViewController: UIViewController { return button } + @objc private func handleLogoTap(_ gestureRecognizer: UIGestureRecognizer) { + if gestureRecognizer.state == .ended { + showDebugView(animated: true) + } + } + @objc private func handleAccountButtonTap() { showAccount(animated: true) } |
