mirror of
https://github.com/nextcloud/talk-android
synced 2025-01-18 21:18:15 +00:00
simplify condition complexity
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
This commit is contained in:
parent
9bd51ce21b
commit
89ec37d24d
@ -784,12 +784,7 @@ class ConversationsListController(bundle: Bundle) :
|
||||
for (flexItem in conversationItems) {
|
||||
val conversation: Conversation = (flexItem as ConversationItem).model
|
||||
val position = adapter!!.getGlobalPositionOf(flexItem)
|
||||
if ((
|
||||
conversation.unreadMention ||
|
||||
conversation.unreadMessages > 0 &&
|
||||
conversation.type === Conversation.ConversationType.ROOM_TYPE_ONE_TO_ONE_CALL
|
||||
) && position > lastVisibleItem
|
||||
) {
|
||||
if (hasUnreadItems(conversation) && position > lastVisibleItem) {
|
||||
nextUnreadConversationScrollPosition = position
|
||||
if (!binding.newMentionPopupBubble.isShown) {
|
||||
binding.newMentionPopupBubble.show()
|
||||
@ -809,6 +804,11 @@ class ConversationsListController(bundle: Bundle) :
|
||||
}
|
||||
}
|
||||
|
||||
private fun hasUnreadItems(conversation: Conversation) =
|
||||
conversation.unreadMention ||
|
||||
conversation.unreadMessages > 0 &&
|
||||
conversation.type === Conversation.ConversationType.ROOM_TYPE_ONE_TO_ONE_CALL
|
||||
|
||||
private fun showNewConversationsScreen() {
|
||||
val bundle = Bundle()
|
||||
bundle.putBoolean(KEY_NEW_CONVERSATION, true)
|
||||
@ -1203,8 +1203,7 @@ class ConversationsListController(bundle: Bundle) :
|
||||
conversationMenuBundle = bundle
|
||||
if (activity != null &&
|
||||
conversationMenuBundle != null &&
|
||||
currentUser != null &&
|
||||
conversationMenuBundle!!.getLong(KEY_INTERNAL_USER_ID) == currentUser!!.id
|
||||
isInternalUserEqualsCurrentUser(currentUser, conversationMenuBundle)
|
||||
) {
|
||||
val conversation = Parcels.unwrap<Conversation>(conversationMenuBundle!!.getParcelable(KEY_ROOM))
|
||||
if (conversation != null) {
|
||||
@ -1239,6 +1238,10 @@ class ConversationsListController(bundle: Bundle) :
|
||||
}
|
||||
}
|
||||
|
||||
private fun isInternalUserEqualsCurrentUser(currentUser: User?, conversationMenuBundle: Bundle?): Boolean {
|
||||
return currentUser != null && conversationMenuBundle!!.getLong(KEY_INTERNAL_USER_ID) == currentUser.id
|
||||
}
|
||||
|
||||
private fun showUnauthorizedDialog() {
|
||||
if (activity != null) {
|
||||
val dialogBuilder = MaterialAlertDialogBuilder(binding.floatingActionButton.context)
|
||||
|
Loading…
Reference in New Issue
Block a user