Skip to content

Commit 40cc267

Browse files
#2705 Fix UI elements to be compatible with iOS 26 (#2706)
* add ios 26 compatibility * Revert "add ios 26 compatibility" This reverts commit 0400c59. * fix: ios 26 compatability * fix: ios26 * fix: pr reviews
1 parent fdf4408 commit 40cc267

9 files changed

Lines changed: 102 additions & 53 deletions

File tree

FlowCrypt.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved

Lines changed: 25 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

FlowCrypt/Controllers/Search/SearchViewController.swift

Lines changed: 27 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -38,37 +38,51 @@ class SearchViewController: InboxViewController {
3838

3939
override func setupNavigationBar() {
4040
title = "search_title".localized
41-
navigationItem.titleView = searchController.searchBar
4241
navigationItem.rightBarButtonItems = nil
4342
navigationItem.leftBarButtonItem = .defaultBackButton {
4443
self.navigationController?.popViewController(animated: true)
4544
}
45+
46+
if #available(iOS 26.0, *) {
47+
navigationItem.searchController = searchController
48+
navigationItem.hidesSearchBarWhenScrolling = false
49+
} else {
50+
navigationItem.titleView = searchController.searchBar
51+
}
4652
}
4753

4854
private func setupSearch() {
4955
searchController.do {
5056
$0.delegate = self
5157
$0.searchResultsUpdater = self
5258
$0.hidesNavigationBarDuringPresentation = false
53-
$0.searchBar.tintColor = .white
54-
$0.searchBar.setImage(UIImage(systemName: "magnifyingglass")?.tinted(.white), for: .search, state: .normal)
55-
$0.searchBar.setImage(UIImage(systemName: "xmark")?.tinted(.white), for: .clear, state: .normal)
5659
$0.searchBar.delegate = self
57-
$0.searchBar.searchTextField.textColor = .white
5860
}
61+
62+
if #unavailable(iOS 26.0) {
63+
searchController.do {
64+
$0.searchBar.tintColor = .white
65+
$0.searchBar.setImage(UIImage(systemName: "magnifyingglass")?.tinted(.white), for: .search, state: .normal)
66+
$0.searchBar.setImage(UIImage(systemName: "xmark")?.tinted(.white), for: .clear, state: .normal)
67+
$0.searchBar.searchTextField.textColor = .white
68+
}
69+
}
70+
5971
update(searchController: searchController)
6072
definesPresentationContext = true
6173
}
6274

6375
private func update(searchController: UISearchController) {
64-
searchController.searchBar.searchTextField.attributedPlaceholder = "search_placeholder"
65-
.localized
66-
.attributed(
67-
.regular(14),
68-
color: UIColor.white.withAlphaComponent(0.7),
69-
alignment: .left
70-
)
71-
searchController.searchBar.searchTextField.textColor = .white
76+
if #unavailable(iOS 26.0) {
77+
searchController.searchBar.searchTextField.attributedPlaceholder = "search_placeholder"
78+
.localized
79+
.attributed(
80+
.regular(14),
81+
color: UIColor.white.withAlphaComponent(0.7),
82+
alignment: .left
83+
)
84+
searchController.searchBar.searchTextField.textColor = .white
85+
}
7286
searchController.searchBar.searchTextField.accessibilityIdentifier = "aid-search-all-emails-field"
7387
}
7488
}

FlowCrypt/Controllers/Setup/SetupManuallyEnterPassPhraseViewController.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ final class SetupManuallyEnterPassPhraseViewController: TableNodeViewController,
6868
override func viewWillAppear(_ animated: Bool) {
6969
super.viewWillAppear(animated)
7070
navigationController?.setNavigationBarHidden(false, animated: animated)
71-
navigationController?.navigationBar.barStyle = .black
7271
}
7372

7473
private func setupUI() {

FlowCrypt/Controllers/Setup/SetupManuallyImportKeyViewController.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ final class SetupManuallyImportKeyViewController: TableNodeViewController {
6060
override func viewWillAppear(_ animated: Bool) {
6161
super.viewWillAppear(animated)
6262
navigationController?.setNavigationBarHidden(false, animated: animated)
63-
navigationController?.navigationBar.barStyle = .black
6463
}
6564

6665
override func viewDidAppear(_ animated: Bool) {

FlowCrypt/Controllers/SideMenu/Main/SideMenuNavigationController.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,10 @@ final class SideMenuNavigationController: ENSideMenuNavigationController {
2424
}
2525

2626
override var preferredStatusBarStyle: UIStatusBarStyle {
27-
.lightContent
27+
if #available(iOS 26.0, *) {
28+
return .default
29+
}
30+
return .lightContent
2831
}
2932

3033
override var preferredStatusBarUpdateAnimation: UIStatusBarAnimation {

FlowCrypt/Controllers/SideMenu/NavigationController/MainNavigationController.swift

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -61,18 +61,30 @@ extension UINavigationController {
6161
.then { $0.title = "" }
6262
navigationBar.backItem?.title = ""
6363

64-
let appearance = UINavigationBarAppearance()
65-
appearance.configureWithOpaqueBackground()
66-
appearance.backgroundColor = .main
67-
appearance.titleTextAttributes = [.foregroundColor: UIColor.white]
68-
navigationBar.standardAppearance = appearance
69-
navigationBar.scrollEdgeAppearance = appearance
70-
navigationBar.compactScrollEdgeAppearance = appearance
64+
if #available(iOS 26.0, *) {
65+
let appearance = UINavigationBarAppearance()
66+
appearance.configureWithTransparentBackground()
67+
navigationBar.standardAppearance = appearance
68+
navigationBar.scrollEdgeAppearance = appearance
69+
navigationBar.compactAppearance = appearance
70+
navigationBar.compactScrollEdgeAppearance = appearance
7171

72-
navigationBar.do {
73-
$0.barTintColor = .main
74-
$0.tintColor = .white
75-
$0.titleTextAttributes = [.foregroundColor: UIColor.white]
72+
navigationBar.tintColor = .main
73+
} else {
74+
let appearance = UINavigationBarAppearance()
75+
appearance.configureWithOpaqueBackground()
76+
appearance.backgroundColor = .main
77+
appearance.titleTextAttributes = [.foregroundColor: UIColor.white]
78+
navigationBar.standardAppearance = appearance
79+
navigationBar.scrollEdgeAppearance = appearance
80+
navigationBar.compactAppearance = appearance
81+
navigationBar.compactScrollEdgeAppearance = appearance
82+
83+
navigationBar.do {
84+
$0.barTintColor = .main
85+
$0.tintColor = .white
86+
$0.titleTextAttributes = [.foregroundColor: UIColor.white]
87+
}
7688
}
7789
}
7890
}

FlowCrypt/Info.plist

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
33
<plist version="1.0">
44
<dict>
5-
<key>UIDesignRequiresCompatibility</key>
6-
<true/>
75
<key>CFBundleDevelopmentRegion</key>
86
<string>en</string>
97
<key>CFBundleDisplayName</key>

FlowCryptUI/Nodes/TableViewController.swift

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,16 @@ open class TableNodeViewController: ASDKViewController<TableNode> {
5252

5353
public extension UINavigationItem {
5454
func setAccessibility(id: String?) {
55+
let titleColor: UIColor
56+
if #available(iOS 26.0, *) {
57+
titleColor = .main
58+
} else {
59+
titleColor = .white
60+
}
5561
let titleLabel = UILabel()
5662
titleLabel.attributedText = id?.attributed(
5763
.medium(16),
58-
color: .white,
64+
color: titleColor,
5965
alignment: .center
6066
)
6167
titleLabel.sizeToFit()

FlowCryptUI/Views/NavigationBarActionButton.swift

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,22 @@ public final class NavigationBarActionButton: UIBarButtonItem {
1818
public convenience init(imageSystemName: String, action: (() -> Void)?, accessibilityIdentifier: String? = nil) {
1919
self.init()
2020
onAction = action
21-
customView = UIButton(type: .system).with {
22-
$0.contentHorizontalAlignment = .left
23-
$0.setImage(UIImage(systemName: imageSystemName), for: .normal)
24-
$0.frame.size = Constants.buttonSize
25-
$0.addTarget(self, action: #selector(tap), for: .touchUpInside)
26-
$0.accessibilityIdentifier = accessibilityIdentifier
27-
$0.isAccessibilityElement = true
21+
if #available(iOS 26.0, *) {
22+
image = UIImage(systemName: imageSystemName)
23+
tintColor = .main
24+
target = self
25+
self.action = #selector(tap)
26+
self.accessibilityIdentifier = accessibilityIdentifier
27+
isAccessibilityElement = true
28+
} else {
29+
customView = UIButton(type: .system).with {
30+
$0.contentHorizontalAlignment = .left
31+
$0.setImage(UIImage(systemName: imageSystemName), for: .normal)
32+
$0.frame.size = Constants.buttonSize
33+
$0.addTarget(self, action: #selector(tap), for: .touchUpInside)
34+
$0.accessibilityIdentifier = accessibilityIdentifier
35+
$0.isAccessibilityElement = true
36+
}
2837
}
2938
}
3039

0 commit comments

Comments
 (0)