From ccbd86d4e0295d887e2e08cd53d71fbd997b44f1 Mon Sep 17 00:00:00 2001 From: Chumva Date: Tue, 11 Jun 2019 12:25:24 +0300 Subject: [PATCH] Fix compilation after tdlib api updated --- OsmAnd-telegram/build.gradle | 5 +++++ .../src/net/osmand/telegram/helpers/TelegramHelper.kt | 6 +++--- .../src/net/osmand/telegram/utils/OsmandLocationUtils.kt | 9 +++++++-- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/OsmAnd-telegram/build.gradle b/OsmAnd-telegram/build.gradle index aa13df28b0..4b215af1ad 100644 --- a/OsmAnd-telegram/build.gradle +++ b/OsmAnd-telegram/build.gradle @@ -88,6 +88,10 @@ android { disable 'InvalidPackage' disable 'MissingTranslation' } + + packagingOptions { + exclude 'META-INF/proguard/androidx-annotations.pro' + } } task downloadTdLibzip { @@ -149,4 +153,5 @@ dependencies { exclude group: 'com.android.support' } implementation 'org.jetbrains:annotations-java5:15.0' + implementation 'androidx.annotation:annotation:1.1.0' } diff --git a/OsmAnd-telegram/src/net/osmand/telegram/helpers/TelegramHelper.kt b/OsmAnd-telegram/src/net/osmand/telegram/helpers/TelegramHelper.kt index 63659c5c56..59e222e375 100644 --- a/OsmAnd-telegram/src/net/osmand/telegram/helpers/TelegramHelper.kt +++ b/OsmAnd-telegram/src/net/osmand/telegram/helpers/TelegramHelper.kt @@ -413,7 +413,7 @@ class TelegramHelper private constructor() { } TdApi.File.CONSTRUCTOR -> { val file = obj as TdApi.File - client!!.send(TdApi.DownloadFile(file.id, 10), defaultHandler) + client!!.send(TdApi.DownloadFile(file.id, 10, 0, 0, true), defaultHandler) } else -> listener?.onTelegramError(-1, "Receive wrong response from TDLib: $obj") } @@ -524,7 +524,7 @@ class TelegramHelper private constructor() { } resultArticles.forEach { client?.send(TdApi.SendInlineQueryResultMessage(shareInfo.chatId, 0, true, - true, inlineQueryResults.inlineQueryId, it.id)) { obj -> + true, inlineQueryResults.inlineQueryId, it.id, false)) { obj -> handleTextLocationMessageUpdate(obj, shareInfo) } } @@ -1342,7 +1342,7 @@ class TelegramHelper private constructor() { } TdApi.File.CONSTRUCTOR -> { val file = obj as TdApi.File - client!!.send(TdApi.DownloadFile(file.id, 10), defaultHandler) + client!!.send(TdApi.DownloadFile(file.id, 10, 0, 0, true), defaultHandler) } else -> listener?.onTelegramError(-1, "Receive wrong response from TDLib: $obj") } diff --git a/OsmAnd-telegram/src/net/osmand/telegram/utils/OsmandLocationUtils.kt b/OsmAnd-telegram/src/net/osmand/telegram/utils/OsmandLocationUtils.kt index 99a48f8bc5..dd346e7896 100644 --- a/OsmAnd-telegram/src/net/osmand/telegram/utils/OsmandLocationUtils.kt +++ b/OsmAnd-telegram/src/net/osmand/telegram/utils/OsmandLocationUtils.kt @@ -94,8 +94,13 @@ object OsmandLocationUtils { fun getSenderMessageId(message: TdApi.Message): Int { val forwardInfo = message.forwardInfo - return if (forwardInfo != null && forwardInfo is TdApi.MessageForwardedFromUser) { - forwardInfo.senderUserId + return if (forwardInfo != null) { + val origin: TdApi.MessageForwardOrigin? = forwardInfo.origin + if (origin != null && origin is TdApi.MessageForwardOriginUser) { + origin.senderUserId + } else { + message.senderUserId + } } else { message.senderUserId }