summaryrefslogtreecommitdiffhomepage
path: root/ios/MullvadVPN/Containers/Root
diff options
context:
space:
mode:
Diffstat (limited to 'ios/MullvadVPN/Containers/Root')
-rw-r--r--ios/MullvadVPN/Containers/Root/HeaderBarView.swift4
-rw-r--r--ios/MullvadVPN/Containers/Root/RootContainerViewController.swift28
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)
}