ankidroid / Anki-Android

AnkiDroid: Anki flashcards on Android. Your secret trick to achieve superhuman information retention.
GNU General Public License v3.0
8.65k stars 2.24k forks source link

[Bug] "Add From Gallery" no longer visible on Amazon Build Flavor #9323

Closed david-allison closed 3 years ago

david-allison commented 3 years ago

Cause: 6d68424cd48ab0a702da949bd49a70eeb05f0dfd

Even though we can't use the camera, we can still use the gallery, which is contained in the "Add Image" screen

The "add image" permission is requested:

https://github.com/ankidroid/Anki-Android/blob/c84cf4b151cfe460fd820d4cdf90c5daec4f43e1/AnkiDroid/src/main/java/com/ichi2/anki/NoteEditor.java#L1566-L1570

yasin459 commented 3 years ago

so, i understand that "add image" must be visible, but what do you exactly want? obviously, if I comment these lines, add image will work properly(without a camera) would you please give some hints?

mikehardy commented 3 years ago

The permission check should be removed from that spot and put into a more specific spot.

It appears that for amazon builds (that is, if camera permission is not in the android manifest), this view should not be added https://github.com/ankidroid/Anki-Android/blob/39a226842004e9f329304bd227fee9bace7d5f37/AnkiDroid/src/main/java/com/ichi2/anki/multimediacard/fields/BasicImageFieldController.java#L183

And the permission check for camera here should be avoided https://github.com/ankidroid/Anki-Android/blob/39a226842004e9f329304bd227fee9bace7d5f37/AnkiDroid/src/main/java/com/ichi2/anki/multimediacard/activity/MultimediaEditFieldActivity.java#L146-L152

huenical commented 3 years ago

I'm willing to work on this!

mikehardy commented 3 years ago

@huenical I just reviewed the PR and it looks pretty good pending test results, in general it appears that @yasin459 was working on this already and you did not wait to see their response or any one else's response. Your solution appears good but by jumping in front of @yasin459 the collaboration is a little bit lacking. In the absence of confirmation that an issue really has no pending effort, please look for issues that are definitely not taken up by people so we don't duplicate effort unnecessarily, there is certainly plenty to do :-)

huenical commented 3 years ago

Thank you for pointing this out. Sorry for any inconvenience caused @yasin459