From 7d491de86ce84443f9198ce592c950dcccbce42d Mon Sep 17 00:00:00 2001 From: Harsh Shandilya Date: Wed, 7 Jun 2023 02:19:54 +0530 Subject: [PATCH] fix(android): prevent comments page from stacking when spammed --- CHANGELOG.md | 4 ++++ android/src/main/kotlin/dev/msfjarvis/claw/android/ui/ext.kt | 5 +++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 86688a3f..bda246fc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * Backup and restore options for saved posts +### Fixed + +* Spamming the comments button no longer causes it to be opened multiple times + ## [1.28.0] - 2023-06-03 ### Changed diff --git a/android/src/main/kotlin/dev/msfjarvis/claw/android/ui/ext.kt b/android/src/main/kotlin/dev/msfjarvis/claw/android/ui/ext.kt index 38551af7..de83215a 100644 --- a/android/src/main/kotlin/dev/msfjarvis/claw/android/ui/ext.kt +++ b/android/src/main/kotlin/dev/msfjarvis/claw/android/ui/ext.kt @@ -41,9 +41,10 @@ fun rememberPostActions( } override fun viewComments(postId: String) { - navController.navigate( + val currentRoute = navController.currentDestination?.route + val newRoute = Destinations.Comments.route.replace(Destinations.Comments.placeholder, postId) - ) + if (currentRoute != Destinations.Comments.route) navController.navigate(newRoute) } override fun viewCommentsPage(commentsUrl: String) {