mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 06:55:59 +00:00
A couple of small tweaks. (#4569)
* Stop ignoring the safe area with the suggestions view. They weren't visible on iPad (hidden behind the sidebar) and I can't find any instance when they're shown where the safe area comes into play. * Make sure the room list deselects the cell when dismissed a room. * Use the backports pattern in more places. * Fix the annoying header on macOS. * Silence some warnings * Fix compound CI branch name.
This commit is contained in:
@@ -1,30 +0,0 @@
|
||||
//
|
||||
// Copyright 2024 New Vector Ltd.
|
||||
//
|
||||
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
|
||||
// Please see LICENSE files in the repository root for full details.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
extension View {
|
||||
/// A convenience modifier to conditionally apply `.navigationTransition(.zoom(…))` when available.
|
||||
@ViewBuilder
|
||||
func zoomTransition(sourceID: some Hashable, in namespace: Namespace.ID) -> some View {
|
||||
if #available(iOS 18.0, *) {
|
||||
navigationTransition(.zoom(sourceID: sourceID, in: namespace))
|
||||
} else {
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
/// A convenience modifier to conditionally apply `.matchedTransitionSource(…)` when available.
|
||||
@ViewBuilder
|
||||
func zoomTransitionSource(id: some Hashable, in namespace: Namespace.ID) -> some View {
|
||||
if #available(iOS 18.0, *) {
|
||||
matchedTransitionSource(id: id, in: namespace)
|
||||
} else {
|
||||
self
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,12 +8,68 @@
|
||||
import SwiftUI
|
||||
|
||||
extension View {
|
||||
@ViewBuilder
|
||||
func backportTabBarMinimizeBehaviorOnScrollDown() -> some View {
|
||||
// MARK: iOS 18
|
||||
|
||||
/// Uses the old page style modal so that on iPadOS 18 the presentation detents have no effect.
|
||||
@ViewBuilder func backportPresentationSizingPage() -> some View {
|
||||
if #available(iOS 18.0, *) {
|
||||
presentationSizing(.page)
|
||||
} else {
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
/// A convenience modifier to conditionally apply `.navigationTransition(.zoom(…))` when available.
|
||||
@ViewBuilder func backportNavigationTransitionZoom(sourceID: some Hashable, in namespace: Namespace.ID) -> some View {
|
||||
if #available(iOS 18.0, *) {
|
||||
navigationTransition(.zoom(sourceID: sourceID, in: namespace))
|
||||
} else {
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
/// A convenience modifier to conditionally apply `.matchedTransitionSource(…)` when available.
|
||||
@ViewBuilder func backportMatchedTransitionSource(id: some Hashable, in namespace: Namespace.ID) -> some View {
|
||||
if #available(iOS 18.0, *) {
|
||||
matchedTransitionSource(id: id, in: namespace)
|
||||
} else {
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
@ViewBuilder func backportAccessibilityHint(_ hint: String, isEnabled: Bool) -> some View {
|
||||
if #available(iOS 18, *) {
|
||||
accessibilityHint(hint, isEnabled: isEnabled)
|
||||
} else {
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: iOS 26
|
||||
|
||||
@ViewBuilder func backportTabBarMinimizeBehaviorOnScrollDown() -> some View {
|
||||
if #available(iOS 26.0, *) {
|
||||
tabBarMinimizeBehavior(.onScrollDown)
|
||||
} else {
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
@ViewBuilder func backportScrollEdgeEffectHidden() -> some View {
|
||||
if #available(iOS 26, *) {
|
||||
scrollEdgeEffectHidden()
|
||||
} else {
|
||||
self
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extension ToolbarContent {
|
||||
@ToolbarContentBuilder func backportSharedBackgroundVisibility(_ visibility: Visibility) -> some ToolbarContent {
|
||||
if #available(iOS 26.0, *) {
|
||||
sharedBackgroundVisibility(visibility)
|
||||
} else {
|
||||
self
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ extension TextFieldStyle where Self == ElementTextFieldStyle {
|
||||
}
|
||||
|
||||
/// The text field style used in authentication screens.
|
||||
struct ElementTextFieldStyle: TextFieldStyle {
|
||||
struct ElementTextFieldStyle: @MainActor TextFieldStyle {
|
||||
enum State {
|
||||
case success
|
||||
case error
|
||||
|
||||
@@ -18,8 +18,9 @@ struct RoomHeaderView: View {
|
||||
let mediaProvider: MediaProviderProtocol?
|
||||
|
||||
var body: some View {
|
||||
if ProcessInfo.isRunningAccessibilityTests {
|
||||
// Accessibility tests scale up the dynamic size in real time which may break the view
|
||||
if ProcessInfo.isRunningAccessibilityTests || ProcessInfo.processInfo.isiOSAppOnMac {
|
||||
// Accessibility tests scale up the dynamic size in real time which may break the view.
|
||||
// macOS really doesn't like the greedy size and does weird things to it.
|
||||
content
|
||||
} else {
|
||||
content
|
||||
|
||||
Reference in New Issue
Block a user