brarcher / loyalty-card-locker

Stores your barcode-based store/loyalty cards on your phone
GNU General Public License v3.0
172 stars 29 forks source link

Import from filesystem does not suggest files explorer #307

Closed joriscode closed 4 years ago

joriscode commented 5 years ago

App version: 0.25.3 Android version: 9

When I try to import the previously exported CSV file, I am asked to select an application to perform the action (WhatsApp or Instagram :( ) however the file browser (Files) is not listed.

I have managed to make it work by replacing https://github.com/brarcher/loyalty-card-locker/blob/392024f84f202b254efb5a915810121a00831fb1/app/src/main/java/protect/card_locker/ImportExportActivity.java#L87 with

final Intent intentPickAction = new Intent(Intent.ACTION_GET_CONTENT);
intentPickAction.addCategory(Intent.CATEGORY_OPENABLE);
intentPickAction.setType("*/*");

However, I do not know if this is the correct approach and it breaks the tests. I would like to have you advice before I try to fix the tests.

brarcher commented 5 years ago

This pattern of using ACTION_PICK was originally borrowed from the open source project AntennaPod. I think what it is missing is listing what apps could service the request, then launch the one the user selects. isCallable() collects that data, but currently only cares if there exists an app that could be called.

There is a button that launches ACTION_GET_CONTENT currently, so there should be a way to launch it now without any change. Is that not what you are seeing?

joriscode commented 5 years ago

Thank you for your answer!

Indeed there are 4 buttons :

  1. Export
  2. Import from filesystem -> ACTION_PICK
  3. Use external application -> ACTION_GET_CONTENT
  4. Import from export location

Button 2 suggests as I mentioned to select applications that do no enable to select a file from the filesystem. Button 3, indeed, does enable to select a file through the files browser.

It is a bit confusing for me. Shouldn't the labels of "button 2 and button 3" inverted?

TheLastProject commented 4 years ago

Thanks for the report. I was looking through issues and realized this is a duplicate of #234 and thus has been fixed :)

@brarcher This issue can be closed

joriscode commented 4 years ago

Closing this issue then. Thank you for the update