Create processScannedLocationsForChat for scanned locations
This commit is contained in:
parent
8cb762cde2
commit
2dbb2b657e
2 changed files with 14 additions and 16 deletions
|
@ -92,7 +92,7 @@ class LocationMessages(val app: TelegramApplication) {
|
|||
if (content != null) {
|
||||
val deviceName = if (content is OsmandLocationUtils.MessageOsmAndBotLocation) content.deviceName else ""
|
||||
val previousLocationMessage = lastLocationPoints.sortedBy { it.time }.firstOrNull {
|
||||
it.userId == senderId && it.chatId == message.chatId && it.type == type && it.deviceName == deviceName
|
||||
it.userId == senderId && it.chatId == message.chatId && it.deviceName == deviceName && it.type == type
|
||||
}
|
||||
if (previousLocationMessage == null || content.lastUpdated * 1000L > previousLocationMessage.time) {
|
||||
log.debug("addNewLocationMessage passed ${message.id}")
|
||||
|
|
|
@ -605,16 +605,18 @@ class TelegramHelper private constructor() {
|
|||
log.debug("scanChatHistory searchMessageId: ${lastMessage.id}")
|
||||
} else {
|
||||
log.debug("scanChatHistory finishForChat: $chatId")
|
||||
if (locations.isNotEmpty()) {
|
||||
locations.sortBy { message -> OsmandLocationUtils.getLastUpdatedTime(message) }
|
||||
updateLastMessage(locations.last())
|
||||
incomingMessagesListeners.forEach {
|
||||
it.onReceiveChatLocationMessages(chatId, *locations.toTypedArray())
|
||||
}
|
||||
}
|
||||
processScannedLocationsForChat(chatId, locations)
|
||||
}
|
||||
} else {
|
||||
log.debug("scanChatHistory finishForChat: $chatId")
|
||||
processScannedLocationsForChat(chatId, locations)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun processScannedLocationsForChat(chatId: Long, locations: MutableList<TdApi.Message>) {
|
||||
if (locations.isNotEmpty()) {
|
||||
locations.sortBy { message -> OsmandLocationUtils.getLastUpdatedTime(message) }
|
||||
updateLastMessage(locations.last())
|
||||
|
@ -623,10 +625,6 @@ class TelegramHelper private constructor() {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun requestUser(id: Int) {
|
||||
client?.send(TdApi.GetUser(id)) { obj ->
|
||||
|
|
Loading…
Reference in a new issue