diff --git a/OsmAnd-telegram/src/net/osmand/telegram/helpers/ShowLocationHelper.kt b/OsmAnd-telegram/src/net/osmand/telegram/helpers/ShowLocationHelper.kt index 529c789056..2676fc1aed 100644 --- a/OsmAnd-telegram/src/net/osmand/telegram/helpers/ShowLocationHelper.kt +++ b/OsmAnd-telegram/src/net/osmand/telegram/helpers/ShowLocationHelper.kt @@ -53,11 +53,10 @@ class ShowLocationHelper(private val app: TelegramApplication) { execOsmandApi { val messages = telegramHelper.getMessages() for (message in messages) { - val chatId = message.chatId val date = Math.max(message.date, message.editDate) * 1000L val expired = System.currentTimeMillis() - date > app.settings.userLocationExpireTime if (expired) { - removeMapPoint(chatId, message) + removeMapPoint(message.chatId, message) } } } diff --git a/OsmAnd-telegram/src/net/osmand/telegram/helpers/TelegramHelper.kt b/OsmAnd-telegram/src/net/osmand/telegram/helpers/TelegramHelper.kt index d317289b6d..8e55b4ab56 100644 --- a/OsmAnd-telegram/src/net/osmand/telegram/helpers/TelegramHelper.kt +++ b/OsmAnd-telegram/src/net/osmand/telegram/helpers/TelegramHelper.kt @@ -104,10 +104,10 @@ class TelegramHelper private constructor() { fun getUser(id: Int) = users[id] fun getUserMessage(user: TdApi.User) = - usersLocationMessages.values.firstOrNull { it.senderUserId == user.id } + usersLocationMessages.values.firstOrNull { it.senderUserId == user.id } fun getChatMessages(chatId: Long) = - usersLocationMessages.values.filter { it.chatId == chatId } + usersLocationMessages.values.filter { it.chatId == chatId } fun getMessages() = usersLocationMessages.values.toList() @@ -363,9 +363,8 @@ class TelegramHelper private constructor() { } removeOldMessages(message.senderUserId, message.chatId) usersLocationMessages[message.id] = message - val chatId = message.chatId - incomingMessagesListeners.forEach { - it.onReceiveChatLocationMessages(chatId, message) + incomingMessagesListeners.forEach { + it.onReceiveChatLocationMessages(message.chatId, message) } } } @@ -840,9 +839,8 @@ class TelegramHelper private constructor() { synchronized(message) { message.editDate = updateMessageEdited.editDate } - val chatId = message.chatId incomingMessagesListeners.forEach { - it.onReceiveChatLocationMessages(chatId, message) + it.onReceiveChatLocationMessages(message.chatId, message) } } } @@ -862,9 +860,8 @@ class TelegramHelper private constructor() { newContent } } - val chatId = message.chatId incomingMessagesListeners.forEach { - it.onReceiveChatLocationMessages(chatId, message) + it.onReceiveChatLocationMessages(message.chatId, message) } } }