Allow only forwarding of regualr text messages

Also go back directly to the conversation list. Go back history is
reseted.

Signed-off-by: Tim Krüger <t@timkrueger.me>
This commit is contained in:
Tim Krüger 2021-07-20 10:46:43 +02:00 committed by Andy Scherzinger
parent b3d0ebf577
commit 00915e56ff
No known key found for this signature in database
GPG key ID: 6CADC7E3523C308B
2 changed files with 10 additions and 6 deletions

View file

@ -95,6 +95,7 @@ import com.facebook.imagepipeline.image.CloseableImage
import com.google.android.flexbox.FlexboxLayout
import com.nextcloud.talk.R
import com.nextcloud.talk.activities.MagicCallActivity
import com.nextcloud.talk.activities.MainActivity
import com.nextcloud.talk.adapters.messages.IncomingLocationMessageViewHolder
import com.nextcloud.talk.adapters.messages.IncomingPreviewMessageViewHolder
import com.nextcloud.talk.adapters.messages.IncomingVoiceMessageViewHolder
@ -2061,7 +2062,7 @@ class ChatController(args: Bundle) :
override fun onOptionsItemSelected(item: MenuItem): Boolean {
when (item.itemId) {
android.R.id.home -> {
router.popCurrentController()
(activity as MainActivity).resetConversationsList()
return true
}
R.id.conversation_video_call -> {
@ -2168,6 +2169,7 @@ class ChatController(args: Bundle) :
R.id.action_forward_message -> {
val bundle = Bundle()
bundle.putBoolean("forwardMessage", true)
bundle.putString("forwardMessageText", message?.text)
getRouter().pushController(
RouterTransaction.with(ConversationsListController(bundle)).pushChangeHandler
(HorizontalChangeHandler()).popChangeHandler(HorizontalChangeHandler()))
@ -2311,6 +2313,10 @@ class ChatController(args: Bundle) :
(message as ChatMessage).user.id.substring(6) != currentConversation?.actorId &&
currentConversation?.type != Conversation.ConversationType.ROOM_TYPE_ONE_TO_ONE_CALL
menu.findItem(R.id.action_delete_message).isVisible = isShowMessageDeletionButton(message)
menu.findItem(R.id.action_forward_message).isVisible = ChatMessage.MessageType.REGULAR_TEXT_MESSAGE.equals(
(message as ChatMessage)
.getMessageType()
)
if (menu.hasVisibleItems()) {
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.Q) {
setForceShowIcon(true)

View file

@ -139,6 +139,7 @@ public class ConversationsListController extends BaseController implements Searc
public static final String TAG = "ConvListController";
public static final int ID_DELETE_CONVERSATION_DIALOG = 0;
private static final String KEY_SEARCH_QUERY = "ContactsController.searchQuery";
private final Bundle bundle;
@Inject
UserUtils userUtils;
@ -209,6 +210,7 @@ public class ConversationsListController extends BaseController implements Searc
super();
setHasOptionsMenu(true);
forwardMessage = bundle.getBoolean("forwardMessage");
this.bundle = bundle;
}
@Override
@ -760,7 +762,7 @@ public class ConversationsListController extends BaseController implements Searc
shareToScreenWasShown = true;
handleSharedData();
}else if (forwardMessage) {
forwardMessage();
openConversation(bundle.getString("forwardMessageText"));
} else {
openConversation();
}
@ -768,10 +770,6 @@ public class ConversationsListController extends BaseController implements Searc
return true;
}
private void forwardMessage() {
System.out.println("Add code to forward a message here");
}
private void handleSharedData() {
collectDataFromIntent();
if (!textToPaste.isEmpty()) {