kiwix / kiwix-android

Kiwix for Android
https://android.kiwix.org
GNU General Public License v3.0
850 stars 442 forks source link

Add FilePicker in PlayStore variant. #3628

Open MohitMaliFtechiz opened 8 months ago

MohitMaliFtechiz commented 8 months ago

Describe the bug While testing and refactoring the code for https://github.com/kiwix/kiwix-android/pull/3624, I was thinking of accessing the zim file with file descriptor without any permission(MANAGE_EXTERNAL_STORAGE). I can read the file without permission if I select the file via the existing file picker in the Play Store variant. I have tested it on Android 11 and Android 12.

Why we had failed to access the ZIM files in the past without special permission

Expected behavior We should add the file picker in the Play Store variant and if possible we should move our functionalities to rely on fileDescriptor instead of file. Since we have more access to a file descriptor instead of a file, Android limits direct access to files without special permission on Android 11 and above.

What if we use file descriptor instead of file

Additional notes to remember

https://github.com/kiwix/kiwix-android/assets/34593983/523d4503-3548-45aa-988b-ffc035ef6263

Jaifroid commented 8 months ago

@MohitMaliFtechiz This seems a very positive direction to me. Not being able to pick archives is the biggest disadvantage of the PlayStore variant of the Kiwix Android app (which, like it or not, is always going to be the main variant for the average user).

kelson42 commented 7 months ago

We can not support opening on filehandle of ZIM files on many architectures. Reason is not very clear, but is linked to restriction on files. Therefore this can not be implemented straight.

kelson42 commented 2 months ago

Blocked by https://github.com/openzim/libzim/issues/852