userlist bug fix
This commit is contained in:
parent
33eae0dba2
commit
161ced4c7b
|
@ -453,9 +453,8 @@ public interface Connection {
|
|||
* delete an userlist
|
||||
*
|
||||
* @param id ID of the list
|
||||
* @return removed userlist
|
||||
*/
|
||||
UserList deleteUserlist(long id) throws ConnectionException;
|
||||
void deleteUserlist(long id) throws ConnectionException;
|
||||
|
||||
/**
|
||||
* return userlists an user is owning or following
|
||||
|
|
|
@ -660,9 +660,12 @@ public class Mastodon implements Connection {
|
|||
|
||||
|
||||
@Override
|
||||
public UserList deleteUserlist(long id) throws MastodonException {
|
||||
public void deleteUserlist(long id) throws MastodonException {
|
||||
try {
|
||||
return createUserlist(delete(ENDPOINT_USERLIST + id, new ArrayList<>()));
|
||||
Response response = delete(ENDPOINT_USERLIST + id, new ArrayList<>());
|
||||
if (response.code() != 200) {
|
||||
throw new MastodonException(response);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
throw new MastodonException(e);
|
||||
}
|
||||
|
|
|
@ -794,10 +794,17 @@ public class TwitterV1 implements Connection {
|
|||
|
||||
|
||||
@Override
|
||||
public UserList deleteUserlist(long id) throws TwitterException {
|
||||
public void deleteUserlist(long id) throws TwitterException {
|
||||
List<String> params = new ArrayList<>();
|
||||
params.add("list_id=" + id);
|
||||
return getUserlist(USERLIST_DESTROY, params);
|
||||
try {
|
||||
Response response = post(USERLIST_DESTROY, params);
|
||||
if (response.code() != 200) {
|
||||
throw new TwitterException(response);
|
||||
}
|
||||
} catch (IOException exception) {
|
||||
throw new TwitterException(exception);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -45,8 +45,8 @@ public class ListAction extends AsyncExecutor<ListAction.ListActionParam, ListAc
|
|||
return new ListActionResult(ListActionResult.UNFOLLOW, param.id, result, null);
|
||||
|
||||
case ListActionParam.DELETE:
|
||||
result = connection.deleteUserlist(param.id);
|
||||
return new ListActionResult(ListActionResult.DELETE, param.id, result, null);
|
||||
connection.deleteUserlist(param.id);
|
||||
return new ListActionResult(ListActionResult.DELETE, param.id, null, null);
|
||||
}
|
||||
} catch (ConnectionException exception) {
|
||||
return new ListActionResult(ListActionResult.ERROR, param.id, null, exception);
|
||||
|
|
|
@ -421,7 +421,7 @@ public class UserlistActivity extends AppCompatActivity implements ActivityResul
|
|||
|
||||
case ListActionResult.DELETE:
|
||||
Intent intent = new Intent();
|
||||
intent.putExtra(RESULT_REMOVED_LIST_ID, result.userlist);
|
||||
intent.putExtra(RESULT_REMOVED_LIST_ID, result.id);
|
||||
setResult(RETURN_LIST_REMOVED, intent);
|
||||
Toast.makeText(getApplicationContext(), R.string.info_list_removed, Toast.LENGTH_SHORT).show();
|
||||
finish();
|
||||
|
|
Loading…
Reference in New Issue