Merge branch 'delete-fix' of https://github.com/Javran/Twidere-Android into Javran-delete-fix
Conflicts: twidere/src/main/java/org/mariotaku/twidere/util/AsyncTwitterWrapper.java
This commit is contained in:
parent
ef2e93da4e
commit
49742e7446
|
@ -1446,18 +1446,22 @@ public class AsyncTwitterWrapper extends TwitterWrapper {
|
||||||
protected SingleResponse<twitter4j.Status> doInBackground(final Void... params) {
|
protected SingleResponse<twitter4j.Status> doInBackground(final Void... params) {
|
||||||
final Twitter twitter = getTwitterInstance(mContext, account_id, false);
|
final Twitter twitter = getTwitterInstance(mContext, account_id, false);
|
||||||
if (twitter == null) return SingleResponse.getInstance();
|
if (twitter == null) return SingleResponse.getInstance();
|
||||||
|
twitter4j.Status status = null;
|
||||||
|
TwitterException exception = null;
|
||||||
try {
|
try {
|
||||||
final twitter4j.Status status = twitter.destroyStatus(status_id);
|
status = twitter.destroyStatus(status_id);
|
||||||
|
} catch (final TwitterException e) {
|
||||||
|
exception = e;
|
||||||
|
}
|
||||||
|
if (status != null || (exception != null && exception.getErrorCode() == HttpResponseCode.NOT_FOUND)) {
|
||||||
final ContentValues values = new ContentValues();
|
final ContentValues values = new ContentValues();
|
||||||
values.put(Statuses.MY_RETWEET_ID, -1);
|
values.put(Statuses.MY_RETWEET_ID, -1);
|
||||||
for (final Uri uri : TweetStore.STATUSES_URIS) {
|
for (final Uri uri : TweetStore.STATUSES_URIS) {
|
||||||
mResolver.delete(uri, Statuses.STATUS_ID + " = " + status_id, null);
|
mResolver.delete(uri, Statuses.STATUS_ID + " = " + status_id, null);
|
||||||
mResolver.update(uri, values, Statuses.MY_RETWEET_ID + " = " + status_id, null);
|
mResolver.update(uri, values, Statuses.MY_RETWEET_ID + " = " + status_id, null);
|
||||||
}
|
}
|
||||||
return SingleResponse.getInstance(status, null);
|
|
||||||
} catch (final TwitterException e) {
|
|
||||||
return SingleResponse.getInstance(null, e);
|
|
||||||
}
|
}
|
||||||
|
return SingleResponse.getInstance(status, exception);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue