Rename pausedLiveChatIds

This commit is contained in:
Chumva 2018-10-03 17:59:03 +03:00
parent d76f6a2e7f
commit d70d2c6dc7

View file

@ -72,7 +72,7 @@ class TelegramHelper private constructor() {
private val chatList = TreeSet<OrderedChat>()
private val chatLiveMessages = ConcurrentHashMap<Long, TdApi.Message>()
private val pausedLiveChats = mutableListOf<Long>()
private val pausedLiveChatIds = mutableListOf<Long>()
private val downloadChatFilesMap = ConcurrentHashMap<String, TdApi.Chat>()
private val downloadUserFilesMap = ConcurrentHashMap<String, TdApi.User>()
@ -598,14 +598,14 @@ class TelegramHelper private constructor() {
}
fun pauseSendingLiveLocationToChat(chatId: Long) {
synchronized(pausedLiveChats) {
pausedLiveChats.add(chatId)
synchronized(pausedLiveChatIds) {
pausedLiveChatIds.add(chatId)
}
}
fun resumeSendingLiveLocationToChat(chatId: Long) {
synchronized(pausedLiveChats) {
pausedLiveChats.remove(chatId)
synchronized(pausedLiveChatIds) {
pausedLiveChatIds.remove(chatId)
}
}
@ -614,7 +614,7 @@ class TelegramHelper private constructor() {
if (msgId != null && msgId != 0L) {
val array = LongArray(1)
array[0] = msgId
client?.send(TdApi.DeleteMessages(chatId, array, true), UpdatesHandler())
client?.send(TdApi.DeleteMessages(chatId, arrayOf(msgId), true), UpdatesHandler())
}
needRefreshActiveLiveLocationMessages = true
}
@ -656,8 +656,8 @@ class TelegramHelper private constructor() {
private fun sendLiveLocationImpl(chatLivePeriods: Map<Long, Long>, latitude: Double, longitude: Double) {
val location = TdApi.Location(latitude, longitude)
chatLivePeriods.forEach { (chatId, livePeriod) ->
synchronized(pausedLiveChats) {
if (pausedLiveChats.contains(chatId)) {
synchronized(pausedLiveChatIds) {
if (pausedLiveChatIds.contains(chatId)) {
return@forEach
}
}