1
0
Fork 0
mirror of https://github.com/miniflux/v2.git synced 2025-08-16 18:01:37 +00:00

Add swipe as option for gesture navigation between entries.

* Refactor `TouchHandler` to handle double-tap and swipe gestures.
  * Renamed existing `onTouch` JavaScript methods to `onItemTouch` and
    added `onContentTouch` methods for swipe gesture.
  * Refactor double-tap. It's now a method in `TouchHandler` versus
    anonymous functions in `listen()` method.
* Updated CSS classes.
  * Added `touch-action` CSS for `.entry-content`.
  * Renamed CSS classes for adding events in `TouchHandler`.
* Updated users settings to replace checkbox for double tap with select
  for none, double tap, or swipe.
* Added database migrations for new gesture_nav option.
  * Rename `users.double_tap` to `users.gesture_nav` and migrate
    existing user settings.
* Updated translation files. (Non-English updated with Google
  Translate.)

Resolves #1449, closes #1495
This commit is contained in:
dzaikos 2022-09-30 05:37:57 +00:00 committed by Frédéric Guillot
parent 140a40acaf
commit 7d252ea45b
32 changed files with 238 additions and 81 deletions

View file

@ -79,6 +79,12 @@ func ValidateUserModification(store *storage.Storage, userID int64, changes *mod
}
}
if changes.GestureNav != nil {
if err := validateGestureNav(*changes.GestureNav); err != nil {
return err
}
}
if changes.DefaultReadingSpeed != nil {
if err := validateReadingSpeed(*changes.DefaultReadingSpeed); err != nil {
return err
@ -163,6 +169,13 @@ func validateDisplayMode(displayMode string) *ValidationError {
return nil
}
func validateGestureNav(gestureNav string) *ValidationError {
if gestureNav != "none" && gestureNav != "tap" && gestureNav != "swipe" {
return NewValidationError("error.invalid_gesture_nav")
}
return nil
}
func validateDefaultHomePage(defaultHomePage string) *ValidationError {
defaultHomePages := model.HomePages()
if _, found := defaultHomePages[defaultHomePage]; !found {