Remove assingments from 'if' clauses

Signed-off-by: Tim Krüger <t@timkrueger.me>
This commit is contained in:
Tim Krüger 2022-09-06 17:35:13 +02:00
parent f347fe1255
commit a543bdc7a7
No known key found for this signature in database
GPG Key ID: FECE3A7222C52A4E

View File

@ -306,10 +306,10 @@ class ChatController(args: Bundle) :
this.roomPassword = args.getString(BundleKeys.KEY_CONVERSATION_PASSWORD, "") this.roomPassword = args.getString(BundleKeys.KEY_CONVERSATION_PASSWORD, "")
if (conversationUser?.userId == "?") { credentials = if (conversationUser?.userId == "?") {
credentials = null null
} else { } else {
credentials = ApiUtils.getCredentials(conversationUser!!.username, conversationUser.token) ApiUtils.getCredentials(conversationUser!!.username, conversationUser.token)
} }
if (args.containsKey(BundleKeys.KEY_FROM_NOTIFICATION_START_CALL)) { if (args.containsKey(BundleKeys.KEY_FROM_NOTIFICATION_START_CALL)) {
@ -582,11 +582,10 @@ class ChatController(args: Bundle) :
this this
) )
var senderId = "" val senderId = if (!conversationUser.userId.equals("?")) {
if (!conversationUser.userId.equals("?")) { "users/" + conversationUser.userId
senderId = "users/" + conversationUser.userId
} else { } else {
senderId = currentConversation?.actorType + "/" + currentConversation?.actorId currentConversation?.actorType + "/" + currentConversation?.actorId
} }
Log.d(TAG, "Initialize TalkMessagesListAdapter with senderId: " + senderId) Log.d(TAG, "Initialize TalkMessagesListAdapter with senderId: " + senderId)
@ -638,11 +637,10 @@ class ChatController(args: Bundle) :
binding.popupBubbleView.setPopupBubbleListener { context -> binding.popupBubbleView.setPopupBubbleListener { context ->
if (newMessagesCount != 0) { if (newMessagesCount != 0) {
val scrollPosition: Int val scrollPosition = if (newMessagesCount - 1 < 0) {
if (newMessagesCount - 1 < 0) { 0
scrollPosition = 0
} else { } else {
scrollPosition = newMessagesCount - 1 newMessagesCount - 1
} }
Handler().postDelayed( Handler().postDelayed(
{ {
@ -2112,13 +2110,13 @@ class ChatController(args: Bundle) :
private fun setupWebsocket() { private fun setupWebsocket() {
if (conversationUser != null) { if (conversationUser != null) {
if (WebSocketConnectionHelper.getMagicWebSocketInstanceForUserId(conversationUser.id!!) != null) { magicWebSocketInstance =
magicWebSocketInstance = if (WebSocketConnectionHelper.getMagicWebSocketInstanceForUserId(conversationUser.id!!) != null) {
WebSocketConnectionHelper.getMagicWebSocketInstanceForUserId(conversationUser.id!!) WebSocketConnectionHelper.getMagicWebSocketInstanceForUserId(conversationUser.id!!)
} else { } else {
Log.d(TAG, "magicWebSocketInstance became null") Log.d(TAG, "magicWebSocketInstance became null")
magicWebSocketInstance = null null
} }
} }
} }
@ -2166,11 +2164,10 @@ class ChatController(args: Bundle) :
fieldMap["limit"] = MESSAGE_PULL_LIMIT fieldMap["limit"] = MESSAGE_PULL_LIMIT
fieldMap["setReadMarker"] = setReadMarker fieldMap["setReadMarker"] = setReadMarker
val lastKnown: Int val lastKnown = if (lookIntoFuture > 0) {
if (lookIntoFuture > 0) { globalLastKnownFutureMessageId
lastKnown = globalLastKnownFutureMessageId
} else { } else {
lastKnown = globalLastKnownPastMessageId globalLastKnownPastMessageId
} }
fieldMap["lastKnownMessageId"] = lastKnown fieldMap["lastKnownMessageId"] = lastKnown