From 3c2fb27f2a27496484f72020b7558ff50e64bf43 Mon Sep 17 00:00:00 2001 From: Chumva Date: Fri, 12 Oct 2018 12:45:09 +0300 Subject: [PATCH] Cleaned setting newLivePeriod --- .../net/osmand/telegram/ui/MyLocationTabFragment.kt | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/OsmAnd-telegram/src/net/osmand/telegram/ui/MyLocationTabFragment.kt b/OsmAnd-telegram/src/net/osmand/telegram/ui/MyLocationTabFragment.kt index 54c5fe9e8f..477e3fc047 100644 --- a/OsmAnd-telegram/src/net/osmand/telegram/ui/MyLocationTabFragment.kt +++ b/OsmAnd-telegram/src/net/osmand/telegram/ui/MyLocationTabFragment.kt @@ -546,13 +546,9 @@ class MyLocationTabFragment : Fragment(), TelegramListener { visibility = View.VISIBLE text = "${getText(R.string.plus)} ${OsmandFormatter.getFormattedDuration(context!!, time)}" setOnClickListener { - if (shareInfo != null) { - val newLivePeriod = settings.getChatLiveMessageExpireTime(chat.id) + shareInfo.additionalActiveTime - settings.shareLocationToChat(chat.id, true, newLivePeriod, shareInfo.getNextAdditionalActiveTime()) - } else { - val newLivePeriod = settings.getChatLiveMessageExpireTime(chat.id) + ADDITIONAL_ACTIVE_TIME_VALUES_SEC[0] - settings.shareLocationToChat(chat.id, true, newLivePeriod, ADDITIONAL_ACTIVE_TIME_VALUES_SEC[1]) - } + val newLivePeriod = settings.getChatLiveMessageExpireTime(chat.id) + (shareInfo?.additionalActiveTime ?: ADDITIONAL_ACTIVE_TIME_VALUES_SEC[0]) + val nextAdditionalActiveTime = shareInfo?.getNextAdditionalActiveTime() ?: ADDITIONAL_ACTIVE_TIME_VALUES_SEC[1] + settings.shareLocationToChat(chat.id, true, newLivePeriod, nextAdditionalActiveTime) notifyItemChanged(position) } }