Share animation type in theme
This commit is contained in:
parent
7eb2b3bd0e
commit
0b1e465143
|
@ -310,6 +310,20 @@ extension View {
|
|||
}
|
||||
}
|
||||
|
||||
// MARK: Animations
|
||||
|
||||
extension View {
|
||||
func themeAnimation<V: Equatable>(on value: V) -> some View {
|
||||
animation(.default, value: value)
|
||||
}
|
||||
}
|
||||
|
||||
extension Binding {
|
||||
func themeAnimation() -> Binding<Value> {
|
||||
animation(.default)
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: Shortcuts
|
||||
|
||||
extension View {
|
||||
|
|
|
@ -61,7 +61,7 @@ struct AddHostView: View {
|
|||
} else {
|
||||
completeView
|
||||
}
|
||||
}.animation(.default, value: viewModel)
|
||||
}.themeAnimation(on: viewModel)
|
||||
}.toolbar {
|
||||
themeCloseItem(isPresented: bindings.$isPresented)
|
||||
ToolbarItem(placement: .primaryAction) {
|
||||
|
|
|
@ -84,7 +84,7 @@ struct AddProviderView: View {
|
|||
}.onChange(of: viewModel.errorMessage) {
|
||||
onErrorMessage($0, scrollProxy)
|
||||
}.disabled(viewModel.pendingOperation != nil)
|
||||
.animation(.default, value: providers)
|
||||
.themeAnimation(on: providers)
|
||||
}
|
||||
}.toolbar {
|
||||
themeCloseItem(isPresented: bindings.$isPresented)
|
||||
|
|
|
@ -73,7 +73,7 @@ struct DonateView: View {
|
|||
if newValue == .active {
|
||||
productManager.refreshProducts()
|
||||
}
|
||||
}.animation(.default, value: productManager.isRefreshingProducts)
|
||||
}.themeAnimation(on: productManager.isRefreshingProducts)
|
||||
}
|
||||
|
||||
private func presentedAlert(_ alertType: AlertType) -> Alert {
|
||||
|
|
|
@ -132,7 +132,7 @@ extension EndpointView {
|
|||
extension EndpointView.OpenVPNView {
|
||||
private var mainSection: some View {
|
||||
Section {
|
||||
Toggle(L10n.Global.Strings.automatic, isOn: $isAutomatic.animation())
|
||||
Toggle(L10n.Global.Strings.automatic, isOn: $isAutomatic.themeAnimation())
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -100,7 +100,7 @@ extension NetworkSettingsView {
|
|||
Section(
|
||||
header: Text(L10n.NetworkSettings.Gateway.title)
|
||||
) {
|
||||
Toggle(L10n.Global.Strings.automatic, isOn: $settings.isAutomaticGateway.animation())
|
||||
Toggle(L10n.Global.Strings.automatic, isOn: $settings.isAutomaticGateway.themeAnimation())
|
||||
|
||||
if !settings.isAutomaticGateway {
|
||||
Toggle(Unlocalized.Network.ipv4, isOn: $settings.gateway.isDefaultIPv4)
|
||||
|
@ -119,7 +119,7 @@ extension NetworkSettingsView {
|
|||
Section(
|
||||
header: Text(Unlocalized.Network.dns)
|
||||
) {
|
||||
Toggle(L10n.Global.Strings.automatic, isOn: $settings.isAutomaticDNS.animation())
|
||||
Toggle(L10n.Global.Strings.automatic, isOn: $settings.isAutomaticDNS.themeAnimation())
|
||||
|
||||
if !settings.isAutomaticDNS {
|
||||
themeTextPicker(
|
||||
|
@ -212,7 +212,7 @@ extension NetworkSettingsView {
|
|||
Section(
|
||||
header: Text(L10n.Global.Strings.proxy)
|
||||
) {
|
||||
Toggle(L10n.Global.Strings.automatic, isOn: $settings.isAutomaticProxy.animation())
|
||||
Toggle(L10n.Global.Strings.automatic, isOn: $settings.isAutomaticProxy.themeAnimation())
|
||||
|
||||
if !settings.isAutomaticProxy {
|
||||
themeTextPicker(
|
||||
|
@ -275,7 +275,7 @@ extension NetworkSettingsView {
|
|||
Section(
|
||||
header: Text(Unlocalized.Network.mtu)
|
||||
) {
|
||||
Toggle(L10n.Global.Strings.automatic, isOn: $settings.isAutomaticMTU.animation())
|
||||
Toggle(L10n.Global.Strings.automatic, isOn: $settings.isAutomaticMTU.themeAnimation())
|
||||
|
||||
if !settings.isAutomaticMTU {
|
||||
themeTextPicker(
|
||||
|
|
|
@ -72,7 +72,7 @@ struct OnDemandView: View {
|
|||
extension OnDemandView {
|
||||
private var enabledView: some View {
|
||||
Section {
|
||||
Toggle(L10n.Global.Strings.enabled, isOn: $onDemand.isEnabled.animation())
|
||||
Toggle(L10n.Global.Strings.enabled, isOn: $onDemand.isEnabled.themeAnimation())
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -83,7 +83,7 @@ extension OrganizerView {
|
|||
ForEach(otherHeaders, content: profileButton(forHeader:))
|
||||
.onDelete(perform: removeOtherProfiles)
|
||||
}
|
||||
}.animation(.default, value: profileManager.headers)
|
||||
}.themeAnimation(on: profileManager.headers)
|
||||
}
|
||||
|
||||
private var emptyView: some View {
|
||||
|
|
|
@ -83,7 +83,7 @@ extension PaywallView {
|
|||
if newValue == .active {
|
||||
productManager.refreshProducts()
|
||||
}
|
||||
}.animation(.default, value: productManager.isRefreshingProducts)
|
||||
}.themeAnimation(on: productManager.isRefreshingProducts)
|
||||
}
|
||||
|
||||
private func presentedAlert(_ alertType: AlertType) -> Alert {
|
||||
|
|
|
@ -73,7 +73,7 @@ struct ShortcutsView: View {
|
|||
// reloading
|
||||
.onAppear {
|
||||
intentsManager.reloadShortcuts()
|
||||
}.animation(.default, value: intentsManager.isReloadingShortcuts)
|
||||
}.themeAnimation(on: intentsManager.isReloadingShortcuts)
|
||||
|
||||
// IntentsUI
|
||||
.onReceive(intentsManager.shouldDismissIntentView) { _ in
|
||||
|
|
Loading…
Reference in New Issue