mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 20:33:53 +01:00
Fix ExistingFileAsync call in ShareActivity
This commit is contained in:
parent
c34b8300c4
commit
4bcc9d7ddd
2 changed files with 2 additions and 10 deletions
|
|
@ -14,6 +14,7 @@ import fr.free.nrw.commons.CommonsApplication;
|
|||
|
||||
/**
|
||||
* Sends asynchronous queries to the Commons MediaWiki API to check that file doesn't already exist
|
||||
* Returns true if file exists, false if it doesn't
|
||||
*/
|
||||
public class ExistingFileAsync extends AsyncTask<Void, Void, Boolean> {
|
||||
|
||||
|
|
@ -46,11 +47,9 @@ public class ExistingFileAsync extends AsyncTask<Void, Void, Boolean> {
|
|||
Log.d(TAG, "Searching Commons API for existing file: " + result.toString());
|
||||
} catch (IOException e) {
|
||||
Log.e(TAG, "IO Exception: ", e);
|
||||
//Return empty arraylist
|
||||
return false;
|
||||
}
|
||||
|
||||
//ArrayList<ApiResult> categoryNodes = result.getNodes("/api/query/search/p/@title");
|
||||
ArrayList<ApiResult> resultNodes = result.getNodes("/api/query/allimages/");
|
||||
boolean fileExists = !resultNodes.isEmpty();
|
||||
Log.d(TAG, "File already exists in Commons:" + fileExists);
|
||||
|
|
|
|||
|
|
@ -251,14 +251,7 @@ public class ShareActivity
|
|||
//FIXME: Replace hardcoded string with call to Commons API instead (use TitleCategories.java as template)
|
||||
|
||||
ExistingFileAsync fileAsyncTask = new ExistingFileAsync(fileSHA1);
|
||||
fileAsyncTask.execute(url1, url2, url3);
|
||||
|
||||
|
||||
|
||||
String debugSHA1 = "801957214aba50cb63bb6eb1b0effa50188900ba";
|
||||
|
||||
boolean fileSHA1Found = fileSHA1.equals(debugSHA1);
|
||||
Log.d(TAG, "File found in Commons: " + fileSHA1Found);
|
||||
fileAsyncTask.execute();
|
||||
|
||||
} catch (IOException e) {
|
||||
Log.d(TAG, "IO Exception: ", e);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue