diff --git a/App/Main/RootViewControllerStack.swift b/App/Main/RootViewControllerStack.swift index 9c5e074db..f645cc786 100644 --- a/App/Main/RootViewControllerStack.swift +++ b/App/Main/RootViewControllerStack.swift @@ -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() { diff --git a/App/Settings/SettingsViewController.swift b/App/Settings/SettingsViewController.swift index 764b5d7d2..1b9c56bee 100644 --- a/App/Settings/SettingsViewController.swift +++ b/App/Settings/SettingsViewController.swift @@ -44,6 +44,10 @@ final class SettingsViewController: HostingController { 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) { @@ -67,6 +71,18 @@ final class SettingsViewController: HostingController { 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. diff --git a/App/View Controllers/RootTabBarController.swift b/App/View Controllers/RootTabBarController.swift index fbb59fa07..1fad1f8ab 100644 --- a/App/View Controllers/RootTabBarController.swift +++ b/App/View Controllers/RootTabBarController.swift @@ -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"]! diff --git a/AwfulTheming/Sources/AwfulTheming/Themes.plist b/AwfulTheming/Sources/AwfulTheming/Themes.plist index 23c4d65b3..8cee836ab 100644 --- a/AwfulTheming/Sources/AwfulTheming/Themes.plist +++ b/AwfulTheming/Sources/AwfulTheming/Themes.plist @@ -4,6 +4,8 @@ BYOB + menuAppearance + light keyboardAppearance Light relevantForumID @@ -59,6 +61,8 @@ default + menuAppearance + light statusBarBackground dark mode @@ -209,6 +213,8 @@ dark + menuAppearance + dark mode dark description @@ -319,6 +325,8 @@ alternateDefault + menuAppearance + light mode light description @@ -418,6 +426,8 @@ alternateDark + menuAppearance + dark mode dark description @@ -522,6 +532,8 @@ oledDark + menuAppearance + dark mode dark description @@ -634,6 +646,8 @@ brightLight + menuAppearance + light mode light description @@ -733,6 +747,8 @@ FYAD + menuAppearance + light mode light keyboardAppearance @@ -823,6 +839,8 @@ Gas Chamber + menuAppearance + light mode light relevantForumID @@ -844,6 +862,8 @@ Macinyos + menuAppearance + light mode light relevantForumID @@ -865,6 +885,8 @@ spankykongDark + menuAppearance + dark mode dark roundedFonts @@ -1060,6 +1082,8 @@ spankykongLight + menuAppearance + light statusBarBackground light mode @@ -1255,6 +1279,8 @@ Winpos 95 + menuAppearance + light toolbarTintColor #000000 relevantForumID @@ -1297,6 +1323,8 @@ YOSPOS + menuAppearance + dark mode dark keyboardAppearance @@ -1402,6 +1430,8 @@ YOSPOS (amber) + menuAppearance + dark mode dark keyboardAppearance