From 8056de8b3ec6a22b6c1191b4881a92bab1be5e11 Mon Sep 17 00:00:00 2001 From: Alex Sytnyk Date: Fri, 22 Jun 2018 19:01:58 +0300 Subject: [PATCH] Remove unnecessary method --- .../src/net/osmand/telegram/helpers/TelegramHelper.kt | 11 ----------- .../src/net/osmand/telegram/ui/MainActivity.kt | 11 +---------- 2 files changed, 1 insertion(+), 21 deletions(-) diff --git a/OsmAnd-telegram/src/net/osmand/telegram/helpers/TelegramHelper.kt b/OsmAnd-telegram/src/net/osmand/telegram/helpers/TelegramHelper.kt index d3f0585980..747a967693 100644 --- a/OsmAnd-telegram/src/net/osmand/telegram/helpers/TelegramHelper.kt +++ b/OsmAnd-telegram/src/net/osmand/telegram/helpers/TelegramHelper.kt @@ -81,17 +81,6 @@ class TelegramHelper private constructor() { } } - fun getChatIndex(chatId: Long): Int { - synchronized(chatList) { - for ((i, chat) in chatList.withIndex()) { - if (chat.chatId == chatId) { - return i - } - } - } - return -1 - } - fun getChatTitles(): List { return chatTitles.keys().toList() } diff --git a/OsmAnd-telegram/src/net/osmand/telegram/ui/MainActivity.kt b/OsmAnd-telegram/src/net/osmand/telegram/ui/MainActivity.kt index 0a69c1bd43..22ade33cc0 100644 --- a/OsmAnd-telegram/src/net/osmand/telegram/ui/MainActivity.kt +++ b/OsmAnd-telegram/src/net/osmand/telegram/ui/MainActivity.kt @@ -211,7 +211,7 @@ class MainActivity : AppCompatActivity(), TelegramListener { override fun onTelegramChatChanged(chat: TdApi.Chat) { runOnUi { - updateChat(chat) + updateChatsList() listeners.forEach { it.get()?.onTelegramChatChanged(chat) } } } @@ -258,15 +258,6 @@ class MainActivity : AppCompatActivity(), TelegramListener { chatViewAdapter.chats = chats } - private fun updateChat(chat: TdApi.Chat) { - val chatIndex = telegramHelper.getChatIndex(chat.id) - if (chatIndex != -1) { - chatViewAdapter.notifyItemChanged(chatIndex) - } else { - updateChatsList() - } - } - fun loginTelegram() { if (telegramHelper.getTelegramAuthorizationState() != TelegramAuthorizationState.CLOSED) { telegramHelper.logout()