Skip to content

Commit

Permalink
fix original handleShowInChat()
Browse files Browse the repository at this point in the history
  • Loading branch information
r10s committed Jan 13, 2025
1 parent e44ab52 commit d625033
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -959,7 +959,17 @@ public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
handleResendMessage(getListAdapter().getSelectedItems());
return true;
case R.id.menu_show_in_chat:
handleShowInChat(getSelectedMessageRecord(getListAdapter().getSelectedItems()));
DcMsg savedMsg = getSelectedMessageRecord(getListAdapter().getSelectedItems());
int originalChatId = savedMsg.getOriginalChatId();
if (originalChatId != 0) {
Intent intent = new Intent(getContext(), ConversationActivity.class);
intent.putExtra(ConversationActivity.CHAT_ID_EXTRA, originalChatId);
int originalMsgId = savedMsg.getOriginalMsgId();
if (originalMsgId != 0) {
intent.putExtra(ConversationActivity.STARTING_POSITION_EXTRA, DcMsg.getMessagePosition(dcContext.getMsg(originalMsgId), dcContext));
}
startActivity(intent);
}
return true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,15 +109,10 @@ private void performSave(Set<DcMsg> messageRecords) {
if (actionMode != null) actionMode.finish();
}

protected void handleShowInChat(final DcMsg savedMsg) {
protected void handleShowInChat(final DcMsg dcMsg) {
Intent intent = new Intent(getContext(), ConversationActivity.class);
intent.putExtra(ConversationActivity.CHAT_ID_EXTRA, savedMsg.getOriginalChatId());

int originalMsgId = savedMsg.getOriginalMsgId();
if (originalMsgId != 0) {
intent.putExtra(ConversationActivity.STARTING_POSITION_EXTRA, DcMsg.getMessagePosition(dcContext.getMsg(originalMsgId), dcContext));
}

intent.putExtra(ConversationActivity.CHAT_ID_EXTRA, dcMsg.getChatId());
intent.putExtra(ConversationActivity.STARTING_POSITION_EXTRA, DcMsg.getMessagePosition(dcMsg, dcContext));
startActivity(intent);
}

Expand Down

0 comments on commit d625033

Please sign in to comment.