Apps-android-commons: Refactor ShareActivity.java

Created on 22 Mar 2017  路  15Comments  路  Source: commons-app/apps-android-commons

Unfortunately, ShareActivity is currently a big jumble of spaghetti code, haha. :/ It was already huge when we inherited the legacy app, but the complexity increased when I added to it during my newbie days as an Outreachy intern, and then again after we targeted API 23 and added runtime permissions checking.

I think ideally we would want to separate as much of the logic as possible into new classes - one for checking image coordinates, caching them, and initiating the calls to MediaWiki API for nearby categories; one for Uri handling; one for permissions if possible (not sure if possible since permissions require dialogs and thus access to the UI?)... and keep as little logic as possible in ShareActivity.java so that it is used mainly for interface code.

Not an easy undertaking, but it would be very appreciated if anyone wants to try. :)

assigned enhancement

Most helpful comment

@misaochan I would like to pick it up. I have been just picking small tasks until now so working on this might help me get more familiar with the codebase.

All 15 comments

@misaochan I would like to pick it up. I have been just picking small tasks until now so working on this might help me get more familiar with the codebase.

@maskaravivek that would be great, thanks! :)

We probably need to whittle down the number of tasks remaining for the hackathon (since we only have 1.5 days left til the showcase on Sunday), so unless anyone wants to take this on personally, I'll remove the label.

Hello @misaochan! I would like to give this refactor a try. This is my first contribution to this project and I think this is a suitable task.

Sure, @jakobsvenningsson. Feel free to take this up.

Welcome, @jakobsvenningsson ! Please feel free. :)

I'm still working on the issue, I got a bit delayed due to some problems getting the tests running. However, I will soon make a first commit.

Take your time @jakobsvenningsson :)

I have managed to move the permission logic and file image related processing logic to its own classes. I will continue with unit testing and some more refactoring.

Tanks @jakobsvenningsson , looking forward for your PR.

@jakobsvenningsson Can we merge your changes? They look good, loving the unit tests 馃憤

@domdomegg Yes, the changes are ready to be merged. I completely forgot to tell that the I finished the task when I worked on this issue in February last year. I'm sorry for that..

Can you create the pull request? I tried to but think there are a few merge conflicts that need to be resolved.

Please correct me if I'm wrong (I'm not sure which PR the changes are in), but unfortunately it seems to me that this task is outdated as of today. #1968 will be merged shortly, which completes the overhaul.

Done in #1968

Was this page helpful?
0 / 5 - 0 ratings

Related issues

maskaravivek picture maskaravivek  路  3Comments

madhurgupta10 picture madhurgupta10  路  3Comments

Opsylac picture Opsylac  路  3Comments

misaochan picture misaochan  路  4Comments

Saral-code picture Saral-code  路  3Comments