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