Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: navigation bar colors #232

Merged
Merged
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
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 @@ -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 {
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