Telegram - drop channels from the list, don't send if no internet connection
This commit is contained in:
parent
656faca471
commit
dabc6fbe21
2 changed files with 7 additions and 5 deletions
|
@ -41,7 +41,7 @@ class ShareLocationHelper(private val app: TelegramApplication) {
|
||||||
fun updateLocation(location: Location?) {
|
fun updateLocation(location: Location?) {
|
||||||
lastLocation = location
|
lastLocation = location
|
||||||
|
|
||||||
if (location != null) {
|
if (location != null && app.isInternetConnectionAvailable) {
|
||||||
val shareLocationChats = app.settings.getShareLocationChats()
|
val shareLocationChats = app.settings.getShareLocationChats()
|
||||||
if (shareLocationChats.isNotEmpty()) {
|
if (shareLocationChats.isNotEmpty()) {
|
||||||
app.telegramHelper.sendLiveLocation(shareLocationChats, MAX_LOCATION_MESSAGE_LIVE_PERIOD_SEC, location.latitude, location.longitude)
|
app.telegramHelper.sendLiveLocation(shareLocationChats, MAX_LOCATION_MESSAGE_LIVE_PERIOD_SEC, location.latitude, location.longitude)
|
||||||
|
|
|
@ -419,11 +419,13 @@ class TelegramHelper private constructor() {
|
||||||
val updateNewChat = obj as TdApi.UpdateNewChat
|
val updateNewChat = obj as TdApi.UpdateNewChat
|
||||||
val chat = updateNewChat.chat
|
val chat = updateNewChat.chat
|
||||||
synchronized(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
|
val order = chat.order
|
||||||
chat.order = 0
|
chat.order = 0
|
||||||
setChatOrder(chat, order)
|
setChatOrder(chat, order)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
listener?.onTelegramChatsRead()
|
listener?.onTelegramChatsRead()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue