This commit is contained in:
Grishka 2024-02-09 03:38:00 +03:00
parent ad2ef39ace
commit 6915d19fb4
3 changed files with 4 additions and 4 deletions

View File

@ -633,7 +633,7 @@ public class ProfileFragment extends LoaderFragment implements OnBackPressedList
UiUtils.confirmToggleBlockDomain(getActivity(), accountID, account, relationship.domainBlocking, ()->{ UiUtils.confirmToggleBlockDomain(getActivity(), accountID, account, relationship.domainBlocking, ()->{
relationship.domainBlocking=!relationship.domainBlocking; relationship.domainBlocking=!relationship.domainBlocking;
updateRelationship(); updateRelationship();
}); }, this::updateRelationship);
}else if(id==R.id.hide_boosts){ }else if(id==R.id.hide_boosts){
new SetAccountFollowed(account.id, true, !relationship.showingReblogs) new SetAccountFollowed(account.id, true, !relationship.showingReblogs)
.setCallback(new Callback<>(){ .setCallback(new Callback<>(){

View File

@ -426,7 +426,7 @@ public class UiUtils{
} }
} }
public static void confirmToggleBlockDomain(Activity activity, String accountID, Account account, boolean currentlyBlocked, Runnable resultCallback){ public static void confirmToggleBlockDomain(Activity activity, String accountID, Account account, boolean currentlyBlocked, Runnable resultCallback, Consumer<Relationship> callbackInCaseUserWasBlockedInstead){
if(!currentlyBlocked){ if(!currentlyBlocked){
new BlockDomainConfirmationSheet(activity, account, (onSuccess, onError)->{ new BlockDomainConfirmationSheet(activity, account, (onSuccess, onError)->{
new SetDomainBlocked(account.getDomain(), true) new SetDomainBlocked(account.getDomain(), true)
@ -449,7 +449,7 @@ public class UiUtils{
.setCallback(new Callback<>(){ .setCallback(new Callback<>(){
@Override @Override
public void onSuccess(Relationship result){ public void onSuccess(Relationship result){
resultCallback.run(); callbackInCaseUserWasBlockedInstead.accept(result);
onSuccess.run(); onSuccess.run();
E.post(new RemoveAccountPostsEvent(accountID, account.id, false)); E.post(new RemoveAccountPostsEvent(accountID, account.id, false));
} }

View File

@ -255,7 +255,7 @@ public class AccountViewHolder extends BindableViewHolder<AccountViewModel> impl
UiUtils.confirmToggleBlockDomain(fragment.getActivity(), accountID, account, relationship.domainBlocking, ()->{ UiUtils.confirmToggleBlockDomain(fragment.getActivity(), accountID, account, relationship.domainBlocking, ()->{
relationship.domainBlocking=!relationship.domainBlocking; relationship.domainBlocking=!relationship.domainBlocking;
bindRelationship(); bindRelationship();
}); }, this::updateRelationship);
}else if(id==R.id.hide_boosts){ }else if(id==R.id.hide_boosts){
new SetAccountFollowed(account.id, true, !relationship.showingReblogs) new SetAccountFollowed(account.id, true, !relationship.showingReblogs)
.setCallback(new Callback<>(){ .setCallback(new Callback<>(){