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> {
|
fun getChatTitles(): List<String> {
|
||||||
return chatTitles.keys().toList()
|
return chatTitles.keys().toList()
|
||||||
}
|
}
|
||||||
|
|
|
@ -211,7 +211,7 @@ class MainActivity : AppCompatActivity(), TelegramListener {
|
||||||
|
|
||||||
override fun onTelegramChatChanged(chat: TdApi.Chat) {
|
override fun onTelegramChatChanged(chat: TdApi.Chat) {
|
||||||
runOnUi {
|
runOnUi {
|
||||||
updateChat(chat)
|
updateChatsList()
|
||||||
listeners.forEach { it.get()?.onTelegramChatChanged(chat) }
|
listeners.forEach { it.get()?.onTelegramChatChanged(chat) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -258,15 +258,6 @@ class MainActivity : AppCompatActivity(), TelegramListener {
|
||||||
chatViewAdapter.chats = chats
|
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() {
|
fun loginTelegram() {
|
||||||
if (telegramHelper.getTelegramAuthorizationState() != TelegramAuthorizationState.CLOSED) {
|
if (telegramHelper.getTelegramAuthorizationState() != TelegramAuthorizationState.CLOSED) {
|
||||||
telegramHelper.logout()
|
telegramHelper.logout()
|
||||||
|
|
Loading…
Reference in a new issue