diff --git a/OsmAnd-telegram/src/main/java/net/osmand/telegram/helpers/ShareLocationHelper.kt b/OsmAnd-telegram/src/main/java/net/osmand/telegram/helpers/ShareLocationHelper.kt index e9f4b4e3e7..485b9a4e9d 100644 --- a/OsmAnd-telegram/src/main/java/net/osmand/telegram/helpers/ShareLocationHelper.kt +++ b/OsmAnd-telegram/src/main/java/net/osmand/telegram/helpers/ShareLocationHelper.kt @@ -41,7 +41,7 @@ class ShareLocationHelper(private val app: TelegramApplication) { fun updateLocation(location: Location?) { lastLocation = location - if (location != null) { + if (location != null && app.isInternetConnectionAvailable) { val shareLocationChats = app.settings.getShareLocationChats() if (shareLocationChats.isNotEmpty()) { app.telegramHelper.sendLiveLocation(shareLocationChats, MAX_LOCATION_MESSAGE_LIVE_PERIOD_SEC, location.latitude, location.longitude) diff --git a/OsmAnd-telegram/src/main/java/net/osmand/telegram/helpers/TelegramHelper.kt b/OsmAnd-telegram/src/main/java/net/osmand/telegram/helpers/TelegramHelper.kt index a40a268950..250f37ab20 100644 --- a/OsmAnd-telegram/src/main/java/net/osmand/telegram/helpers/TelegramHelper.kt +++ b/OsmAnd-telegram/src/main/java/net/osmand/telegram/helpers/TelegramHelper.kt @@ -419,11 +419,13 @@ class TelegramHelper private constructor() { val updateNewChat = obj as TdApi.UpdateNewChat val chat = updateNewChat.chat synchronized(chat!!) { - chats[chat.id] = chat + if (chat.type !is TdApi.ChatTypeSupergroup || !(chat.type as TdApi.ChatTypeSupergroup).isChannel) { + chats[chat.id] = chat - val order = chat.order - chat.order = 0 - setChatOrder(chat, order) + val order = chat.order + chat.order = 0 + setChatOrder(chat, order) + } } listener?.onTelegramChatsRead() }