Skip to content

Commit

Permalink
Merge pull request #384 from FineFindus/fix/save-lists
Browse files Browse the repository at this point in the history
fix(lists): send requests for list membership
  • Loading branch information
LucasGGamerM authored May 4, 2024
2 parents d5cd016 + f7d0bda commit 60f0a3d
Showing 1 changed file with 11 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import org.joinmastodon.android.E;
import org.joinmastodon.android.R;
import org.joinmastodon.android.api.MastodonAPIRequest;
import org.joinmastodon.android.api.ResultlessMastodonAPIRequest;
import org.joinmastodon.android.api.requests.lists.AddAccountsToList;
import org.joinmastodon.android.api.requests.lists.CreateList;
import org.joinmastodon.android.api.requests.lists.GetLists;
Expand Down Expand Up @@ -120,16 +121,16 @@ public void onError(ErrorResponse error) {
private void saveListMembership(String listId, boolean isMember) {
userInList.put(listId, isMember);
List<String> accountIdList = Collections.singletonList(profileAccountId);
// MastodonAPIRequest<Object> req = (MastodonAPIRequest<Object>) (isMember ? new AddAccountsToList(listId, accountIdList) : new RemoveAccountsFromList(listId, accountIdList));
// req.setCallback(new Callback<>() {
// @Override
// public void onSuccess(Object o) {}
//
// @Override
// public void onError(ErrorResponse error) {
// error.showToast(getContext());
// }
// }).exec(accountID);
ResultlessMastodonAPIRequest req = isMember ? new AddAccountsToList(listId, accountIdList) : new RemoveAccountsFromList(listId, accountIdList);
req.setCallback(new Callback<>() {
@Override
public void onSuccess(Void o) {}

@Override
public void onError(ErrorResponse error) {
error.showToast(getContext());
}
}).exec(accountID);
}

@Override
Expand Down

0 comments on commit 60f0a3d

Please sign in to comment.