Skip to content

Commit

Permalink
fix: navigation bar colors (#232)
Browse files Browse the repository at this point in the history
* fix: navigation bar colors

* chore: got rid unnecessary navigation background modifier
  • Loading branch information
rnr authored Jan 16, 2024
1 parent f8e1e94 commit 6f3a985
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 10 deletions.
6 changes: 3 additions & 3 deletions Core/Core/Extensions/UIApplicationExtension.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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]
}
}

Expand Down
6 changes: 3 additions & 3 deletions Core/Core/Extensions/ViewExtension.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//

import Foundation
import SwiftUIIntrospect
@_spi(Advanced) import SwiftUIIntrospect
import SwiftUI
import Theme

Expand Down Expand Up @@ -193,13 +193,13 @@ 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 hideScrollContentBackground() -> some View {
if #available(iOS 16.0, *) {
return self.scrollContentBackground(.hidden)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions Core/Core/View/Base/WebUnitView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//

import SwiftUI
import SwiftUIIntrospect
@_spi(Advanced) import SwiftUIIntrospect
import Theme

public struct WebUnitView: View {
Expand Down Expand Up @@ -68,7 +68,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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ public struct CourseContainerView: View {
.navigationBarBackButtonHidden(false)
.navigationTitle(titleBar())
.onChange(of: selection, perform: didSelect)
.background(Theme.Colors.background)
}

@ViewBuilder
Expand Down
14 changes: 14 additions & 0 deletions Theme/Theme/Theme.swift
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,20 @@ public struct Theme {
}
}

// Use this structure where the computed Color.uiColor() extension is not appropriate.
public struct UIColors {
public private(set) static var textPrimary = ThemeAssets.textPrimary.color
public private(set) static var accentColor = ThemeAssets.accentColor.color

public static func update(
textPrimary: UIColor = ThemeAssets.textPrimary.color,
accentColor: UIColor = ThemeAssets.accentColor.color
) {
self.textPrimary = textPrimary
self.accentColor = accentColor
}
}

public struct Fonts {

public static let displayLarge: Font = .custom(fontsParser.fontName(for: .regular), size: 57)
Expand Down

0 comments on commit 6f3a985

Please sign in to comment.