Merge pull request #5826 from vector-im/doug/scroll_edge_name

Make scrollEdgesAppearance singular to match UIKit
This commit is contained in:
Doug 2022-03-16 14:45:49 +00:00 committed by GitHub
commit 14fddc1d22
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 17 additions and 16 deletions

View file

@ -112,7 +112,7 @@ import DesignKit
/// - Parameter tabBar: The tab bar to customise.
func applyStyle(onTabBar tabBar: UITabBar)
/// Apply the theme on a navigation bar, without enabling the iOS 15's scroll edges appearance.
/// Apply the theme on a navigation bar, without enabling the iOS 15's scroll edge appearance.
///
/// - Parameter navigationBar: the navigation bar to customise.
func applyStyle(onNavigationBar navigationBar: UINavigationBar)
@ -120,9 +120,9 @@ import DesignKit
/// Apply the theme on a navigation bar.
///
/// - Parameter navigationBar: the navigation bar to customise.
/// - Parameter modernScrollEdgesAppearance: whether or not to use the iOS 15 style scroll edges appearance
/// - Parameter modernScrollEdgeAppearance: whether or not to use the iOS 15 style scroll edge appearance
func applyStyle(onNavigationBar navigationBar: UINavigationBar,
withModernScrollEdgesAppearance modernScrollEdgesAppearance: Bool)
withModernScrollEdgeAppearance modernScrollEdgeAppearance: Bool)
/// Apply the theme on a search bar.
///

View file

@ -114,11 +114,11 @@ class DarkTheme: NSObject, Theme {
// Protocols don't support default parameter values and a protocol extension won't work for @objc
func applyStyle(onNavigationBar navigationBar: UINavigationBar) {
applyStyle(onNavigationBar: navigationBar, withModernScrollEdgesAppearance: false)
applyStyle(onNavigationBar: navigationBar, withModernScrollEdgeAppearance: false)
}
func applyStyle(onNavigationBar navigationBar: UINavigationBar,
withModernScrollEdgesAppearance modernScrollEdgesAppearance: Bool) {
withModernScrollEdgeAppearance modernScrollEdgeAppearance: Bool) {
navigationBar.tintColor = tintColor
// On iOS 15 use UINavigationBarAppearance to fix visual issues with the scrollEdgeAppearance style.
@ -127,7 +127,7 @@ class DarkTheme: NSObject, Theme {
appearance.configureWithOpaqueBackground()
appearance.backgroundColor = baseColor
if !modernScrollEdgesAppearance {
if !modernScrollEdgeAppearance {
appearance.shadowColor = nil
}
appearance.titleTextAttributes = [
@ -135,7 +135,7 @@ class DarkTheme: NSObject, Theme {
]
navigationBar.standardAppearance = appearance
navigationBar.scrollEdgeAppearance = modernScrollEdgesAppearance ? nil : appearance
navigationBar.scrollEdgeAppearance = modernScrollEdgeAppearance ? nil : appearance
} else {
navigationBar.titleTextAttributes = [
NSAttributedString.Key.foregroundColor: textPrimaryColor

View file

@ -120,11 +120,11 @@ class DefaultTheme: NSObject, Theme {
// Protocols don't support default parameter values and a protocol extension doesn't work for @objc
func applyStyle(onNavigationBar navigationBar: UINavigationBar) {
applyStyle(onNavigationBar: navigationBar, withModernScrollEdgesAppearance: false)
applyStyle(onNavigationBar: navigationBar, withModernScrollEdgeAppearance: false)
}
func applyStyle(onNavigationBar navigationBar: UINavigationBar,
withModernScrollEdgesAppearance modernScrollEdgesAppearance: Bool) {
withModernScrollEdgeAppearance modernScrollEdgeAppearance: Bool) {
navigationBar.tintColor = tintColor
// On iOS 15 use UINavigationBarAppearance to fix visual issues with the scrollEdgeAppearance style.
@ -133,7 +133,7 @@ class DefaultTheme: NSObject, Theme {
appearance.configureWithOpaqueBackground()
appearance.backgroundColor = baseColor
if !modernScrollEdgesAppearance {
if !modernScrollEdgeAppearance {
appearance.shadowColor = nil
}
appearance.titleTextAttributes = [
@ -141,7 +141,7 @@ class DefaultTheme: NSObject, Theme {
]
navigationBar.standardAppearance = appearance
navigationBar.scrollEdgeAppearance = modernScrollEdgesAppearance ? nil : appearance
navigationBar.scrollEdgeAppearance = modernScrollEdgeAppearance ? nil : appearance
} else {
navigationBar.titleTextAttributes = [
NSAttributedString.Key.foregroundColor: textPrimaryColor

View file

@ -211,7 +211,7 @@ static const CGFloat kAuthInputContainerViewMinHeightConstraintConstant = 150.0;
- (void)userInterfaceThemeDidChange
{
[ThemeService.shared.theme applyStyleOnNavigationBar:self.navigationController.navigationBar
withModernScrollEdgesAppearance:YES];
withModernScrollEdgeAppearance:YES];
self.view.backgroundColor = ThemeService.shared.theme.backgroundColor;

View file

@ -32,7 +32,7 @@ class VectorHostingController: UIHostingController<AnyView> {
// MARK: Public
var enableNavigationBarScrollEdgesAppearance = false
var enableNavigationBarScrollEdgeAppearance = false
init<Content>(rootView: Content) where Content: View {
self.theme = ThemeService.shared().theme
@ -93,7 +93,7 @@ class VectorHostingController: UIHostingController<AnyView> {
private func update(theme: Theme) {
if let navigationBar = self.navigationController?.navigationBar {
theme.applyStyle(onNavigationBar: navigationBar, withModernScrollEdgesAppearance: enableNavigationBarScrollEdgesAppearance)
theme.applyStyle(onNavigationBar: navigationBar, withModernScrollEdgeAppearance: enableNavigationBarScrollEdgeAppearance)
}
}
}

View file

@ -41,7 +41,7 @@ final class OnboardingUseCaseSelectionCoordinator: Coordinator, Presentable {
let hostingController = VectorHostingController(rootView: view)
hostingController.vc_removeBackTitle()
hostingController.enableNavigationBarScrollEdgesAppearance = true
hostingController.enableNavigationBarScrollEdgeAppearance = true
onboardingUseCaseHostingController = hostingController
}

View file

@ -53,7 +53,7 @@ final class SpaceSettingsCoordinator: Coordinator, Presentable {
.addDependency(AvatarService.instantiate(mediaManager: parameters.session.mediaManager))
spaceSettingsViewModel = viewModel
let controller = VectorHostingController(rootView: view)
controller.enableNavigationBarScrollEdgesAppearance = true
controller.enableNavigationBarScrollEdgeAppearance = true
spaceSettingsHostingController = controller
}

1
changelog.d/pr-5826.api Normal file
View file

@ -0,0 +1 @@
Rename scrollEdgesAppearance → scrollEdgeAppearance to match UIKit.