Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions App/Main/RootViewControllerStack.swift
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,6 @@ final class RootViewControllerStack: NSObject, AwfulSplitViewControllerDelegate

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

tabBarController.restorationIdentifier = "Tabbar"
tabBarController.viewControllers = [forums, bookmarks, lepers, settings].map() {
Expand Down
16 changes: 16 additions & 0 deletions App/Settings/SettingsViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ final class SettingsViewController: HostingController<SettingsContainerView> {
box.contents = self

title = String(localized: "Settings", bundle: .module)
tabBarItem.image = UIImage(named: "cog")
tabBarItem.selectedImage = UIImage(named: "cog-filled")

themeDidChange()
}

required init?(coder: NSCoder) {
Expand All @@ -67,6 +71,18 @@ final class SettingsViewController: HostingController<SettingsContainerView> {
func goToAwfulThread() {
AppDelegate.instance.open(route: .threadPage(threadID: "3837546", page: .nextUnread, .seen))
}

override func themeDidChange() {
super.themeDidChange()

if theme[bool: "showRootTabBarLabel"] == false {
tabBarItem.imageInsets = UIEdgeInsets(top: 9, left: 0, bottom: -9, right: 0)
tabBarItem.title = nil
} else {
tabBarItem.imageInsets = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0)
tabBarItem.title = title
}
}
}

/// See the `README.md` section "Alternate App Icons" for more info.
Expand Down
32 changes: 21 additions & 11 deletions App/View Controllers/RootTabBarController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -62,22 +62,32 @@ final class RootTabBarController: UITabBarController, UITabBarControllerDelegate
UIImpactFeedbackGenerator(style: .medium).impactOccurred()
}
}

func themeDidChange() {
tabBar.barTintColor = theme["tabBarBackgroundColor"]
tabBar.isTranslucent = theme[bool: "tabBarIsTranslucent"] ?? true
tabBar.tintColor = theme["tintColor"]
tabBar.topBorderColor = theme["bottomBarTopBorderColor"]

let barAppearance = UITabBarAppearance()
if tabBar.isTranslucent {
barAppearance.configureWithDefaultBackground()

if #available(iOS 26.0, *) {
let menuAppearance = theme[string: "menuAppearance"]
tabBar.overrideUserInterfaceStyle = menuAppearance == "light" ? .light : .dark

barAppearance.backgroundColor = nil
barAppearance.backgroundEffect = nil
barAppearance.shadowImage = nil
barAppearance.shadowColor = nil

tabBar.isTranslucent = true
tabBar.barTintColor = nil
tabBar.topBorderColor = nil
} else {
barAppearance.configureWithOpaqueBackground()
barAppearance.backgroundColor = theme[uicolor: "tabBarBackgroundColor"]!
barAppearance.shadowColor = theme[uicolor: "bottomBarTopBorderColor"]!

tabBar.isTranslucent = false
tabBar.barTintColor = theme["tabBarBackgroundColor"]
tabBar.tintColor = theme["tintColor"]
tabBar.topBorderColor = theme["bottomBarTopBorderColor"]
}
barAppearance.backgroundColor = Theme.defaultTheme()["backgroundColor"]!
barAppearance.shadowImage = nil
barAppearance.shadowColor = nil

let itemAppearance = UITabBarItemAppearance()
itemAppearance.selected.iconColor = Theme.defaultTheme()["tabBarIconSelectedColor"]!
Expand Down
30 changes: 30 additions & 0 deletions AwfulTheming/Sources/AwfulTheming/Themes.plist
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
<dict>
<key>BYOB</key>
<dict>
<key>menuAppearance</key>
<string>light</string>
<key>keyboardAppearance</key>
<string>Light</string>
<key>relevantForumID</key>
Expand Down Expand Up @@ -59,6 +61,8 @@
</dict>
<key>default</key>
<dict>
<key>menuAppearance</key>
<string>light</string>
<key>statusBarBackground</key>
<string>dark</string>
<key>mode</key>
Expand Down Expand Up @@ -209,6 +213,8 @@
</dict>
<key>dark</key>
<dict>
<key>menuAppearance</key>
<string>dark</string>
<key>mode</key>
<string>dark</string>
<key>description</key>
Expand Down Expand Up @@ -319,6 +325,8 @@
</dict>
<key>alternateDefault</key>
<dict>
<key>menuAppearance</key>
<string>light</string>
<key>mode</key>
<string>light</string>
<key>description</key>
Expand Down Expand Up @@ -418,6 +426,8 @@
</dict>
<key>alternateDark</key>
<dict>
<key>menuAppearance</key>
<string>dark</string>
<key>mode</key>
<string>dark</string>
<key>description</key>
Expand Down Expand Up @@ -522,6 +532,8 @@
</dict>
<key>oledDark</key>
<dict>
<key>menuAppearance</key>
<string>dark</string>
<key>mode</key>
<string>dark</string>
<key>description</key>
Expand Down Expand Up @@ -634,6 +646,8 @@
</dict>
<key>brightLight</key>
<dict>
<key>menuAppearance</key>
<string>light</string>
<key>mode</key>
<string>light</string>
<key>description</key>
Expand Down Expand Up @@ -733,6 +747,8 @@
</dict>
<key>FYAD</key>
<dict>
<key>menuAppearance</key>
<string>light</string>
<key>mode</key>
<string>light</string>
<key>keyboardAppearance</key>
Expand Down Expand Up @@ -823,6 +839,8 @@
</dict>
<key>Gas Chamber</key>
<dict>
<key>menuAppearance</key>
<string>light</string>
<key>mode</key>
<string>light</string>
<key>relevantForumID</key>
Expand All @@ -844,6 +862,8 @@
</dict>
<key>Macinyos</key>
<dict>
<key>menuAppearance</key>
<string>light</string>
<key>mode</key>
<string>light</string>
<key>relevantForumID</key>
Expand All @@ -865,6 +885,8 @@
</dict>
<key>spankykongDark</key>
<dict>
<key>menuAppearance</key>
<string>dark</string>
<key>mode</key>
<string>dark</string>
<key>roundedFonts</key>
Expand Down Expand Up @@ -1060,6 +1082,8 @@
</dict>
<key>spankykongLight</key>
<dict>
<key>menuAppearance</key>
<string>light</string>
<key>statusBarBackground</key>
<string>light</string>
<key>mode</key>
Expand Down Expand Up @@ -1255,6 +1279,8 @@
</dict>
<key>Winpos 95</key>
<dict>
<key>menuAppearance</key>
<string>light</string>
<key>toolbarTintColor</key>
<string>#000000</string>
<key>relevantForumID</key>
Expand Down Expand Up @@ -1297,6 +1323,8 @@
</dict>
<key>YOSPOS</key>
<dict>
<key>menuAppearance</key>
<string>dark</string>
<key>mode</key>
<string>dark</string>
<key>keyboardAppearance</key>
Expand Down Expand Up @@ -1402,6 +1430,8 @@
</dict>
<key>YOSPOS (amber)</key>
<dict>
<key>menuAppearance</key>
<string>dark</string>
<key>mode</key>
<string>dark</string>
<key>keyboardAppearance</key>
Expand Down
Loading