diff --git a/Core/Core/Extensions/UIApplicationExtension.swift b/Core/Core/Extensions/UIApplicationExtension.swift index 59160ad6a..022c1770a 100644 --- a/Core/Core/Extensions/UIApplicationExtension.swift +++ b/Core/Core/Extensions/UIApplicationExtension.swift @@ -45,10 +45,10 @@ extension UINavigationController { navigationBar.shadowImage = UIImage() let image = CoreAssets.arrowLeft.image - navigationBar.backIndicatorImage = image.withTintColor(Theme.Colors.accentColor.uiColor()) + navigationBar.backIndicatorImage = image.withTintColor(Theme.UIColors.accentColor) navigationBar.backItem?.backButtonTitle = " " - navigationBar.backIndicatorTransitionMaskImage = image.withTintColor(Theme.Colors.accentColor.uiColor()) - navigationBar.titleTextAttributes = [.foregroundColor: Theme.Colors.textPrimary.uiColor()] + navigationBar.backIndicatorTransitionMaskImage = image.withTintColor(Theme.UIColors.accentColor) + navigationBar.titleTextAttributes = [.foregroundColor: Theme.UIColors.textPrimary] } } diff --git a/Core/Core/Extensions/ViewExtension.swift b/Core/Core/Extensions/ViewExtension.swift index 23b37eed9..beb650ebe 100644 --- a/Core/Core/Extensions/ViewExtension.swift +++ b/Core/Core/Extensions/ViewExtension.swift @@ -6,7 +6,7 @@ // import Foundation -import SwiftUIIntrospect +@_spi(Advanced) import SwiftUIIntrospect import SwiftUI import Theme @@ -193,13 +193,22 @@ public extension View { } else { return self.introspect( .navigationView(style: .stack), - on: .iOS(.v14, .v15, .v16, .v17), + on: .iOS(.v15...), scope: .ancestor) { $0.isNavigationBarHidden = true } } } + func navigationBackground(color: UIColor) -> some View { + return self.introspect( + .navigationView(style: .stack), + on: .iOS(.v15...), + scope: .ancestor) { + $0.navigationBar.barTintColor = color + } + } + func hideScrollContentBackground() -> some View { if #available(iOS 16.0, *) { return self.scrollContentBackground(.hidden) diff --git a/Core/Core/View/Base/ScrollSlidingTabBar/ScrollSlidingTabBar.swift b/Core/Core/View/Base/ScrollSlidingTabBar/ScrollSlidingTabBar.swift index 650335a0e..994975cfa 100644 --- a/Core/Core/View/Base/ScrollSlidingTabBar/ScrollSlidingTabBar.swift +++ b/Core/Core/View/Base/ScrollSlidingTabBar/ScrollSlidingTabBar.swift @@ -163,8 +163,8 @@ extension ScrollSlidingTabBar { public static let `default` = Style( font: .body, selectedFont: .body.bold(), - activeAccentColor: Theme.Colors.accentColor , - inactiveAccentColor: .black.opacity(0.4), + activeAccentColor: Theme.Colors.accentColor, + inactiveAccentColor: Theme.Colors.textSecondary, indicatorHeight: 2, borderColor: .gray.opacity(0.2), borderHeight: 1, diff --git a/Core/Core/View/Base/WebUnitView.swift b/Core/Core/View/Base/WebUnitView.swift index f85f0914f..8d3123861 100644 --- a/Core/Core/View/Base/WebUnitView.swift +++ b/Core/Core/View/Base/WebUnitView.swift @@ -6,7 +6,7 @@ // import SwiftUI -import SwiftUIIntrospect +@_spi(Advanced) import SwiftUIIntrospect import Theme public struct WebUnitView: View { @@ -62,7 +62,7 @@ public struct WebUnitView: View { .frame(width: reader.size.width, height: reader.size.height) } } - .introspect(.scrollView, on: .iOS(.v14, .v15, .v16, .v17), customize: { scrollView in + .introspect(.scrollView, on: .iOS(.v15...), customize: { scrollView in scrollView.isScrollEnabled = false }) if viewModel.updatingCookies || isWebViewLoading { diff --git a/Course/Course/Presentation/Container/CourseContainerView.swift b/Course/Course/Presentation/Container/CourseContainerView.swift index 6b8606a94..3903d4556 100644 --- a/Course/Course/Presentation/Container/CourseContainerView.swift +++ b/Course/Course/Presentation/Container/CourseContainerView.swift @@ -84,6 +84,8 @@ public struct CourseContainerView: View { .navigationBarBackButtonHidden(false) .navigationTitle(titleBar()) .onChange(of: selection, perform: didSelect) + .navigationBackground(color: Theme.UIColors.background) + .background(Theme.Colors.background) } @ViewBuilder diff --git a/Theme/Theme/Theme.swift b/Theme/Theme/Theme.swift index 8e9ec9aab..bbb98140e 100644 --- a/Theme/Theme/Theme.swift +++ b/Theme/Theme/Theme.swift @@ -91,6 +91,22 @@ public struct Theme { } } + public struct UIColors { + public private(set) static var textPrimary = ThemeAssets.textPrimary.color + public private(set) static var accentColor = ThemeAssets.accentColor.color + public private(set) static var background = ThemeAssets.background.color + + public static func update( + textPrimary: UIColor = ThemeAssets.textPrimary.color, + accentColor: UIColor = ThemeAssets.accentColor.color, + background: UIColor = ThemeAssets.background.color + ) { + self.textPrimary = textPrimary + self.accentColor = accentColor + self.background = background + } + } + public struct Fonts { public static let displayLarge: Font = .custom(fontsParser.fontName(for: .regular), size: 57)