don't show delete options for old messages

This commit is contained in:
ryanzhao 2021-08-17 15:11:53 +10:00
parent ecc881bc7c
commit d9eb2c7585

View File

@ -1223,6 +1223,7 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe
return return
} }
val allSentByCurrentUser = messages.all { it.isOutgoing } val allSentByCurrentUser = messages.all { it.isOutgoing }
val allHasHash = messages.all { DatabaseFactory.getLokiMessageDatabase(this@ConversationActivityV2).getMessageServerHash(it.id) != null }
if (thread.isOpenGroupRecipient) { if (thread.isOpenGroupRecipient) {
val messageCount = messages.size val messageCount = messages.size
val builder = AlertDialog.Builder(this) val builder = AlertDialog.Builder(this)
@ -1240,7 +1241,7 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe
endActionMode() endActionMode()
} }
builder.show() builder.show()
} else if (allSentByCurrentUser) { } else if (allSentByCurrentUser && allHasHash) {
val bottomSheet = DeleteOptionsBottomSheet() val bottomSheet = DeleteOptionsBottomSheet()
bottomSheet.recipient = thread bottomSheet.recipient = thread
bottomSheet.onDeleteForMeTapped = { bottomSheet.onDeleteForMeTapped = {