add const for gps expired time
This commit is contained in:
parent
f89cf5a5a4
commit
9d38b4ca4a
1 changed files with 3 additions and 1 deletions
|
@ -75,6 +75,8 @@ private const val BATTERY_OPTIMISATION_ASKED = "battery_optimisation_asked"
|
||||||
|
|
||||||
private const val SHARING_INITIALIZATION_TIME = 60 * 2L // 2 minutes
|
private const val SHARING_INITIALIZATION_TIME = 60 * 2L // 2 minutes
|
||||||
|
|
||||||
|
private const val GPS_UPDATE_EXPIRED_TIME = 60 * 3L // 3 minutes
|
||||||
|
|
||||||
class TelegramSettings(private val app: TelegramApplication) {
|
class TelegramSettings(private val app: TelegramApplication) {
|
||||||
|
|
||||||
private var shareChatsInfo = ConcurrentHashMap<Long, ShareChatInfo>()
|
private var shareChatsInfo = ConcurrentHashMap<Long, ShareChatInfo>()
|
||||||
|
@ -276,7 +278,7 @@ class TelegramSettings(private val app: TelegramApplication) {
|
||||||
val gpsEnabled = try {
|
val gpsEnabled = try {
|
||||||
if (lm.isProviderEnabled(LocationManager.GPS_PROVIDER)) {
|
if (lm.isProviderEnabled(LocationManager.GPS_PROVIDER)) {
|
||||||
val loc = lm.getLastKnownLocation(LocationManager.GPS_PROVIDER)
|
val loc = lm.getLastKnownLocation(LocationManager.GPS_PROVIDER)
|
||||||
loc != null && ((statusChangeTime - loc.time) / 1000) < 180
|
loc != null && ((statusChangeTime - loc.time) / 1000) < GPS_UPDATE_EXPIRED_TIME
|
||||||
} else {
|
} else {
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue