remove updateChatTitles

This commit is contained in:
Chumva 2018-07-13 14:16:01 +03:00
parent cc24288a2d
commit 2b0b2b4447
3 changed files with 2 additions and 18 deletions

View file

@ -49,7 +49,6 @@ class TelegramHelper private constructor() {
private val secretChats = ConcurrentHashMap<Int, TdApi.SecretChat>()
private val chats = ConcurrentHashMap<Long, TdApi.Chat>()
private val chatTitles = ConcurrentHashMap<String, Long>()
private val chatList = TreeSet<OrderedChat>()
private val chatLiveMessages = ConcurrentHashMap<Long, Long>()
@ -98,7 +97,7 @@ class TelegramHelper private constructor() {
}
}
fun getChatTitles() = chatTitles.toList()
fun getChatIds() = chats.keys().toList()
fun getChat(id: Long) = chats[id]
@ -130,13 +129,6 @@ class TelegramHelper private constructor() {
fun getSupergroupFullInfo(id: Int) = supergroupsFullInfo[id]
private fun updateChatIds() {
chatTitles.clear()
for (chatEntry in chats.entries) {
chatTitles[chatEntry.value.title] = chatEntry.key
}
}
private fun isChannel(chat: TdApi.Chat): Boolean {
return chat.type is TdApi.ChatTypeSupergroup && (chat.type as TdApi.ChatTypeSupergroup).isChannel
}
@ -346,7 +338,6 @@ class TelegramHelper private constructor() {
return
}
}
updateChatIds()
listener?.onTelegramChatsRead()
}
@ -756,7 +747,6 @@ class TelegramHelper private constructor() {
chat.order = 0
setChatOrder(chat, order)
}
updateChatIds()
listener?.onTelegramChatsChanged()
}
TdApi.UpdateChatTitle.CONSTRUCTOR -> {
@ -766,7 +756,6 @@ class TelegramHelper private constructor() {
synchronized(chat) {
chat.title = updateChat.title
}
updateChatIds()
listener?.onTelegramChatChanged(chat)
}
}

View file

@ -258,7 +258,7 @@ class MainActivity : AppCompatActivity(), TelegramListener, ActionButtonsListene
}
private fun removeNonexistingChatsFromSettings() {
val presentChatTitles = telegramHelper.getChatTitles()
val presentChatTitles = telegramHelper.getChatIds()
settings.removeNonexistingChats(presentChatTitles)
}

View file

@ -17,7 +17,6 @@ import net.osmand.telegram.TelegramApplication
import net.osmand.telegram.helpers.ShareLocationHelper
import net.osmand.telegram.helpers.TelegramUiHelper
import net.osmand.telegram.ui.SetTimeDialogFragment.SetTimeListAdapter.ChatViewHolder
import net.osmand.telegram.utils.AndroidUtils
import org.drinkless.td.libcore.telegram.TdApi
import java.util.concurrent.TimeUnit
@ -78,7 +77,6 @@ class SetTimeDialogFragment : DialogFragment() {
text = getString(R.string.shared_string_share)
setOnClickListener {
Toast.makeText(context, "Share", Toast.LENGTH_SHORT).show()
}
}
@ -148,9 +146,6 @@ class SetTimeDialogFragment : DialogFragment() {
if (seconds >= ShareLocationHelper.MIN_LOCATION_MESSAGE_LIVE_PERIOD_SEC) {
if (id != null) {
chatIdsToDuration[id] = seconds
app.settings.shareLocationToChat(id, true)
app.shareLocationHelper.startSharingLocation()
} else {
chatIdsToDuration.keys.forEach {
chatIdsToDuration[it] = seconds