Skip to content

Commit

Permalink
format code and suppress KtLint CheckResult rule
Browse files Browse the repository at this point in the history
  • Loading branch information
sowjanyakch authored and mahibi committed Nov 6, 2023
1 parent ce248a7 commit 305ec47
Showing 1 changed file with 13 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ class ConversationsListActivity :
FilterConversationFragment.MENTION to false,
FilterConversationFragment.UNREAD to false
)
val searchBehaviorSubject = BehaviorSubject.createDefault(false)
val searchBehaviorSubject = BehaviorSubject.createDefault(false)

private val onBackPressedCallback = object : OnBackPressedCallback(true) {
override fun handleOnBackPressed() {
Expand All @@ -222,7 +222,6 @@ class ConversationsListActivity :
onBackPressedDispatcher.addCallback(this, onBackPressedCallback)
}


override fun onPostCreate(savedInstanceState: Bundle?) {
super.onPostCreate(savedInstanceState)

Expand Down Expand Up @@ -277,6 +276,7 @@ class ConversationsListActivity :

showSearchOrToolbar()
}

fun filterConversation() {
val accountId = UserIdUtils.getIdForUser(userManager.currentUser.blockingGet())
filterState[FilterConversationFragment.UNREAD] = (
Expand Down Expand Up @@ -329,6 +329,7 @@ class ConversationsListActivity :
) &&
(conversation.unreadMessages > 0)
)

FilterConversationFragment.UNREAD -> result = result && (conversation.unreadMessages > 0)
}
}
Expand Down Expand Up @@ -513,7 +514,7 @@ class ConversationsListActivity :
// cancel any pending searches
searchHelper!!.cancelSearch()
binding?.swipeRefreshLayoutView?.isRefreshing = false
searchBehaviorSubject.onNext(false )
searchBehaviorSubject.onNext(false)
}
binding?.swipeRefreshLayoutView?.isEnabled = true
searchView!!.onActionViewCollapsed()
Expand Down Expand Up @@ -605,6 +606,7 @@ class ConversationsListActivity :
fun showSnackbar(text: String) {
Snackbar.make(binding.root, text, Snackbar.LENGTH_LONG).show()
}

fun fetchRooms() {
val includeStatus = isUserStatusAvailable(userManager.currentUser.blockingGet())

Expand Down Expand Up @@ -649,8 +651,7 @@ class ConversationsListActivity :
if (!filterState.containsValue(true)) filterableConversationItems = conversationItems
filterConversation()
adapter!!.updateDataSet(filterableConversationItems, false)
Handler().postDelayed({ checkToShowUnreadBubble() }, UNREAD_BUBBLE_DELAY
.toLong())
Handler().postDelayed({ checkToShowUnreadBubble() }, UNREAD_BUBBLE_DELAY.toLong())
fetchOpenConversations(apiVersion)
binding?.swipeRefreshLayoutView?.isRefreshing = false
}, { throwable: Throwable ->
Expand Down Expand Up @@ -826,9 +827,9 @@ class ConversationsListActivity :
super.onScrollStateChanged(recyclerView, newState)
if (newState == RecyclerView.SCROLL_STATE_IDLE) {
val isSearchActive = searchBehaviorSubject.value
if(!isSearchActive!!){
checkToShowUnreadBubble()
}
if (!isSearchActive!!) {
checkToShowUnreadBubble()
}
}
}
})
Expand Down Expand Up @@ -877,7 +878,7 @@ class ConversationsListActivity :
binding?.newMentionPopupBubble?.let { viewThemeUtils.material.colorMaterialButtonPrimaryFilled(it) }
}


@SuppressLint("CheckResult")
@Suppress("Detekt.TooGenericExceptionCaught")
private fun checkToShowUnreadBubble() {
searchBehaviorSubject.subscribe { value ->
Expand All @@ -904,12 +905,13 @@ class ConversationsListActivity :
Log.d(
TAG,
"A NPE was caught when trying to show the unread popup bubble. This might happen when the " +
"user already left the conversations-list screen so the popup bubble is not available anymore.",
"user already left the conversations-list screen so the popup bubble is not available " +
"anymore.",
e
)
}
}
}
}
}

private fun hasUnreadItems(conversation: Conversation) =
Expand All @@ -923,7 +925,6 @@ class ConversationsListActivity :
startActivity(intent)
}


private fun dispose(disposable: Disposable?) {
if (disposable != null && !disposable.isDisposed) {
disposable.dispose()
Expand Down

0 comments on commit 305ec47

Please sign in to comment.