Telegram - drop channels from the list, don't send if no internet connection

This commit is contained in:
crimean 2018-06-09 13:19:28 +03:00
parent 656faca471
commit dabc6fbe21
2 changed files with 7 additions and 5 deletions

View file

@ -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)

View file

@ -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()
}