remove updateChatTitles
This commit is contained in:
parent
cc24288a2d
commit
2b0b2b4447
3 changed files with 2 additions and 18 deletions
|
@ -49,7 +49,6 @@ class TelegramHelper private constructor() {
|
||||||
private val secretChats = ConcurrentHashMap<Int, TdApi.SecretChat>()
|
private val secretChats = ConcurrentHashMap<Int, TdApi.SecretChat>()
|
||||||
|
|
||||||
private val chats = ConcurrentHashMap<Long, TdApi.Chat>()
|
private val chats = ConcurrentHashMap<Long, TdApi.Chat>()
|
||||||
private val chatTitles = ConcurrentHashMap<String, Long>()
|
|
||||||
private val chatList = TreeSet<OrderedChat>()
|
private val chatList = TreeSet<OrderedChat>()
|
||||||
private val chatLiveMessages = ConcurrentHashMap<Long, Long>()
|
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]
|
fun getChat(id: Long) = chats[id]
|
||||||
|
|
||||||
|
@ -130,13 +129,6 @@ class TelegramHelper private constructor() {
|
||||||
|
|
||||||
fun getSupergroupFullInfo(id: Int) = supergroupsFullInfo[id]
|
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 {
|
private fun isChannel(chat: TdApi.Chat): Boolean {
|
||||||
return chat.type is TdApi.ChatTypeSupergroup && (chat.type as TdApi.ChatTypeSupergroup).isChannel
|
return chat.type is TdApi.ChatTypeSupergroup && (chat.type as TdApi.ChatTypeSupergroup).isChannel
|
||||||
}
|
}
|
||||||
|
@ -346,7 +338,6 @@ class TelegramHelper private constructor() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
updateChatIds()
|
|
||||||
listener?.onTelegramChatsRead()
|
listener?.onTelegramChatsRead()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -756,7 +747,6 @@ class TelegramHelper private constructor() {
|
||||||
chat.order = 0
|
chat.order = 0
|
||||||
setChatOrder(chat, order)
|
setChatOrder(chat, order)
|
||||||
}
|
}
|
||||||
updateChatIds()
|
|
||||||
listener?.onTelegramChatsChanged()
|
listener?.onTelegramChatsChanged()
|
||||||
}
|
}
|
||||||
TdApi.UpdateChatTitle.CONSTRUCTOR -> {
|
TdApi.UpdateChatTitle.CONSTRUCTOR -> {
|
||||||
|
@ -766,7 +756,6 @@ class TelegramHelper private constructor() {
|
||||||
synchronized(chat) {
|
synchronized(chat) {
|
||||||
chat.title = updateChat.title
|
chat.title = updateChat.title
|
||||||
}
|
}
|
||||||
updateChatIds()
|
|
||||||
listener?.onTelegramChatChanged(chat)
|
listener?.onTelegramChatChanged(chat)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -258,7 +258,7 @@ class MainActivity : AppCompatActivity(), TelegramListener, ActionButtonsListene
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun removeNonexistingChatsFromSettings() {
|
private fun removeNonexistingChatsFromSettings() {
|
||||||
val presentChatTitles = telegramHelper.getChatTitles()
|
val presentChatTitles = telegramHelper.getChatIds()
|
||||||
settings.removeNonexistingChats(presentChatTitles)
|
settings.removeNonexistingChats(presentChatTitles)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,6 @@ import net.osmand.telegram.TelegramApplication
|
||||||
import net.osmand.telegram.helpers.ShareLocationHelper
|
import net.osmand.telegram.helpers.ShareLocationHelper
|
||||||
import net.osmand.telegram.helpers.TelegramUiHelper
|
import net.osmand.telegram.helpers.TelegramUiHelper
|
||||||
import net.osmand.telegram.ui.SetTimeDialogFragment.SetTimeListAdapter.ChatViewHolder
|
import net.osmand.telegram.ui.SetTimeDialogFragment.SetTimeListAdapter.ChatViewHolder
|
||||||
import net.osmand.telegram.utils.AndroidUtils
|
|
||||||
import org.drinkless.td.libcore.telegram.TdApi
|
import org.drinkless.td.libcore.telegram.TdApi
|
||||||
import java.util.concurrent.TimeUnit
|
import java.util.concurrent.TimeUnit
|
||||||
|
|
||||||
|
@ -78,7 +77,6 @@ class SetTimeDialogFragment : DialogFragment() {
|
||||||
text = getString(R.string.shared_string_share)
|
text = getString(R.string.shared_string_share)
|
||||||
setOnClickListener {
|
setOnClickListener {
|
||||||
Toast.makeText(context, "Share", Toast.LENGTH_SHORT).show()
|
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 (seconds >= ShareLocationHelper.MIN_LOCATION_MESSAGE_LIVE_PERIOD_SEC) {
|
||||||
if (id != null) {
|
if (id != null) {
|
||||||
chatIdsToDuration[id] = seconds
|
chatIdsToDuration[id] = seconds
|
||||||
app.settings.shareLocationToChat(id, true)
|
|
||||||
app.shareLocationHelper.startSharingLocation()
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
chatIdsToDuration.keys.forEach {
|
chatIdsToDuration.keys.forEach {
|
||||||
chatIdsToDuration[it] = seconds
|
chatIdsToDuration[it] = seconds
|
||||||
|
|
Loading…
Reference in a new issue