Merge pull request #8207 from osmandapp/Widget_for_Tracker_in_OsmAnd
widget updates fix / open MyLocationFragment on widget tap
This commit is contained in:
commit
f4fe656612
2 changed files with 7 additions and 3 deletions
|
@ -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()
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue