Skip to content

Commit cdb70f4

Browse files
authored
RootTabBar: Add iOS 26 Liquid Glass support and fix Settings tab label visibility (#1223)
- Add menuAppearance theme property support to RootTabBarController - Set overrideUserInterfaceStyle based on theme's menuAppearance - Clear appearance properties for iOS 26+ to enable Liquid Glass effect (fix opaque background issue) - Maintain legacy appearance configuration for iOS 18 and earlier - Fix Settings tab label visibility issue - Add tabBarItem image setup to SettingsViewController.init() - Add themeDidChange() call in SettingsViewController.init() - Override themeDidChange() to handle tab bar label visibility - Ensures Settings tab follows showRootTabBarLabel theme property like other tabs This makes the root tab bar adopt iOS 26's new Liquid Glass visual appearance while respecting the app's dark/light theme preference, and ensures all tabs consistently show/hide labels based on theme configuration.
1 parent f5027c7 commit cdb70f4

4 files changed

Lines changed: 67 additions & 13 deletions

File tree

App/Main/RootViewControllerStack.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,6 @@ final class RootViewControllerStack: NSObject, AwfulSplitViewControllerDelegate
5151

5252
let settings = SettingsViewController(managedObjectContext: managedObjectContext)
5353
settings.restorationIdentifier = "Settings"
54-
settings.tabBarItem.image = UIImage(named: "cog")
55-
settings.tabBarItem.selectedImage = UIImage(named: "cog-filled")
5654

5755
tabBarController.restorationIdentifier = "Tabbar"
5856
tabBarController.viewControllers = [forums, bookmarks, lepers, settings].map() {

App/Settings/SettingsViewController.swift

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ final class SettingsViewController: HostingController<SettingsContainerView> {
4444
box.contents = self
4545

4646
title = String(localized: "Settings", bundle: .module)
47+
tabBarItem.image = UIImage(named: "cog")
48+
tabBarItem.selectedImage = UIImage(named: "cog-filled")
49+
50+
themeDidChange()
4751
}
4852

4953
required init?(coder: NSCoder) {
@@ -67,6 +71,18 @@ final class SettingsViewController: HostingController<SettingsContainerView> {
6771
func goToAwfulThread() {
6872
AppDelegate.instance.open(route: .threadPage(threadID: "3837546", page: .nextUnread, .seen))
6973
}
74+
75+
override func themeDidChange() {
76+
super.themeDidChange()
77+
78+
if theme[bool: "showRootTabBarLabel"] == false {
79+
tabBarItem.imageInsets = UIEdgeInsets(top: 9, left: 0, bottom: -9, right: 0)
80+
tabBarItem.title = nil
81+
} else {
82+
tabBarItem.imageInsets = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0)
83+
tabBarItem.title = title
84+
}
85+
}
7086
}
7187

7288
/// See the `README.md` section "Alternate App Icons" for more info.

App/View Controllers/RootTabBarController.swift

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -62,22 +62,32 @@ final class RootTabBarController: UITabBarController, UITabBarControllerDelegate
6262
UIImpactFeedbackGenerator(style: .medium).impactOccurred()
6363
}
6464
}
65-
65+
6666
func themeDidChange() {
67-
tabBar.barTintColor = theme["tabBarBackgroundColor"]
68-
tabBar.isTranslucent = theme[bool: "tabBarIsTranslucent"] ?? true
69-
tabBar.tintColor = theme["tintColor"]
70-
tabBar.topBorderColor = theme["bottomBarTopBorderColor"]
71-
7267
let barAppearance = UITabBarAppearance()
73-
if tabBar.isTranslucent {
74-
barAppearance.configureWithDefaultBackground()
68+
69+
if #available(iOS 26.0, *) {
70+
let menuAppearance = theme[string: "menuAppearance"]
71+
tabBar.overrideUserInterfaceStyle = menuAppearance == "light" ? .light : .dark
72+
73+
barAppearance.backgroundColor = nil
74+
barAppearance.backgroundEffect = nil
75+
barAppearance.shadowImage = nil
76+
barAppearance.shadowColor = nil
77+
78+
tabBar.isTranslucent = true
79+
tabBar.barTintColor = nil
80+
tabBar.topBorderColor = nil
7581
} else {
7682
barAppearance.configureWithOpaqueBackground()
83+
barAppearance.backgroundColor = theme[uicolor: "tabBarBackgroundColor"]!
84+
barAppearance.shadowColor = theme[uicolor: "bottomBarTopBorderColor"]!
85+
86+
tabBar.isTranslucent = false
87+
tabBar.barTintColor = theme["tabBarBackgroundColor"]
88+
tabBar.tintColor = theme["tintColor"]
89+
tabBar.topBorderColor = theme["bottomBarTopBorderColor"]
7790
}
78-
barAppearance.backgroundColor = Theme.defaultTheme()["backgroundColor"]!
79-
barAppearance.shadowImage = nil
80-
barAppearance.shadowColor = nil
8191

8292
let itemAppearance = UITabBarItemAppearance()
8393
itemAppearance.selected.iconColor = Theme.defaultTheme()["tabBarIconSelectedColor"]!

AwfulTheming/Sources/AwfulTheming/Themes.plist

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
<dict>
55
<key>BYOB</key>
66
<dict>
7+
<key>menuAppearance</key>
8+
<string>light</string>
79
<key>keyboardAppearance</key>
810
<string>Light</string>
911
<key>relevantForumID</key>
@@ -59,6 +61,8 @@
5961
</dict>
6062
<key>default</key>
6163
<dict>
64+
<key>menuAppearance</key>
65+
<string>light</string>
6266
<key>statusBarBackground</key>
6367
<string>dark</string>
6468
<key>mode</key>
@@ -209,6 +213,8 @@
209213
</dict>
210214
<key>dark</key>
211215
<dict>
216+
<key>menuAppearance</key>
217+
<string>dark</string>
212218
<key>mode</key>
213219
<string>dark</string>
214220
<key>description</key>
@@ -319,6 +325,8 @@
319325
</dict>
320326
<key>alternateDefault</key>
321327
<dict>
328+
<key>menuAppearance</key>
329+
<string>light</string>
322330
<key>mode</key>
323331
<string>light</string>
324332
<key>description</key>
@@ -418,6 +426,8 @@
418426
</dict>
419427
<key>alternateDark</key>
420428
<dict>
429+
<key>menuAppearance</key>
430+
<string>dark</string>
421431
<key>mode</key>
422432
<string>dark</string>
423433
<key>description</key>
@@ -522,6 +532,8 @@
522532
</dict>
523533
<key>oledDark</key>
524534
<dict>
535+
<key>menuAppearance</key>
536+
<string>dark</string>
525537
<key>mode</key>
526538
<string>dark</string>
527539
<key>description</key>
@@ -634,6 +646,8 @@
634646
</dict>
635647
<key>brightLight</key>
636648
<dict>
649+
<key>menuAppearance</key>
650+
<string>light</string>
637651
<key>mode</key>
638652
<string>light</string>
639653
<key>description</key>
@@ -733,6 +747,8 @@
733747
</dict>
734748
<key>FYAD</key>
735749
<dict>
750+
<key>menuAppearance</key>
751+
<string>light</string>
736752
<key>mode</key>
737753
<string>light</string>
738754
<key>keyboardAppearance</key>
@@ -823,6 +839,8 @@
823839
</dict>
824840
<key>Gas Chamber</key>
825841
<dict>
842+
<key>menuAppearance</key>
843+
<string>light</string>
826844
<key>mode</key>
827845
<string>light</string>
828846
<key>relevantForumID</key>
@@ -844,6 +862,8 @@
844862
</dict>
845863
<key>Macinyos</key>
846864
<dict>
865+
<key>menuAppearance</key>
866+
<string>light</string>
847867
<key>mode</key>
848868
<string>light</string>
849869
<key>relevantForumID</key>
@@ -865,6 +885,8 @@
865885
</dict>
866886
<key>spankykongDark</key>
867887
<dict>
888+
<key>menuAppearance</key>
889+
<string>dark</string>
868890
<key>mode</key>
869891
<string>dark</string>
870892
<key>roundedFonts</key>
@@ -1060,6 +1082,8 @@
10601082
</dict>
10611083
<key>spankykongLight</key>
10621084
<dict>
1085+
<key>menuAppearance</key>
1086+
<string>light</string>
10631087
<key>statusBarBackground</key>
10641088
<string>light</string>
10651089
<key>mode</key>
@@ -1255,6 +1279,8 @@
12551279
</dict>
12561280
<key>Winpos 95</key>
12571281
<dict>
1282+
<key>menuAppearance</key>
1283+
<string>light</string>
12581284
<key>toolbarTintColor</key>
12591285
<string>#000000</string>
12601286
<key>relevantForumID</key>
@@ -1297,6 +1323,8 @@
12971323
</dict>
12981324
<key>YOSPOS</key>
12991325
<dict>
1326+
<key>menuAppearance</key>
1327+
<string>dark</string>
13001328
<key>mode</key>
13011329
<string>dark</string>
13021330
<key>keyboardAppearance</key>
@@ -1402,6 +1430,8 @@
14021430
</dict>
14031431
<key>YOSPOS (amber)</key>
14041432
<dict>
1433+
<key>menuAppearance</key>
1434+
<string>dark</string>
14051435
<key>mode</key>
14061436
<string>dark</string>
14071437
<key>keyboardAppearance</key>

0 commit comments

Comments
 (0)