Skip to content

Fix/contact delete qa #1093

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1639,7 +1639,7 @@ open class Storage @Inject constructor(
profileManager.setUnidentifiedAccessMode(context, sender, Recipient.UnidentifiedAccessMode.UNKNOWN)
}
}
threadDatabase.setHasSent(threadId, true)

val mappingDb = blindedIdMappingDatabase
val mappings = mutableMapOf<String, BlindedIdMapping>()
threadDatabase.readerFor(threadDatabase.conversationList).use { reader ->
Expand Down Expand Up @@ -1674,7 +1674,6 @@ open class Storage @Inject constructor(
alreadyApprovedMe = it.contacts.get(sender.address.toString())?.approvedMe ?: false
}

setRecipientApproved(sender, true)
setRecipientApprovedMe(sender, true)

// only show the message if wasn't already approvedMe before
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ class HomeActivity : ScreenLockActionBarActivity(),
binding.globalSearchInputLayout.listener = this
homeAdapter.setHasStableIds(true)
homeAdapter.glide = glide
binding.searchContactsRecyclerView.adapter = homeAdapter
binding.conversationsRecyclerView.adapter = homeAdapter
binding.globalSearchRecycler.adapter = globalSearchAdapter

binding.configOutdatedView.setOnClickListener {
Expand Down Expand Up @@ -237,7 +237,7 @@ class HomeActivity : ScreenLockActionBarActivity(),
homeViewModel.data
.filterNotNull() // We don't actually want the null value here as it indicates a loading state (maybe we need a loading state?)
.collectLatest { data ->
val manager = binding.searchContactsRecyclerView.layoutManager as LinearLayoutManager
val manager = binding.conversationsRecyclerView.layoutManager as LinearLayoutManager
val firstPos = manager.findFirstCompletelyVisibleItemPosition()
val offsetTop = if(firstPos >= 0) {
manager.findViewByPosition(firstPos)?.let { view ->
Expand Down Expand Up @@ -429,14 +429,15 @@ class HomeActivity : ScreenLockActionBarActivity(),

binding.searchToolbar.isVisible = isShown
binding.sessionToolbar.isVisible = !isShown
binding.searchContactsRecyclerView.isVisible = !isShown
binding.conversationsRecyclerView.isVisible = !isShown
binding.seedReminderView.isVisible = !TextSecurePreferences.getHasViewedSeed(this) && !isShown
binding.globalSearchRecycler.isVisible = isShown
binding.conversationListContainer.isVisible = !isShown
if(isShown){
binding.newConversationButton.animate().cancel()
binding.newConversationButton.isVisible = false
} else {
updateEmptyState()
binding.newConversationButton.apply {
alpha = 0.0f
visibility = View.VISIBLE
Expand Down Expand Up @@ -482,8 +483,8 @@ class HomeActivity : ScreenLockActionBarActivity(),

// region Updating
private fun updateEmptyState() {
val threadCount = (binding.searchContactsRecyclerView.adapter)!!.itemCount
binding.emptyStateContainer.isVisible = threadCount == 0 && binding.searchContactsRecyclerView.isVisible
val threadCount = binding.conversationsRecyclerView.adapter?.itemCount ?: 0
binding.emptyStateContainer.isVisible = threadCount == 0 && binding.conversationsRecyclerView.isVisible
}

@Subscribe(threadMode = ThreadMode.MAIN)
Expand Down Expand Up @@ -606,7 +607,7 @@ class HomeActivity : ScreenLockActionBarActivity(),
storage.setBlocked(listOf(thread.recipient), true)

withContext(Dispatchers.Main) {
binding.searchContactsRecyclerView.adapter!!.notifyDataSetChanged()
binding.conversationsRecyclerView.adapter!!.notifyDataSetChanged()
}
}
// Block confirmation toast added as per SS-64
Expand All @@ -625,7 +626,7 @@ class HomeActivity : ScreenLockActionBarActivity(),
lifecycleScope.launch(Dispatchers.Default) {
storage.setBlocked(listOf(thread.recipient), false)
withContext(Dispatchers.Main) {
binding.searchContactsRecyclerView.adapter!!.notifyDataSetChanged()
binding.conversationsRecyclerView.adapter!!.notifyDataSetChanged()
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/activity_home.xml
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@
android:id="@+id/conversationListContainer">

<androidx.recyclerview.widget.RecyclerView
android:id="@+id/searchContactsRecyclerView"
android:id="@+id/conversationsRecyclerView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipToPadding="false"
Expand Down