fix: long click boost button actions on customlocaltimelines

Before, you just couldnt reblog something with the unlisted visibility directly from the custom local timelines, now you can! And there are some small adjustments to the behavior.
This commit is contained in:
LucasGGamerM 2023-04-12 13:32:22 -03:00
parent 4c698cf217
commit 8b27e6de33
1 changed files with 23 additions and 15 deletions

View File

@ -228,26 +228,21 @@ public class FooterStatusDisplayItem extends StatusDisplayItem{
} }
private void onBoostClick(View v){ private void onBoostClick(View v){
if (GlobalUserPreferences.confirmBeforeReblog) {
v.startAnimation(opacityIn);
onBoostLongClick(v);
return;
}
if(item.status.reloadWhenClicked){ if(item.status.reloadWhenClicked){
UiUtils.lookupStatus(v.getContext(), UiUtils.lookupStatus(v.getContext(),
item.status, item.accountID, null, item.status, item.accountID, null,
status -> { status -> {
if (GlobalUserPreferences.confirmBeforeReblog) { boost.setSelected(!status.reblogged);
v.startAnimation(opacityIn); AccountSessionManager.getInstance().getAccount(item.accountID).getStatusInteractionController().setReblogged(status, !status.reblogged, null, r->boostConsumer(v, r));
onBoostLongClick(v);
} else {
boost.setSelected(!status.reblogged);
AccountSessionManager.getInstance().getAccount(item.accountID).getStatusInteractionController().setReblogged(status, !status.reblogged, null, r->boostConsumer(v, r));
}
} }
); );
return; return;
} }
if (GlobalUserPreferences.confirmBeforeReblog) {
v.startAnimation(opacityIn);
onBoostLongClick(v);
return;
}
boost.setSelected(!item.status.reblogged); boost.setSelected(!item.status.reblogged);
AccountSessionManager.getInstance().getAccount(item.accountID).getStatusInteractionController().setReblogged(item.status, !item.status.reblogged, null, r->boostConsumer(v, r)); AccountSessionManager.getInstance().getAccount(item.accountID).getStatusInteractionController().setReblogged(item.status, !item.status.reblogged, null, r->boostConsumer(v, r));
} }
@ -265,9 +260,22 @@ public class FooterStatusDisplayItem extends StatusDisplayItem{
Consumer<StatusPrivacy> doReblog = (visibility) -> { Consumer<StatusPrivacy> doReblog = (visibility) -> {
v.startAnimation(opacityOut); v.startAnimation(opacityOut);
session.getStatusInteractionController() if(item.status.reloadWhenClicked){
.setReblogged(item.status, !item.status.reblogged, visibility, r->boostConsumer(v, r)); UiUtils.lookupStatus(v.getContext(),
dialog.dismiss(); item.status, item.accountID, null,
status -> {
session.getStatusInteractionController()
.setReblogged(status, !status.reblogged, visibility, r->boostConsumer(v, r));
boost.setSelected(status.reblogged);
dialog.dismiss();
}
);
} else {
session.getStatusInteractionController()
.setReblogged(item.status, !item.status.reblogged, visibility, r->boostConsumer(v, r));
boost.setSelected(item.status.reblogged);
dialog.dismiss();
}
}; };
View separator = menu.findViewById(R.id.separator); View separator = menu.findViewById(R.id.separator);