Fix small issues

This commit is contained in:
Alex Sytnyk 2018-07-13 14:42:57 +03:00
parent 2cde7dcb3f
commit 951065e21c
2 changed files with 7 additions and 11 deletions

View file

@ -53,11 +53,10 @@ class ShowLocationHelper(private val app: TelegramApplication) {
execOsmandApi { execOsmandApi {
val messages = telegramHelper.getMessages() val messages = telegramHelper.getMessages()
for (message in messages) { for (message in messages) {
val chatId = message.chatId
val date = Math.max(message.date, message.editDate) * 1000L val date = Math.max(message.date, message.editDate) * 1000L
val expired = System.currentTimeMillis() - date > app.settings.userLocationExpireTime val expired = System.currentTimeMillis() - date > app.settings.userLocationExpireTime
if (expired) { if (expired) {
removeMapPoint(chatId, message) removeMapPoint(message.chatId, message)
} }
} }
} }

View file

@ -363,9 +363,8 @@ class TelegramHelper private constructor() {
} }
removeOldMessages(message.senderUserId, message.chatId) removeOldMessages(message.senderUserId, message.chatId)
usersLocationMessages[message.id] = message usersLocationMessages[message.id] = message
val chatId = message.chatId
incomingMessagesListeners.forEach { incomingMessagesListeners.forEach {
it.onReceiveChatLocationMessages(chatId, message) it.onReceiveChatLocationMessages(message.chatId, message)
} }
} }
} }
@ -840,9 +839,8 @@ class TelegramHelper private constructor() {
synchronized(message) { synchronized(message) {
message.editDate = updateMessageEdited.editDate message.editDate = updateMessageEdited.editDate
} }
val chatId = message.chatId
incomingMessagesListeners.forEach { incomingMessagesListeners.forEach {
it.onReceiveChatLocationMessages(chatId, message) it.onReceiveChatLocationMessages(message.chatId, message)
} }
} }
} }
@ -862,9 +860,8 @@ class TelegramHelper private constructor() {
newContent newContent
} }
} }
val chatId = message.chatId
incomingMessagesListeners.forEach { incomingMessagesListeners.forEach {
it.onReceiveChatLocationMessages(chatId, message) it.onReceiveChatLocationMessages(message.chatId, message)
} }
} }
} }