parse new map locations
This commit is contained in:
parent
77796cb3b3
commit
50e736f5a2
3 changed files with 13 additions and 0 deletions
|
@ -79,6 +79,9 @@ class ShowLocationHelper(private val app: TelegramApplication) {
|
|||
if (userName.isEmpty()) {
|
||||
userName = user.phoneNumber
|
||||
}
|
||||
if (telegramHelper.isOsmAndBot(user.id)) {
|
||||
userName = telegramHelper.getOsmAndBotDeviceName(message)
|
||||
}
|
||||
photoPath = telegramHelper.getUserPhotoPath(user)
|
||||
}
|
||||
if (userName.isEmpty()) {
|
||||
|
|
|
@ -253,6 +253,13 @@ class TelegramHelper private constructor() {
|
|||
}
|
||||
}
|
||||
|
||||
fun getOsmAndBotDeviceName(message: TdApi.Message): String {
|
||||
val replyMarkup =
|
||||
message.replyMarkup as TdApi.ReplyMarkupInlineKeyboard
|
||||
val deviceName = replyMarkup.rows[0][1].text
|
||||
return deviceName.split("\\s".toRegex())[1]
|
||||
}
|
||||
|
||||
fun isOsmAndBot(userId: Int) = users[userId]?.username == OSMAND_BOT_USERNAME
|
||||
|
||||
fun isBot(userId: Int) = users[userId]?.type is TdApi.UserTypeBot
|
||||
|
|
|
@ -131,6 +131,9 @@ object TelegramUiHelper {
|
|||
if (name.isEmpty()) {
|
||||
name = user.phoneNumber
|
||||
}
|
||||
if (helper.isOsmAndBot(user.id)) {
|
||||
name = helper.getOsmAndBotDeviceName(message)
|
||||
}
|
||||
latLon = LatLon(content.location.latitude, content.location.longitude)
|
||||
photoPath = helper.getUserPhotoPath(user)
|
||||
placeholderId = R.drawable.img_user_picture
|
||||
|
|
Loading…
Reference in a new issue