From dc5efb25aa5999e343dedc6070e4b83a975d942b Mon Sep 17 00:00:00 2001 From: Abdelilah El Aissaoui Date: Tue, 10 Sep 2024 18:57:37 +0200 Subject: [PATCH] Fixed double click lambda not being refreshed after changing tabs The issue would be specially present when clicking on the side panel and changing tabs, if the user tried to change a branch, it would be changed in the repository of the previous. --- .../com/jetpackduba/gitnuro/extensions/ModifierExtensions.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/com/jetpackduba/gitnuro/extensions/ModifierExtensions.kt b/src/main/kotlin/com/jetpackduba/gitnuro/extensions/ModifierExtensions.kt index b27a5b5..cde49d8 100644 --- a/src/main/kotlin/com/jetpackduba/gitnuro/extensions/ModifierExtensions.kt +++ b/src/main/kotlin/com/jetpackduba/gitnuro/extensions/ModifierExtensions.kt @@ -66,7 +66,7 @@ fun Modifier.handOnHover(): Modifier { fun Modifier.onDoubleClick( onDoubleClick: () -> Unit, ): Modifier { - return this.pointerInput(Unit) { + return this.pointerInput(onDoubleClick) { coroutineScope { awaitEachGesture { // Detect first click without consuming it (other, independent handlers want it). @@ -83,7 +83,9 @@ fun Modifier.onDoubleClick( } while (change.uptimeMillis < minUptime) change } ?: return@awaitEachGesture + secondDown.consume() + val secondUp = waitForUpOrCancellation() ?: return@awaitEachGesture secondUp.consume()