swipe icon indicating copy to clipboard operation
swipe copied to clipboard

Permanent vibration on _slow_ swipe after threshold was crossed

Open thargon5090 opened this issue 1 year ago • 0 comments

Hi! After haptics feedback was added to this project, I noticed constant (and somehow annoying) vibration on slow swipes after threshold was crossed. Please consider changing it to one-shot vibration by replacing this code in SwipeableActionsBox composable

    if (state.hasCrossedSwipeThreshold() && state.swipedAction == null) {
        LaunchedEffect(state.visibleAction) {
            hapticFeedback.performHapticFeedback(HapticFeedbackType.LongPress)
        }
    }

to

    var offsetCrossed by remember { mutableStateOf(false) }
    if (state.hasCrossedSwipeThreshold()) {
        if (!offsetCrossed) {
            offsetCrossed = true
            LaunchedEffect(state.visibleAction) {
                hapticFeedback.performHapticFeedback(HapticFeedbackType.LongPress)
            }
        }
    } else {
        offsetCrossed = false
    }

or smth similar

thargon5090 avatar Apr 18 '24 11:04 thargon5090