Remove account from "Home muted" when unfollowing (#1306)

This commit is contained in:
0xd9a 2025-10-08 13:57:39 +05:30
parent 5a1b750b98
commit a2b1f7ee31
4 changed files with 22 additions and 8 deletions

View file

@ -684,6 +684,8 @@ public class ProfileActivity extends BaseActivity {
this.relationship = relationShip;
updateAccount();
});
if (BaseMainActivity.filteredAccounts != null && BaseMainActivity.filteredAccounts.contains(account))
accountsVM.unmuteHome(Helper.getCurrentAccount(this), account);
dialog.dismiss();
});
unfollowConfirm.show();
@ -695,6 +697,8 @@ public class ProfileActivity extends BaseActivity {
this.relationship = relationShip;
updateAccount();
});
if (BaseMainActivity.filteredAccounts != null && BaseMainActivity.filteredAccounts.contains(account))
accountsVM.unmuteHome(Helper.getCurrentAccount(this), account);
}
} else if (doAction == action.UNBLOCK) {

View file

@ -197,14 +197,18 @@ public class ReportActivity extends BaseBarActivity {
binding.groupMute.setVisibility(View.VISIBLE);
}
}
binding.actionUnfollow.setOnClickListener(v -> accountsVM.unfollow(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, account.id)
.observe(ReportActivity.this, rsUnfollow -> {
if (rsUnfollow != null) {
relationShip = rsUnfollow;
Toasty.info(ReportActivity.this, getString(R.string.toast_unfollow), Toasty.LENGTH_LONG).show();
binding.groupUnfollow.setVisibility(View.GONE);
}
}));
binding.actionUnfollow.setOnClickListener(v -> {
accountsVM.unfollow(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, account.id)
.observe(ReportActivity.this, rsUnfollow -> {
if (rsUnfollow != null) {
relationShip = rsUnfollow;
Toasty.info(ReportActivity.this, getString(R.string.toast_unfollow), Toasty.LENGTH_LONG).show();
binding.groupUnfollow.setVisibility(View.GONE);
}
});
if (BaseMainActivity.filteredAccounts != null && BaseMainActivity.filteredAccounts.contains(account))
accountsVM.unmuteHome(Helper.getCurrentAccount(this), account);
});
binding.actionMute.setOnClickListener(v -> accountsVM.mute(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, account.id, null, null)
.observe(ReportActivity.this, rsMute -> {
if (rsMute != null) {

View file

@ -233,6 +233,8 @@ public class CrossActionHelper {
assert accountsVM != null;
accountsVM.unfollow(ownerAccount.instance, ownerAccount.token, targetedAccount.id)
.observe((LifecycleOwner) context, relationShip -> Toasty.info(context, context.getString(R.string.toast_unfollow), Toasty.LENGTH_SHORT).show());
if (BaseMainActivity.filteredAccounts != null && BaseMainActivity.filteredAccounts.contains(targetedAccount))
accountsVM.unmuteHome(ownerAccount, targetedAccount);
}
case FAVOURITE_ACTION -> {
assert statusesVM != null;

View file

@ -293,6 +293,8 @@ public class AccountAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder
account.relationShip = relationShip;
adapter.notifyItemChanged(position);
});
if (BaseMainActivity.filteredAccounts != null && BaseMainActivity.filteredAccounts.contains(account))
accountsVM.unmuteHome(Helper.getCurrentAccount(context), account).observe((LifecycleOwner) context, account1 -> adapter.notifyItemChanged(accountViewHolder.getLayoutPosition()));
dialog.dismiss();
});
unfollowConfirm.show();
@ -302,6 +304,8 @@ public class AccountAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder
account.relationShip = relationShip;
adapter.notifyItemChanged(position);
});
if (BaseMainActivity.filteredAccounts != null && BaseMainActivity.filteredAccounts.contains(account))
accountsVM.unmuteHome(Helper.getCurrentAccount(context), account).observe((LifecycleOwner) context, account1 -> adapter.notifyItemChanged(accountViewHolder.getLayoutPosition()));
}
}