Skip to content

Commit

Permalink
fix(ThreadFragment): pass correct account to ComposeView
Browse files Browse the repository at this point in the history
Fixes an issue, where the wrong account could be passed to the
ComposeView, when longpressing the replyBar and choosing an account.
  • Loading branch information
FineFindus committed May 14, 2024
1 parent e52154f commit 1ccf9bf
Showing 1 changed file with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ public void onViewCreated(View view, Bundle savedInstanceState){
UiUtils.loadCustomEmojiInTextView(replyButtonText);
replyButtonAva.setOutlineProvider(OutlineProviders.OVAL);
replyButtonAva.setClipToOutline(true);
replyButton.setOnClickListener(v->openReply());
replyButton.setOnClickListener(v->openReply(mainStatus, accountID));
replyButton.setOnLongClickListener(this::onReplyLongClick);
Account self=AccountSessionManager.get(accountID).self;
if(!TextUtils.isEmpty(self.avatar)){
Expand Down Expand Up @@ -570,11 +570,11 @@ public void onApplyWindowInsets(WindowInsets insets){
super.onApplyWindowInsets(UiUtils.applyBottomInsetToFixedView(replyContainer, insets));
}

private void openReply(){
maybeShowPreReplySheet(mainStatus, ()->{
private void openReply(Status status, String accountID){
maybeShowPreReplySheet(status, ()->{
Bundle args=new Bundle();
args.putString("account", accountID);
args.putParcelable("replyTo", Parcels.wrap(mainStatus));
args.putParcelable("replyTo", Parcels.wrap(status));
args.putBoolean("fromThreadFragment", true);
Nav.go(getActivity(), ComposeFragment.class, args);
});
Expand All @@ -583,9 +583,10 @@ private boolean onReplyLongClick(View v) {
if(mainStatus.preview) return false;
if (AccountSessionManager.getInstance().getLoggedInAccounts().size() < 2) return false;
UiUtils.pickAccount(v.getContext(), accountID, R.string.sk_reply_as, R.drawable.ic_fluent_arrow_reply_28_regular, session -> {
UiUtils.lookupStatus(v.getContext(), mainStatus, accountID, session.getID(), status -> {
String pickedAccountID = session.getID();
UiUtils.lookupStatus(v.getContext(), mainStatus, pickedAccountID, accountID, status -> {
if (status == null) return;
openReply();
openReply(status, pickedAccountID);
});
}, null);
return true;
Expand Down

0 comments on commit 1ccf9bf

Please sign in to comment.