Skip to content

Commit

Permalink
Merge pull request #3319 from nextcloud/Delete_System_Messages
Browse files Browse the repository at this point in the history
FIxed deletion of voice, video, image, contact and location messages
  • Loading branch information
mahibi authored Oct 2, 2023
2 parents 3367b8b + b652e45 commit 703f2c0
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 59 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
25 changes: 0 additions & 25 deletions app/src/main/res/menu/chat_preview_message_menu.xml

This file was deleted.

0 comments on commit 703f2c0

Please sign in to comment.