mirror of
https://github.com/vector-im/element-ios.git
synced 2024-09-28 23:32:41 +00:00
Merge pull request #5826 from vector-im/doug/scroll_edge_name
Make scrollEdgesAppearance singular to match UIKit
This commit is contained in:
commit
14fddc1d22
8 changed files with 17 additions and 16 deletions
|
@ -112,7 +112,7 @@ import DesignKit
|
||||||
/// - Parameter tabBar: The tab bar to customise.
|
/// - Parameter tabBar: The tab bar to customise.
|
||||||
func applyStyle(onTabBar tabBar: UITabBar)
|
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.
|
/// - Parameter navigationBar: the navigation bar to customise.
|
||||||
func applyStyle(onNavigationBar navigationBar: UINavigationBar)
|
func applyStyle(onNavigationBar navigationBar: UINavigationBar)
|
||||||
|
@ -120,9 +120,9 @@ import DesignKit
|
||||||
/// Apply the theme on a navigation bar.
|
/// Apply the theme on a navigation bar.
|
||||||
///
|
///
|
||||||
/// - Parameter navigationBar: the navigation bar to customise.
|
/// - 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,
|
func applyStyle(onNavigationBar navigationBar: UINavigationBar,
|
||||||
withModernScrollEdgesAppearance modernScrollEdgesAppearance: Bool)
|
withModernScrollEdgeAppearance modernScrollEdgeAppearance: Bool)
|
||||||
|
|
||||||
/// Apply the theme on a search bar.
|
/// Apply the theme on a search bar.
|
||||||
///
|
///
|
||||||
|
|
|
@ -114,11 +114,11 @@ class DarkTheme: NSObject, Theme {
|
||||||
|
|
||||||
// Protocols don't support default parameter values and a protocol extension won't work for @objc
|
// Protocols don't support default parameter values and a protocol extension won't work for @objc
|
||||||
func applyStyle(onNavigationBar navigationBar: UINavigationBar) {
|
func applyStyle(onNavigationBar navigationBar: UINavigationBar) {
|
||||||
applyStyle(onNavigationBar: navigationBar, withModernScrollEdgesAppearance: false)
|
applyStyle(onNavigationBar: navigationBar, withModernScrollEdgeAppearance: false)
|
||||||
}
|
}
|
||||||
|
|
||||||
func applyStyle(onNavigationBar navigationBar: UINavigationBar,
|
func applyStyle(onNavigationBar navigationBar: UINavigationBar,
|
||||||
withModernScrollEdgesAppearance modernScrollEdgesAppearance: Bool) {
|
withModernScrollEdgeAppearance modernScrollEdgeAppearance: Bool) {
|
||||||
navigationBar.tintColor = tintColor
|
navigationBar.tintColor = tintColor
|
||||||
|
|
||||||
// On iOS 15 use UINavigationBarAppearance to fix visual issues with the scrollEdgeAppearance style.
|
// On iOS 15 use UINavigationBarAppearance to fix visual issues with the scrollEdgeAppearance style.
|
||||||
|
@ -127,7 +127,7 @@ class DarkTheme: NSObject, Theme {
|
||||||
|
|
||||||
appearance.configureWithOpaqueBackground()
|
appearance.configureWithOpaqueBackground()
|
||||||
appearance.backgroundColor = baseColor
|
appearance.backgroundColor = baseColor
|
||||||
if !modernScrollEdgesAppearance {
|
if !modernScrollEdgeAppearance {
|
||||||
appearance.shadowColor = nil
|
appearance.shadowColor = nil
|
||||||
}
|
}
|
||||||
appearance.titleTextAttributes = [
|
appearance.titleTextAttributes = [
|
||||||
|
@ -135,7 +135,7 @@ class DarkTheme: NSObject, Theme {
|
||||||
]
|
]
|
||||||
|
|
||||||
navigationBar.standardAppearance = appearance
|
navigationBar.standardAppearance = appearance
|
||||||
navigationBar.scrollEdgeAppearance = modernScrollEdgesAppearance ? nil : appearance
|
navigationBar.scrollEdgeAppearance = modernScrollEdgeAppearance ? nil : appearance
|
||||||
} else {
|
} else {
|
||||||
navigationBar.titleTextAttributes = [
|
navigationBar.titleTextAttributes = [
|
||||||
NSAttributedString.Key.foregroundColor: textPrimaryColor
|
NSAttributedString.Key.foregroundColor: textPrimaryColor
|
||||||
|
|
|
@ -120,11 +120,11 @@ class DefaultTheme: NSObject, Theme {
|
||||||
|
|
||||||
// Protocols don't support default parameter values and a protocol extension doesn't work for @objc
|
// Protocols don't support default parameter values and a protocol extension doesn't work for @objc
|
||||||
func applyStyle(onNavigationBar navigationBar: UINavigationBar) {
|
func applyStyle(onNavigationBar navigationBar: UINavigationBar) {
|
||||||
applyStyle(onNavigationBar: navigationBar, withModernScrollEdgesAppearance: false)
|
applyStyle(onNavigationBar: navigationBar, withModernScrollEdgeAppearance: false)
|
||||||
}
|
}
|
||||||
|
|
||||||
func applyStyle(onNavigationBar navigationBar: UINavigationBar,
|
func applyStyle(onNavigationBar navigationBar: UINavigationBar,
|
||||||
withModernScrollEdgesAppearance modernScrollEdgesAppearance: Bool) {
|
withModernScrollEdgeAppearance modernScrollEdgeAppearance: Bool) {
|
||||||
navigationBar.tintColor = tintColor
|
navigationBar.tintColor = tintColor
|
||||||
|
|
||||||
// On iOS 15 use UINavigationBarAppearance to fix visual issues with the scrollEdgeAppearance style.
|
// On iOS 15 use UINavigationBarAppearance to fix visual issues with the scrollEdgeAppearance style.
|
||||||
|
@ -133,7 +133,7 @@ class DefaultTheme: NSObject, Theme {
|
||||||
|
|
||||||
appearance.configureWithOpaqueBackground()
|
appearance.configureWithOpaqueBackground()
|
||||||
appearance.backgroundColor = baseColor
|
appearance.backgroundColor = baseColor
|
||||||
if !modernScrollEdgesAppearance {
|
if !modernScrollEdgeAppearance {
|
||||||
appearance.shadowColor = nil
|
appearance.shadowColor = nil
|
||||||
}
|
}
|
||||||
appearance.titleTextAttributes = [
|
appearance.titleTextAttributes = [
|
||||||
|
@ -141,7 +141,7 @@ class DefaultTheme: NSObject, Theme {
|
||||||
]
|
]
|
||||||
|
|
||||||
navigationBar.standardAppearance = appearance
|
navigationBar.standardAppearance = appearance
|
||||||
navigationBar.scrollEdgeAppearance = modernScrollEdgesAppearance ? nil : appearance
|
navigationBar.scrollEdgeAppearance = modernScrollEdgeAppearance ? nil : appearance
|
||||||
} else {
|
} else {
|
||||||
navigationBar.titleTextAttributes = [
|
navigationBar.titleTextAttributes = [
|
||||||
NSAttributedString.Key.foregroundColor: textPrimaryColor
|
NSAttributedString.Key.foregroundColor: textPrimaryColor
|
||||||
|
|
|
@ -211,7 +211,7 @@ static const CGFloat kAuthInputContainerViewMinHeightConstraintConstant = 150.0;
|
||||||
- (void)userInterfaceThemeDidChange
|
- (void)userInterfaceThemeDidChange
|
||||||
{
|
{
|
||||||
[ThemeService.shared.theme applyStyleOnNavigationBar:self.navigationController.navigationBar
|
[ThemeService.shared.theme applyStyleOnNavigationBar:self.navigationController.navigationBar
|
||||||
withModernScrollEdgesAppearance:YES];
|
withModernScrollEdgeAppearance:YES];
|
||||||
|
|
||||||
self.view.backgroundColor = ThemeService.shared.theme.backgroundColor;
|
self.view.backgroundColor = ThemeService.shared.theme.backgroundColor;
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@ class VectorHostingController: UIHostingController<AnyView> {
|
||||||
|
|
||||||
// MARK: Public
|
// MARK: Public
|
||||||
|
|
||||||
var enableNavigationBarScrollEdgesAppearance = false
|
var enableNavigationBarScrollEdgeAppearance = false
|
||||||
|
|
||||||
init<Content>(rootView: Content) where Content: View {
|
init<Content>(rootView: Content) where Content: View {
|
||||||
self.theme = ThemeService.shared().theme
|
self.theme = ThemeService.shared().theme
|
||||||
|
@ -93,7 +93,7 @@ class VectorHostingController: UIHostingController<AnyView> {
|
||||||
|
|
||||||
private func update(theme: Theme) {
|
private func update(theme: Theme) {
|
||||||
if let navigationBar = self.navigationController?.navigationBar {
|
if let navigationBar = self.navigationController?.navigationBar {
|
||||||
theme.applyStyle(onNavigationBar: navigationBar, withModernScrollEdgesAppearance: enableNavigationBarScrollEdgesAppearance)
|
theme.applyStyle(onNavigationBar: navigationBar, withModernScrollEdgeAppearance: enableNavigationBarScrollEdgeAppearance)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,7 @@ final class OnboardingUseCaseSelectionCoordinator: Coordinator, Presentable {
|
||||||
|
|
||||||
let hostingController = VectorHostingController(rootView: view)
|
let hostingController = VectorHostingController(rootView: view)
|
||||||
hostingController.vc_removeBackTitle()
|
hostingController.vc_removeBackTitle()
|
||||||
hostingController.enableNavigationBarScrollEdgesAppearance = true
|
hostingController.enableNavigationBarScrollEdgeAppearance = true
|
||||||
onboardingUseCaseHostingController = hostingController
|
onboardingUseCaseHostingController = hostingController
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -53,7 +53,7 @@ final class SpaceSettingsCoordinator: Coordinator, Presentable {
|
||||||
.addDependency(AvatarService.instantiate(mediaManager: parameters.session.mediaManager))
|
.addDependency(AvatarService.instantiate(mediaManager: parameters.session.mediaManager))
|
||||||
spaceSettingsViewModel = viewModel
|
spaceSettingsViewModel = viewModel
|
||||||
let controller = VectorHostingController(rootView: view)
|
let controller = VectorHostingController(rootView: view)
|
||||||
controller.enableNavigationBarScrollEdgesAppearance = true
|
controller.enableNavigationBarScrollEdgeAppearance = true
|
||||||
spaceSettingsHostingController = controller
|
spaceSettingsHostingController = controller
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
1
changelog.d/pr-5826.api
Normal file
1
changelog.d/pr-5826.api
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Rename scrollEdgesAppearance → scrollEdgeAppearance to match UIKit.
|
Loading…
Reference in a new issue