rename chatLivePeriods in helpers

This commit is contained in:
Chumva 2018-07-13 17:04:40 +03:00
parent e37e78cb33
commit a5a6154d0b
2 changed files with 8 additions and 8 deletions

View file

@ -38,9 +38,9 @@ class ShareLocationHelper(private val app: TelegramApplication) {
lastLocation = location
if (location != null && app.isInternetConnectionAvailable) {
val chatIdsToDuration = app.settings.chatLivePeriods
if (chatIdsToDuration.isNotEmpty()) {
app.telegramHelper.sendLiveLocationMessage(chatIdsToDuration, location.latitude, location.longitude)
val chatLivePeriods = app.settings.chatLivePeriods
if (chatLivePeriods.isNotEmpty()) {
app.telegramHelper.sendLiveLocationMessage(chatLivePeriods, location.latitude, location.longitude)
}
lastLocationMessageSentTime = System.currentTimeMillis()
}

View file

@ -385,15 +385,15 @@ class TelegramHelper private constructor() {
* @latitude Latitude of the location
* @longitude Longitude of the location
*/
fun sendLiveLocationMessage(chatIdsToDuration: Map<Long, Long>, latitude: Double, longitude: Double): Boolean {
fun sendLiveLocationMessage(chatLivePeriods: Map<Long, Long>, latitude: Double, longitude: Double): Boolean {
if (!requestingActiveLiveLocationMessages && haveAuthorization) {
if (needRefreshActiveLiveLocationMessages) {
getActiveLiveLocationMessages {
sendLiveLocationImpl(chatIdsToDuration, latitude, longitude)
sendLiveLocationImpl(chatLivePeriods, latitude, longitude)
}
needRefreshActiveLiveLocationMessages = false
} else {
sendLiveLocationImpl(chatIdsToDuration, latitude, longitude)
sendLiveLocationImpl(chatLivePeriods, latitude, longitude)
}
return true
}
@ -428,9 +428,9 @@ class TelegramHelper private constructor() {
}
}
private fun sendLiveLocationImpl(chatIdsToDuration: Map<Long, Long>, latitude: Double, longitude: Double) {
private fun sendLiveLocationImpl(chatLivePeriods: Map<Long, Long>, latitude: Double, longitude: Double) {
val location = TdApi.Location(latitude, longitude)
chatIdsToDuration.forEach { chatId, duration ->
chatLivePeriods.forEach { chatId, duration ->
val content = TdApi.InputMessageLocation(location, duration.toInt())
val msgId = chatLiveMessages[chatId]
if (msgId != null) {