diff --git a/mastodon/src/main/java/org/joinmastodon/android/fragments/ProfileFragment.java b/mastodon/src/main/java/org/joinmastodon/android/fragments/ProfileFragment.java index ca841742..227c2111 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/fragments/ProfileFragment.java +++ b/mastodon/src/main/java/org/joinmastodon/android/fragments/ProfileFragment.java @@ -633,7 +633,7 @@ public class ProfileFragment extends LoaderFragment implements OnBackPressedList UiUtils.confirmToggleBlockDomain(getActivity(), accountID, account, relationship.domainBlocking, ()->{ relationship.domainBlocking=!relationship.domainBlocking; updateRelationship(); - }); + }, this::updateRelationship); }else if(id==R.id.hide_boosts){ new SetAccountFollowed(account.id, true, !relationship.showingReblogs) .setCallback(new Callback<>(){ diff --git a/mastodon/src/main/java/org/joinmastodon/android/ui/utils/UiUtils.java b/mastodon/src/main/java/org/joinmastodon/android/ui/utils/UiUtils.java index 919c9036..c94755cf 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/ui/utils/UiUtils.java +++ b/mastodon/src/main/java/org/joinmastodon/android/ui/utils/UiUtils.java @@ -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 callbackInCaseUserWasBlockedInstead){ if(!currentlyBlocked){ new BlockDomainConfirmationSheet(activity, account, (onSuccess, onError)->{ new SetDomainBlocked(account.getDomain(), true) @@ -449,7 +449,7 @@ public class UiUtils{ .setCallback(new Callback<>(){ @Override public void onSuccess(Relationship result){ - resultCallback.run(); + callbackInCaseUserWasBlockedInstead.accept(result); onSuccess.run(); E.post(new RemoveAccountPostsEvent(accountID, account.id, false)); } diff --git a/mastodon/src/main/java/org/joinmastodon/android/ui/viewholders/AccountViewHolder.java b/mastodon/src/main/java/org/joinmastodon/android/ui/viewholders/AccountViewHolder.java index 32e1735a..ee52ccb6 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/ui/viewholders/AccountViewHolder.java +++ b/mastodon/src/main/java/org/joinmastodon/android/ui/viewholders/AccountViewHolder.java @@ -255,7 +255,7 @@ public class AccountViewHolder extends BindableViewHolder impl UiUtils.confirmToggleBlockDomain(fragment.getActivity(), accountID, account, relationship.domainBlocking, ()->{ relationship.domainBlocking=!relationship.domainBlocking; bindRelationship(); - }); + }, this::updateRelationship); }else if(id==R.id.hide_boosts){ new SetAccountFollowed(account.id, true, !relationship.showingReblogs) .setCallback(new Callback<>(){