From 3fe50cb21a8629298f6860e91b88b1ef3a9a2d52 Mon Sep 17 00:00:00 2001 From: Chumva Date: Sun, 26 May 2019 10:53:55 +0300 Subject: [PATCH] Fix saving my location messages --- .../src/net/osmand/telegram/helpers/ShareLocationHelper.kt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/OsmAnd-telegram/src/net/osmand/telegram/helpers/ShareLocationHelper.kt b/OsmAnd-telegram/src/net/osmand/telegram/helpers/ShareLocationHelper.kt index 15f2339dea..e0aae18e24 100644 --- a/OsmAnd-telegram/src/net/osmand/telegram/helpers/ShareLocationHelper.kt +++ b/OsmAnd-telegram/src/net/osmand/telegram/helpers/ShareLocationHelper.kt @@ -205,7 +205,6 @@ class ShareLocationHelper(private val app: TelegramApplication) { if (currentTime - lastLocationSentTime <= chatsCounts * SENT_LOCATIONS_INTERVAL_TIME_MS) { return } - lastLocationSentTime = System.currentTimeMillis() chatsShareInfo.values.forEach { shareInfo -> if (shareInfo.pendingTdLibText >= MAX_MESSAGES_IN_TDLIB_PER_CHAT || shareInfo.pendingTdLibMap >= MAX_MESSAGES_IN_TDLIB_PER_CHAT) { @@ -229,7 +228,6 @@ class ShareLocationHelper(private val app: TelegramApplication) { } checkAndSendBufferMessagesToChat(shareInfo.chatId) } - app.locationMessages.addMyLocationMessage(location) if (bufferedMessagesFull) { checkNetworkType() } @@ -244,6 +242,7 @@ class ShareLocationHelper(private val app: TelegramApplication) { if (isBot) { sendLocationToBot(message, shareInfo, SHARE_TYPE_TEXT) } else { + lastLocationSentTime = System.currentTimeMillis() app.telegramHelper.sendNewTextLocation(shareInfo, message) } } @@ -256,6 +255,7 @@ class ShareLocationHelper(private val app: TelegramApplication) { } } else { if (shareInfo.pendingTdLibText < MAX_MESSAGES_IN_TDLIB_PER_CHAT) { + lastLocationSentTime = System.currentTimeMillis() app.telegramHelper.editTextLocation(shareInfo, message) } else { app.locationMessages.addBufferedMessage(message) @@ -277,6 +277,7 @@ class ShareLocationHelper(private val app: TelegramApplication) { app.locationMessages.addBufferedMessage(message) } } else { + lastLocationSentTime = System.currentTimeMillis() app.telegramHelper.sendNewMapLocation(shareInfo, message) } } @@ -289,6 +290,7 @@ class ShareLocationHelper(private val app: TelegramApplication) { } } else { if (shareInfo.pendingTdLibMap < MAX_MESSAGES_IN_TDLIB_PER_CHAT) { + lastLocationSentTime = System.currentTimeMillis() app.telegramHelper.editMapLocation(shareInfo, message) } else { app.locationMessages.addBufferedMessage(message)