Remove unnecessary method
This commit is contained in:
parent
25f39eefa7
commit
8056de8b3e
2 changed files with 1 additions and 21 deletions
|
@ -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<String> {
|
||||
return chatTitles.keys().toList()
|
||||
}
|
||||
|
|
|
@ -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()
|
||||
|
|
Loading…
Reference in a new issue