Address some issues with animations (#816)

- Missing animation in OpenVPN provider sections
- Hardcoded animation in TV profile, theme modifiers were not available
This commit is contained in:
Davide 2024-11-05 13:43:23 +01:00 committed by GitHub
parent 735d3b2fbe
commit 320b92591e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 22 additions and 21 deletions

View File

@ -84,8 +84,9 @@ struct OpenVPNView: View, ModuleDraftEditing {
onCompletion: importConfiguration
)
.modifier(PaywallModifier(reason: $paywallReason))
.withErrorHandler(errorHandler)
.navigationDestination(for: Subroute.self, destination: destination)
.themeAnimation(on: providerId.wrappedValue, category: .modules)
.withErrorHandler(errorHandler)
}
}

View File

@ -91,7 +91,7 @@ struct ProfileView: View, TunnelInstallationProviding {
}
.ignoresSafeArea(edges: .horizontal)
.background(theme.primaryColor.gradient)
.animation(.default, value: isSwitching)
.themeAnimation(on: isSwitching, category: .profiles)
.withErrorHandler(errorHandler)
.defaultFocus($focusedField, .switchProfile)
.onChange(of: tunnel.status) { _, new in

View File

@ -103,15 +103,6 @@ extension View {
#endif
}
#if !os(tvOS)
public func themeWindow(width: CGFloat, height: CGFloat) -> some View {
modifier(ThemeWindowModifier(size: .init(width: width, height: height)))
}
public func themePlainButton(action: @escaping () -> Void) -> some View {
modifier(ThemePlainButtonModifier(action: action))
}
@ViewBuilder
public func themeMultiLine(_ isMultiLine: Bool) -> some View {
if isMultiLine {
@ -138,6 +129,15 @@ extension View {
modifier(ThemeAnimationModifier(value: value, category: category))
}
#if !os(tvOS)
public func themeWindow(width: CGFloat, height: CGFloat) -> some View {
modifier(ThemeWindowModifier(size: .init(width: width, height: height)))
}
public func themePlainButton(action: @escaping () -> Void) -> some View {
modifier(ThemePlainButtonModifier(action: action))
}
public func themeTrailingValue(_ value: CustomStringConvertible?, truncationMode: Text.TruncationMode = .tail) -> some View {
modifier(ThemeTrailingValueModifier(value: value, truncationMode: truncationMode))
}
@ -298,16 +298,6 @@ struct ThemeRowWithFooterModifier: ViewModifier {
let footer: String?
}
#if !os(tvOS)
struct ThemeWindowModifier: ViewModifier {
let size: CGSize
}
struct ThemePlainButtonModifier: ViewModifier {
let action: () -> Void
}
struct ThemeEmptyMessageModifier: ViewModifier {
@EnvironmentObject
@ -352,6 +342,16 @@ struct ThemeAnimationModifier<T>: ViewModifier where T: Equatable {
}
}
#if !os(tvOS)
struct ThemeWindowModifier: ViewModifier {
let size: CGSize
}
struct ThemePlainButtonModifier: ViewModifier {
let action: () -> Void
}
struct ThemeTrailingValueModifier: ViewModifier {
let value: CustomStringConvertible?