diff --git a/Course/Course/Presentation/Subviews/CourseVideoDownloadBarView/CourseVideoDownloadBarView.swift b/Course/Course/Presentation/Subviews/CourseVideoDownloadBarView/CourseVideoDownloadBarView.swift index 8af9257e..fa41436a 100644 --- a/Course/Course/Presentation/Subviews/CourseVideoDownloadBarView/CourseVideoDownloadBarView.swift +++ b/Course/Course/Presentation/Subviews/CourseVideoDownloadBarView/CourseVideoDownloadBarView.swift @@ -135,13 +135,24 @@ struct CourseVideoDownloadBarView: View { Toggle("", isOn: .constant(viewModel.isOn)) .toggleStyle(SwitchToggleStyle(tint: Theme.Colors.toggleSwitchColor)) .padding(.trailing, 15) - .onTapGesture { - if !viewModel.isInternetAvaliable { - onNotInternetAvaliable?() - return + .highPriorityGesture( + DragGesture(minimumDistance: 20, coordinateSpace: .local).onEnded { _ in + toggleAction() } - Task { await viewModel.onToggle() } - } + ) + .highPriorityGesture( + TapGesture().onEnded { + toggleAction() + } + ) .accessibilityIdentifier("download_toggle") } + + private func toggleAction() { + if !viewModel.isInternetAvaliable { + onNotInternetAvaliable?() + return + } + Task { await viewModel.onToggle() } + } }