Added long press to click detection#1741
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1741 +/- ##
==========================================
- Coverage 62.06% 61.70% -0.36%
==========================================
Files 159 158 -1
Lines 3443 3429 -14
Branches 347 345 -2
==========================================
- Hits 2137 2116 -21
- Misses 1207 1214 +7
Partials 99 99 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| /** | ||
| * @param clicks 0 for other event, 1 for single tap, 2 for double tap | ||
| */ | ||
| private fun createEvent(name: String, tapEvent: TapEvent, clicks: Int = 0): LogRecordBuilder { |
There was a problem hiding this comment.
This might be overkill, but I wonder whether it's worth creating an enum that holds TapEvent and clicks and returns the attributes that should be used for each event. IMO it could avoid logic such as if(isTapEvent) growing if we continue to add more touch events to the instrumentation.
There was a problem hiding this comment.
Would it be something like this?
//TapEvent renamed to TapEventMetadata
sealed class Gesture(
val tapEventMetadata: TapEventMetadata
) {
class LongPress(val t: TapEvent): Gesture(t)
class Click(val t: TapEvent, clicks: Int): Gesture(t)
class Scale(val t: TapEvent, val scaleFactor: Double): Gesture(t)
class Scroll(val t: TapEvent, val velocityX: Double, val velocityY: Double): Gesture(t)
}There was a problem hiding this comment.
Yep, something along those lines. Gesture could even define val attributes: Map<String, Any> and generate the attributes that are required for each event.
Co-authored-by: Jamie Lynch <fractalwrench@gmail.com>
References #1576
@thompson-tomo , are these new attributes fine by you?