File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed
app/src/main/java/fr/free/nrw/commons/contributions Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -99,6 +99,7 @@ public void onClick(View view) {
9999 @ Override
100100 public void onClick (View view ) {
101101 Log .d ("deneme" ,"Cancel button is clicked" );
102+ deleteUpload (cursor );
102103 }
103104 });
104105
@@ -126,4 +127,22 @@ public void retryUpload(Cursor cursor) {
126127
127128 }
128129 }
130+
131+ /**
132+ * Delete a failed upload attempt
133+ * @param cursor position of upload attempt which will be deteled
134+ */
135+ public void deleteUpload (Cursor cursor ) {
136+ // TODO: check internet connection, warn user and do nothing is a problem occurred
137+
138+ Contribution c = contributionDao .fromCursor (cursor );
139+ if (c .getState () == STATE_FAILED ) {
140+ Timber .d ("Deleting failed contrib %s" , c .toString ());
141+ Log .d ("deneme" ,"Deleting failed:" +c .getFilename ());
142+ contributionDao .delete (c );
143+ } else {
144+ Timber .d ("Skipping deletion for non-failed contrib %s" , c .toString ());
145+ Log .d ("deneme" ,"Skipping deletion for non-failed contrib" +c .getFilename ());
146+ }
147+ }
129148}
You can’t perform that action at this time.
0 commit comments