Merge pull request #3319 from nextcloud/Delete_System_Messages

FIxed deletion of voice, video, image, contact and location messages
This commit is contained in:
Marcel Hibbe 2023-10-02 11:16:48 +02:00 committed by GitHub
commit 703f2c021d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 1 additions and 59 deletions

View File

@ -33,13 +33,9 @@ import android.net.Uri
import android.os.Handler import android.os.Handler
import android.util.Base64 import android.util.Base64
import android.util.Log import android.util.Log
import android.view.Gravity
import android.view.MenuItem
import android.view.View import android.view.View
import android.widget.ImageView import android.widget.ImageView
import android.widget.PopupMenu
import android.widget.ProgressBar import android.widget.ProgressBar
import androidx.appcompat.view.ContextThemeWrapper
import androidx.core.content.ContextCompat import androidx.core.content.ContextCompat
import androidx.emoji2.widget.EmojiTextView import androidx.emoji2.widget.EmojiTextView
import autodagger.AutoInjector import autodagger.AutoInjector
@ -128,7 +124,7 @@ abstract class PreviewMessageViewHolder(itemView: View?, payload: Any?) :
) )
} }
clickView!!.setOnLongClickListener { l: View? -> clickView!!.setOnLongClickListener { l: View? ->
onMessageViewLongClick(message) previewMessageInterface!!.onPreviewMessageLongClick(message)
true true
} }
} else { } else {
@ -280,33 +276,6 @@ abstract class PreviewMessageViewHolder(itemView: View?, payload: Any?) :
return drawable 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?) { private fun fetchFileInformation(url: String, activeUser: User?) {
Single.fromCallable { ReadFilesystemOperation(okHttpClient, activeUser, url, 0) } Single.fromCallable { ReadFilesystemOperation(okHttpClient, activeUser, url, 0) }
.observeOn(Schedulers.io()) .observeOn(Schedulers.io())

View File

@ -4216,8 +4216,6 @@ class ChatActivity :
isOlderThanSixHours -> false isOlderThanSixHours -> false
message.systemMessageType != ChatMessage.SystemMessageType.DUMMY -> false message.systemMessageType != ChatMessage.SystemMessageType.DUMMY -> false
message.isDeleted -> false message.isDeleted -> false
message.hasFileAttachment() -> false
OBJECT_MESSAGE == message.message -> false
!CapabilitiesUtilNew.hasSpreedFeatureCapability(conversationUser, "delete-messages") -> false !CapabilitiesUtilNew.hasSpreedFeatureCapability(conversationUser, "delete-messages") -> false
!participantPermissions.hasChatPermission() -> false !participantPermissions.hasChatPermission() -> false
else -> true else -> true

View File

@ -1,25 +0,0 @@
<?xml version="1.0" encoding="utf-8"?><!--
~ Nextcloud Talk application
~
~ @author Tobias Kaminski
~ Copyright (C) 2021 Tobias Kaminski <tobias@kaminsky.me>
~
~ This program is free software: you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by
~ the Free Software Foundation, either version 3 of the License, or
~ at your option) any later version.
~
~ This program is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
~ GNU General Public License for more details.
~
~ You should have received a copy of the GNU General Public License
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/openInFiles"
android:title="@string/open_in_files_app" />
</menu>