Add check for old user locations messages

This commit is contained in:
Chumva 2018-12-10 17:03:52 +02:00
parent 0de3d8af76
commit 89a03881da
2 changed files with 10 additions and 3 deletions

View file

@ -393,7 +393,12 @@ class TelegramHelper private constructor() {
fun hasGrayscaleUserPhoto(userId: Int): Boolean {
return File("$appDir/$GRAYSCALE_PHOTOS_DIR$userId$GRAYSCALE_PHOTOS_EXT").exists()
}
private fun isUserLocationMessage(message: TdApi.Message): Boolean {
val cont = message.content
return (cont is MessageUserTextLocation || cont is TdApi.MessageLocation)
}
private fun hasLocalUserPhoto(user: TdApi.User): Boolean {
val localPhoto = user.profilePhoto?.small?.local
return if (localPhoto != null) {
@ -686,7 +691,7 @@ class TelegramHelper private constructor() {
}
}
}
} else if (sameSender) {
} else if (sameSender && isUserLocationMessage(message) && isUserLocationMessage(newMessage)) {
iterator.remove()
}
}

View file

@ -582,7 +582,9 @@ class MyLocationTabFragment : Fragment(), TelegramListener {
}
TelegramUiHelper.setupPhoto(app, holder.icon, photoPath, placeholderId, false)
holder.icon?.setOnClickListener {
app.forceUpdateMyLocation()
}
val title = when (item) {
is TdApi.Chat -> item.title
is TdApi.User -> TelegramUiHelper.getUserName(item)