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:
parent
735d3b2fbe
commit
320b92591e
|
@ -84,8 +84,9 @@ struct OpenVPNView: View, ModuleDraftEditing {
|
||||||
onCompletion: importConfiguration
|
onCompletion: importConfiguration
|
||||||
)
|
)
|
||||||
.modifier(PaywallModifier(reason: $paywallReason))
|
.modifier(PaywallModifier(reason: $paywallReason))
|
||||||
.withErrorHandler(errorHandler)
|
|
||||||
.navigationDestination(for: Subroute.self, destination: destination)
|
.navigationDestination(for: Subroute.self, destination: destination)
|
||||||
|
.themeAnimation(on: providerId.wrappedValue, category: .modules)
|
||||||
|
.withErrorHandler(errorHandler)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -91,7 +91,7 @@ struct ProfileView: View, TunnelInstallationProviding {
|
||||||
}
|
}
|
||||||
.ignoresSafeArea(edges: .horizontal)
|
.ignoresSafeArea(edges: .horizontal)
|
||||||
.background(theme.primaryColor.gradient)
|
.background(theme.primaryColor.gradient)
|
||||||
.animation(.default, value: isSwitching)
|
.themeAnimation(on: isSwitching, category: .profiles)
|
||||||
.withErrorHandler(errorHandler)
|
.withErrorHandler(errorHandler)
|
||||||
.defaultFocus($focusedField, .switchProfile)
|
.defaultFocus($focusedField, .switchProfile)
|
||||||
.onChange(of: tunnel.status) { _, new in
|
.onChange(of: tunnel.status) { _, new in
|
||||||
|
|
|
@ -103,15 +103,6 @@ extension View {
|
||||||
#endif
|
#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
|
@ViewBuilder
|
||||||
public func themeMultiLine(_ isMultiLine: Bool) -> some View {
|
public func themeMultiLine(_ isMultiLine: Bool) -> some View {
|
||||||
if isMultiLine {
|
if isMultiLine {
|
||||||
|
@ -138,6 +129,15 @@ extension View {
|
||||||
modifier(ThemeAnimationModifier(value: value, category: category))
|
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 {
|
public func themeTrailingValue(_ value: CustomStringConvertible?, truncationMode: Text.TruncationMode = .tail) -> some View {
|
||||||
modifier(ThemeTrailingValueModifier(value: value, truncationMode: truncationMode))
|
modifier(ThemeTrailingValueModifier(value: value, truncationMode: truncationMode))
|
||||||
}
|
}
|
||||||
|
@ -298,16 +298,6 @@ struct ThemeRowWithFooterModifier: ViewModifier {
|
||||||
let footer: String?
|
let footer: String?
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !os(tvOS)
|
|
||||||
|
|
||||||
struct ThemeWindowModifier: ViewModifier {
|
|
||||||
let size: CGSize
|
|
||||||
}
|
|
||||||
|
|
||||||
struct ThemePlainButtonModifier: ViewModifier {
|
|
||||||
let action: () -> Void
|
|
||||||
}
|
|
||||||
|
|
||||||
struct ThemeEmptyMessageModifier: ViewModifier {
|
struct ThemeEmptyMessageModifier: ViewModifier {
|
||||||
|
|
||||||
@EnvironmentObject
|
@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 {
|
struct ThemeTrailingValueModifier: ViewModifier {
|
||||||
let value: CustomStringConvertible?
|
let value: CustomStringConvertible?
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue