As mentioned at #1060 , this probably needs to be done prior to implementing multiple uploads. Currently upload logic is coupled to various entry points - ShareActivity.java, MultipleShareActivity.java, and soon to be NearbyMapFragment and PlaceRenderer as well when direct uploads from Nearby are implemented. We would like to get the direct Nearby uploads out first so that users can use the feature, but after that is done we should buckle down and get this sorted.
Scope of this task:
@misaochan I would like to take it up after the crash fixes if you guys agree. I already have some changes locally relating to this refactoring and i can own it up. :)
@maskaravivek Great! By all means. :)
@whym @psh or anyone else: Suggestions on how we can best organize the upload logic, especially in preparation for #604 ?
Also, I think this should go on a feature (upload-overhaul) branch, so that we can get a complete implementation of the following, before we roll out to users:
@maskaravivek do you still want to have it? If yes, I will assign to you.
@neslihanturan I think Vivek mentioned on Hangouts that he wanted to swap this with me (so he is doing Wikidata edits now and I am doing this) :)
Looking through ShareActivity.java today (which has 1000+ lines!!!!), these are my plans at the moment:
<action android:name="android.intent.action.SEND_MULTIPLE" /> and <action android:name="android.intent.action.SEND" /> intent filters should be directed to ShareActivity.java, and within ShareActivity.java itself we will handle things differently depending on whether 1 or many images are selected. @misaochan There was a discussion a little while ago: #1128 - "Thinking about a combined share GUI" - with design mockups online.
If that's the direction you're going with creating a "combined" GUI that merges the single and multiple uploads then I have a large portion of it already coded and working that you could use as a baseline to start from - see my "combined-upload" branch which implements a new UploadActivity following a Model-View-Presenter style. Happy to drop that as a PR onto a feature branch. I also extracted a "categories model" from the categorization fragment as I wanted to share code with my new upload, that helped a lot with code complexity.
Where I stopped -
content:// URIs into a local cache to support "offline" uploads and restarting failed uploadsAlso, looking at my repo, I think I need to push code from my laptop at home. I'll rebase on master and push tonight when I get home.
@psh That would be wonderful, thanks so much! :) I was initially planning for the new upload UI to be a future enhancement (the aim of this issue was just to unify the upload entry points), but given that you appear to have already done a substantial amount of work on it, I could indeed try to build on what you've done and perhaps the goal of #1128 might be realized sooner than expected. :) I'll take a look at the PR as soon as you submit it.
Have the xml files for the new layout already been added as well, or only the backend?
@maskaravivek @neslihanturan What do you guys think? This might add a bit more work for us, but it makes more sense than overhauling the old code, when the new mockups and code structure are much better IMO.
It would be great to have @psh's contribution in overhauling the upload flow. Building upon his changes would be quite nice.
Copying my comment from the PR for the keeping the conversation at one place.
Although we appreciate the efforts put into making these changes, I am not in favor of merging it as:
Having gone through the PR, I agree that it would be too difficult to build on @psh 's work at this point of time - the scope for his changes is much larger than what we originally intended, and it will be difficult to get it to work within our grant deadlines. (I probably titled this issue wrongly at the start - we are not "overhauling" the uploads per se, we just want upload logic in 1 reusable module to unify upload entry points before we can enable multiple uploads).
However, I'd like to float the possibility of picking it up in the next grant. The upload UI and process is very much due an overhaul, and that PR provides a good foundation.
Most helpful comment
Having gone through the PR, I agree that it would be too difficult to build on @psh 's work at this point of time - the scope for his changes is much larger than what we originally intended, and it will be difficult to get it to work within our grant deadlines. (I probably titled this issue wrongly at the start - we are not "overhauling" the uploads per se, we just want upload logic in 1 reusable module to unify upload entry points before we can enable multiple uploads).
However, I'd like to float the possibility of picking it up in the next grant. The upload UI and process is very much due an overhaul, and that PR provides a good foundation.