diff --git a/OsmAnd-telegram/src/net/osmand/telegram/TelegramService.kt b/OsmAnd-telegram/src/net/osmand/telegram/TelegramService.kt index 77ea8f28dc..4915133e42 100644 --- a/OsmAnd-telegram/src/net/osmand/telegram/TelegramService.kt +++ b/OsmAnd-telegram/src/net/osmand/telegram/TelegramService.kt @@ -225,10 +225,10 @@ class TelegramService : Service(), LocationListener, TelegramIncomingMessagesLis updateWidgetHandler?.postDelayed({ if (isUsedByMyLocation(usedBy)) { val sharingStatus = app().settings.sharingStatusChanges.last() - val isSending = sharingStatus.statusType == TelegramSettings.SharingStatusType.SENDING + var isSending = sharingStatus.statusType == TelegramSettings.SharingStatusType.SENDING val sharingChats = app().settings.getShareLocationChats() var oldestTime = 0L - if (sharingChats.isNotEmpty()) { + if (sharingChats.isNotEmpty() && app().shareLocationHelper.sharingLocation) { sharingChats.forEach { id -> val bufferMessages = app().locationMessages.getBufferedMessagesForChat(id) if (bufferMessages.isNotEmpty()) { @@ -240,8 +240,10 @@ class TelegramService : Service(), LocationListener, TelegramIncomingMessagesLis oldestTime = 0L } } + } else { + isSending = false + oldestTime = -1 } - log.info("oldest buffered msg time: $oldestTime | isSending: $isSending") app().showLocationHelper.addOrUpdateStatusWidget(oldestTime, isSending) } startWidgetUpdates() diff --git a/OsmAnd-telegram/src/net/osmand/telegram/helpers/ShowLocationHelper.kt b/OsmAnd-telegram/src/net/osmand/telegram/helpers/ShowLocationHelper.kt index 9ff378af15..0fdb748018 100644 --- a/OsmAnd-telegram/src/net/osmand/telegram/helpers/ShowLocationHelper.kt +++ b/OsmAnd-telegram/src/net/osmand/telegram/helpers/ShowLocationHelper.kt @@ -14,6 +14,7 @@ import net.osmand.telegram.R import net.osmand.telegram.TelegramApplication import net.osmand.telegram.helpers.OsmandAidlHelper.ContextMenuButtonsListener import net.osmand.telegram.helpers.TelegramUiHelper.ListItem +import net.osmand.telegram.ui.OPEN_MY_LOCATION_TAB_KEY import net.osmand.telegram.utils.AndroidUtils import net.osmand.telegram.utils.OsmandFormatter import net.osmand.telegram.utils.OsmandLocationUtils @@ -255,6 +256,7 @@ class ShowLocationHelper(private val app: TelegramApplication) { private fun getStatusWidgetIntent(): Intent { val startIntent = app.packageManager.getLaunchIntentForPackage(app.packageName) startIntent.addCategory(Intent.CATEGORY_LAUNCHER) + startIntent.putExtra(OPEN_MY_LOCATION_TAB_KEY,true) return startIntent }