mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 20:33:53 +01:00
Fix bug causing in-progress uploads to be marked as failed
This commit is contained in:
parent
2df1b1b02f
commit
6e2c3341b7
1 changed files with 4 additions and 1 deletions
|
|
@ -148,10 +148,11 @@ public class UploadService extends HandlerService<Contribution> {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean freshStart = true;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int onStartCommand(Intent intent, int flags, int startId) {
|
public int onStartCommand(Intent intent, int flags, int startId) {
|
||||||
if(intent.getAction() == ACTION_START_SERVICE) {
|
if(intent.getAction() == ACTION_START_SERVICE && freshStart) {
|
||||||
ContentValues failedValues = new ContentValues();
|
ContentValues failedValues = new ContentValues();
|
||||||
failedValues.put(Contribution.Table.COLUMN_STATE, Contribution.STATE_FAILED);
|
failedValues.put(Contribution.Table.COLUMN_STATE, Contribution.STATE_FAILED);
|
||||||
|
|
||||||
|
|
@ -161,6 +162,8 @@ public class UploadService extends HandlerService<Contribution> {
|
||||||
new String[]{ String.valueOf(Contribution.STATE_QUEUED), String.valueOf(Contribution.STATE_IN_PROGRESS) }
|
new String[]{ String.valueOf(Contribution.STATE_QUEUED), String.valueOf(Contribution.STATE_IN_PROGRESS) }
|
||||||
);
|
);
|
||||||
Log.d("Commons", "Set " + updated + " uploads to failed");
|
Log.d("Commons", "Set " + updated + " uploads to failed");
|
||||||
|
Log.d("Commons", "Flags is" + flags + " id is" + startId);
|
||||||
|
freshStart = false;
|
||||||
}
|
}
|
||||||
return START_REDELIVER_INTENT;
|
return START_REDELIVER_INTENT;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue