From d8daf6175e5723276809fe799e04a1baff5a51de Mon Sep 17 00:00:00 2001 From: AL-Session <160798022+AL-Session@users.noreply.github.com> Date: Wed, 1 May 2024 20:08:36 +1000 Subject: [PATCH] Fixes #1476 - Canononical version number needs to be bumped to provide new Google Play Store release Co-authored-by: alansley --- app/build.gradle | 2 +- .../securesms/conversation/v2/ConversationActivityV2.kt | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 9e231c1bec..ac1b68ae6c 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -31,7 +31,7 @@ configurations.all { exclude module: "commons-logging" } -def canonicalVersionCode = 370 +def canonicalVersionCode = 371 def canonicalVersionName = "1.18.2" def postFixSize = 10 diff --git a/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/ConversationActivityV2.kt b/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/ConversationActivityV2.kt index fc6fb03e1e..84f43e014b 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/ConversationActivityV2.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/ConversationActivityV2.kt @@ -252,7 +252,7 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe viewModelFactory.create(threadId, MessagingModuleConfiguration.shared.getUserED25519KeyPair()) } private var actionMode: ActionMode? = null - private var unreadCount = 0 + private var unreadCount = Int.MAX_VALUE // Attachments private val audioRecorder = AudioRecorder(this) private val stopAudioHandler = Handler(Looper.getMainLooper()) @@ -572,10 +572,11 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe binding!!.conversationRecyclerView.layoutManager = layoutManager // Workaround for the fact that CursorRecyclerViewAdapter doesn't auto-update automatically (even though it says it will) LoaderManager.getInstance(this).restartLoader(0, null, this) - binding!!.conversationRecyclerView.addOnScrollListener(object : RecyclerView.OnScrollListener() { + binding!!.conversationRecyclerView.addOnScrollListener(object : RecyclerView.OnScrollListener() { override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) { - if (recyclerScrollState == RecyclerView.SCROLL_STATE_IDLE) { + // The unreadCount check is to prevent us scrolling to the bottom when we first enter a conversation + if (recyclerScrollState == RecyclerView.SCROLL_STATE_IDLE && unreadCount != Int.MAX_VALUE) { scrollToMostRecentMessageIfWeShould() } handleRecyclerViewScrolled()