From a379fb900ca1d857df63225ea1b18894a9e9ab1f Mon Sep 17 00:00:00 2001 From: Chumva Date: Wed, 10 Apr 2019 18:31:15 +0300 Subject: [PATCH] Fix sharing to unknown chats --- .../osmand/telegram/ui/SetTimeDialogFragment.kt | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/OsmAnd-telegram/src/net/osmand/telegram/ui/SetTimeDialogFragment.kt b/OsmAnd-telegram/src/net/osmand/telegram/ui/SetTimeDialogFragment.kt index d625da03a7..01e46ef0b4 100644 --- a/OsmAnd-telegram/src/net/osmand/telegram/ui/SetTimeDialogFragment.kt +++ b/OsmAnd-telegram/src/net/osmand/telegram/ui/SetTimeDialogFragment.kt @@ -274,12 +274,18 @@ class SetTimeDialogFragment : BaseDialogFragment(), TelegramLocationListener, Te private fun updateList() { val items: MutableList = mutableListOf() - telegramHelper.getChatList().filter { chatLivePeriods.keys.contains(it.chatId) } - .forEach { orderedChat -> - telegramHelper.getChat(orderedChat.chatId)?.also { items.add(it) } + chatLivePeriods.keys.forEach { + val chat = telegramHelper.getChat(it) + if (chat != null) { + items.add(chat) } - telegramHelper.getContacts().values.filter { userLivePeriods.keys.contains(it.id.toLong()) } - .forEach { user -> items.add(user) } + } + userLivePeriods.keys.forEach { + val user = telegramHelper.getUser(it.toInt()) + if (user != null) { + items.add(user) + } + } adapter.items = items }