android-library
android-library copied to clipboard
missing filename/path in remoteFinish
Because otherwise one doesn't know, which of the (already started several file download operations at this point) downloads finished, but to handle them, while others are downloaded, it's necessesary to know the filepath it's gotten saved at.
I did a small workaround, but it's probably not meant that way: in file: lib-common-operations-RemoteOperationResult:
#115: private String mFilename;
#172: if ("filename".equals(current.getName().toLowerCase())) { mFilename = current.getValue(); }
public String getFilename() { return mFilename == null ? null : mFilename; }
in file: lib-resources-files-DownloadRemoteFileOperation:
// # 85: instead of "result = new RemoteOperationResult...." (custom header)
// old version was line 87
Header[] headerArray = null;
if (mGet != null) {
headerArray = mGet.getResponseHeaders();
ArrayList<Header> headerList = new ArrayList<Header>();
Collections.addAll(headerList, headerArray);
headerList.add(new Header("Filename", tmpFile.toString()));
headerArray = new Header[headerList.size()];
headerList.toArray(headerArray);
} else {
headerArray = null;
}
result = new RemoteOperationResult(isSuccess(status), status, headerArray);
Cheers!
Thanks for your input!
It's true, sometimes it's difficult to have in the result all the information needed. The point is that we didn't want to have subclasses of RemoteOperationResult
for every different RemoteOperation
, nor adding all the possible details of every operation as member of the class.
For that reason we added the field mData
, so that every operation saves any relevant data. Not too elegant, but effective enough for the OC app needs.
May I suggest you make a pull request with your proposal? We can continue the discussion there.
Thanks.
Outdated, closing here 🚀