Skip to content

Commit

Permalink
Fix swipe direction and comment gestures that are not working well yet (
Browse files Browse the repository at this point in the history
#3239)

<!-- Thank you for submitting a Pull Request and helping to improve Home
Assistant. Please complete the following sections to help the processing
and review of your changes. Please do not delete anything from this
template. -->

## Summary
<!-- Provide a brief summary of the changes you have made and most
importantly what they aim to achieve -->

## Screenshots
<!-- If this is a user-facing change not in the frontend, please include
screenshots in light and dark mode. -->

## Link to pull request in Documentation repository
<!-- Pull requests that add, change or remove functionality must have a
corresponding pull request in the Companion App Documentation repository
(https://github.com/home-assistant/companion.home-assistant). Please add
the number of this pull request after the "#" -->
Documentation: home-assistant/companion.home-assistant#

## Any other notes
<!-- If there is any other information of note, like if this Pull
Request is part of a bigger change, please include it here. -->
  • Loading branch information
bgoncal authored Dec 5, 2024
1 parent 79c108b commit bd45612
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 27 deletions.
2 changes: 1 addition & 1 deletion Sources/App/WebView/WebViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -680,7 +680,7 @@ final class WebViewController: UIViewController, WKNavigationDelegate, WKUIDeleg
}

@objc private func screenEdgeGestureRecognizerAction(_ gesture: UIScreenEdgePanGestureRecognizer) {
let gesture: HAGesture = gesture.edges == .left ? .swipeLeft : .swipeRight
let gesture: HAGesture = gesture.edges == .left ? .swipeRight : .swipeLeft
let action = Current.settingsStore.gestures[gesture] ?? .none
handleGestureAction(action)
}
Expand Down
44 changes: 22 additions & 22 deletions Sources/Shared/HAGesture.swift
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ public enum HAGesture: CaseIterable, Codable {
case swipeRight
case swipeLeft
case _3FingersSwipeUp
case _3FingersSwipeDown
// case _3FingersSwipeDown
case _3FingersSwipeLeft
case _3FingersSwipeRight
case _2FingersSwipeUp
case _2FingersSwipeDown
// case _2FingersSwipeUp
// case _2FingersSwipeDown
case _2FingersSwipeLeft
case _2FingersSwipeRight

Expand All @@ -53,16 +53,16 @@ public enum HAGesture: CaseIterable, Codable {
return L10n.Gestures.SwipeLeft.title
case ._3FingersSwipeUp:
return L10n.Gestures._3FingersSwipeUp.title
case ._3FingersSwipeDown:
return L10n.Gestures._3FingersSwipeDown.title
// case ._3FingersSwipeDown:
// return L10n.Gestures._3FingersSwipeDown.title
case ._3FingersSwipeLeft:
return L10n.Gestures._3FingersSwipeLeft.title
case ._3FingersSwipeRight:
return L10n.Gestures._3FingersSwipeRight.title
case ._2FingersSwipeUp:
return L10n.Gestures._2FingersSwipeUp.title
case ._2FingersSwipeDown:
return L10n.Gestures._2FingersSwipeDown.title
// case ._2FingersSwipeUp:
// return L10n.Gestures._2FingersSwipeUp.title
// case ._2FingersSwipeDown:
// return L10n.Gestures._2FingersSwipeDown.title
case ._2FingersSwipeLeft:
return L10n.Gestures._2FingersSwipeLeft.title
case ._2FingersSwipeRight:
Expand All @@ -76,18 +76,18 @@ public enum HAGesture: CaseIterable, Codable {
0
case .swipeLeft:
1
case ._2FingersSwipeUp:
2
case ._2FingersSwipeDown:
3
// case ._2FingersSwipeUp:
// 2
// case ._2FingersSwipeDown:
// 3
case ._2FingersSwipeRight:
4
case ._2FingersSwipeLeft:
5
case ._3FingersSwipeUp:
6
case ._3FingersSwipeDown:
7
// case ._3FingersSwipeDown:
// 7
case ._3FingersSwipeRight:
8
case ._3FingersSwipeLeft:
Expand All @@ -105,7 +105,7 @@ public extension [HAGesture: HAGestureAction] {
._3FingersSwipeUp: .showServersList,
._3FingersSwipeRight: .nextServer,
._3FingersSwipeLeft: .previousServer,
._3FingersSwipeDown: .showSettings,
// ._3FingersSwipeDown: .showSettings,
]
}

Expand All @@ -115,10 +115,10 @@ public extension [HAGesture: HAGestureAction] {
switch numberOfTouches {
case 1:
return .none
case 2:
return Current.settingsStore.gestures[._2FingersSwipeDown] ?? .none
case 3:
return Current.settingsStore.gestures[._3FingersSwipeDown] ?? .none
// case 2:
// return Current.settingsStore.gestures[._2FingersSwipeDown] ?? .none
// case 3:
// return Current.settingsStore.gestures[._3FingersSwipeDown] ?? .none
default:
return .none
}
Expand Down Expand Up @@ -149,8 +149,8 @@ public extension [HAGesture: HAGestureAction] {
switch numberOfTouches {
case 1:
return .none
case 2:
return Current.settingsStore.gestures[._2FingersSwipeUp] ?? .none
// case 2:
// return Current.settingsStore.gestures[._2FingersSwipeUp] ?? .none
case 3:
return Current.settingsStore.gestures[._3FingersSwipeUp] ?? .none
default:
Expand Down
4 changes: 0 additions & 4 deletions Sources/Shared/Resources/Swiftgen/Strings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -869,10 +869,6 @@ public enum L10n {
/// 3 👆 swipe up
public static var title: String { return L10n.tr("Localizable", "gestures.3_fingers_swipe_up.title") }
}
public enum Disabled {
/// Some gestures are not configurable at the moment, in the future they may become configurable.
public static var footer: String { return L10n.tr("Localizable", "gestures.disabled.footer") }
}
public enum Footer {
/// Customize gestures to be used on the frontend.
public static var title: String { return L10n.tr("Localizable", "gestures.footer.title") }
Expand Down

0 comments on commit bd45612

Please sign in to comment.