Add check for last location sent time
This commit is contained in:
parent
40fce1cf9e
commit
1292b7b735
1 changed files with 3 additions and 1 deletions
|
@ -278,7 +278,9 @@ class TelegramSettings(private val app: TelegramApplication) {
|
|||
val gpsEnabled = try {
|
||||
if (lm.isProviderEnabled(LocationManager.GPS_PROVIDER)) {
|
||||
val loc = lm.getLastKnownLocation(LocationManager.GPS_PROVIDER)
|
||||
loc != null && ((statusChangeTime - loc.time) / 1000) < GPS_UPDATE_EXPIRED_TIME
|
||||
val gpsActive = loc != null && ((statusChangeTime - loc.time) / 1000) < GPS_UPDATE_EXPIRED_TIME
|
||||
val lastSentLocationExpired = ((statusChangeTime - app.shareLocationHelper.lastLocationMessageSentTime) / 1000) > GPS_UPDATE_EXPIRED_TIME
|
||||
(gpsActive || !lastSentLocationExpired)
|
||||
} else {
|
||||
false
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue