Skip to content

Commit

Permalink
Fixed deletion of voice, video, image, contact and location messages
Browse files Browse the repository at this point in the history
Signed-off-by: Smarshal21 <[email protected]>
  • Loading branch information
Smarshal21 authored and Smarshal21 committed Sep 29, 2023
1 parent fd643da commit 9f793c2
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,9 @@ import android.net.Uri
import android.os.Handler
import android.util.Base64
import android.util.Log
import android.view.Gravity
import android.view.MenuItem
import android.view.View
import android.widget.ImageView
import android.widget.PopupMenu
import android.widget.ProgressBar
import androidx.appcompat.view.ContextThemeWrapper
import androidx.core.content.ContextCompat
import androidx.emoji2.widget.EmojiTextView
import autodagger.AutoInjector
Expand Down Expand Up @@ -128,7 +124,7 @@ abstract class PreviewMessageViewHolder(itemView: View?, payload: Any?) :
)
}
clickView!!.setOnLongClickListener { l: View? ->
onMessageViewLongClick(message)
previewMessageInterface!!.onPreviewMessageLongClick(message)
true
}
} else {
Expand Down Expand Up @@ -280,33 +276,6 @@ abstract class PreviewMessageViewHolder(itemView: View?, payload: Any?) :
return drawable
}

private fun onMessageViewLongClick(message: ChatMessage) {
if (fileViewerUtils!!.isSupportedForInternalViewer(message.selectedIndividualHashMap!![KEY_MIMETYPE])) {
previewMessageInterface!!.onPreviewMessageLongClick(message)
return
}
val viewContext: Context? = if (itemView.context != null) {
itemView.context
} else {
context
}
val popupMenu = PopupMenu(
ContextThemeWrapper(viewContext, R.style.appActionBarPopupMenu),
itemView,
Gravity.START
)
popupMenu.inflate(R.menu.chat_preview_message_menu)
popupMenu.setOnMenuItemClickListener { item: MenuItem ->
if (item.itemId == R.id.openInFiles) {
val keyID = message.selectedIndividualHashMap!![KEY_ID]
val link = message.selectedIndividualHashMap!!["link"]
fileViewerUtils!!.openFileInFilesApp(link!!, keyID!!)
}
true
}
popupMenu.show()
}

private fun fetchFileInformation(url: String, activeUser: User?) {
Single.fromCallable { ReadFilesystemOperation(okHttpClient, activeUser, url, 0) }
.observeOn(Schedulers.io())
Expand Down
2 changes: 0 additions & 2 deletions app/src/main/java/com/nextcloud/talk/chat/ChatActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4216,8 +4216,6 @@ class ChatActivity :
isOlderThanSixHours -> false
message.systemMessageType != ChatMessage.SystemMessageType.DUMMY -> false
message.isDeleted -> false
message.hasFileAttachment() -> false
OBJECT_MESSAGE == message.message -> false
!CapabilitiesUtilNew.hasSpreedFeatureCapability(conversationUser, "delete-messages") -> false
!participantPermissions.hasChatPermission() -> false
else -> true
Expand Down

0 comments on commit 9f793c2

Please sign in to comment.