Repository navigation
Look up only the selected conversation, off the main thread, for its options - #2244
Draft
mpretty-cyro wants to merge 2 commits into
Draft
mpretty-cyro wants to merge 2 commits into
mpretty-cyro wants to merge 2 commits into
Conversation
…options Long-pressing a conversation on the home screen loaded the whole conversation list (every thread with its last message and unread counts) on the main thread in the options sheet's onCreate, just to find the one that was pressed. With many conversations, or a busy database, that froze the home screen until the app was killed for not responding. Query the one thread on a background thread and bind the sheet once it arrives.
The legacy-group branch still read the group on the main thread, and the not-found path could dismiss after the state was saved.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Contributor checklist
playflavour,debugFixes #1234syntaxDescription
ANR clusters with top frames
nativeExecuteForCursorWindowandnativePrepareStatementhave the main thread inConversationOptionsBottomSheet.onCreate→DefaultConversationRepository.getConversationList()→ThreadDatabase.getThreads:long-pressing a conversation loaded every thread to find one.
A new
ConversationRepository.getConversation(address)queries that one thread. The sheet loads it, and the group record, onDispatchers.IOand binds once they arrive; it stays invisibleuntil then so the options don't flash. The legacy-group options use that group record rather than reading it again on the main thread. If the conversation isn't found, the sheet is dismissed allowing state loss, since the lookup can finish after the app is backgrounded.
Testing: on an emulator with debug-only main-thread database logging (not in this PR): on
devthe sheet rangetConversationList→getThreadsandGroupDatabaseon the main thread; with this change it runs none. Options, Pin and Unpin behave as before. The ANR wasn't reproduced (it needs many conversations).