filesystem_picker icon indicating copy to clipboard operation
filesystem_picker copied to clipboard

Multiple selections, multiple root directories, and more...

Open kuchienkz opened this issue 3 years ago • 13 comments

  1. ~~Parameter rootDirectory becomes optional. When not set, internal storage will be set as root, another external storage may be selected by accessing the Drawer on dialog.~~
  2. Parameter rootDirectory changed to rootDirectories, takes List<Directory>. Throws exception if list is empty.
  3. Optional parameter rootName changed to rootNames, takes List<String>. Uses Path.basename when ignored, and for values that equals empty string.
  4. ~~Implemented MANAGE_EXTERNAL_STORAGE permission for Android 11. It is required to access files outside app storage.~~
  5. Implemented Multi-select mode for both Directory and File.
  6. Confirming File selections are now done by bottom bar buttons, previously by tapping on the File.
  7. Intercepted back button behavior. Back button will moves view to previous directory. Close dialog when on root.
  8. Added horizontal divider for File/Directory items.
  9. Dialog returns Iterable<String>?, containing Files/Directories paths. The return value will contain exactly one file/directory on single-select mode. Returns null if canceled.
  10. Handles long file name better, by adding ellipsis right before file extension (if any). For directory, the ellipsis will be put on the end.
  11. Refactored structure of package (thanks @alr2413, it was a lot easier).
  12. ~~(Temporary) Target SDK reverted to API level 29. Reason: https://stackoverflow.com/questions/65885987/after-adding-manage-external-storage-permission-i-can-not-upload-apk-to-google~~

kuchienkz avatar Apr 04 '21 20:04 kuchienkz

Great improvement.

Ping @andyduke. Is there any problem with this PR that is not merged yet?

alr2413 avatar Apr 20 '21 15:04 alr2413

@kuchienkz, i've tested your fork. when i set the "fixedRootDirectory" it stuck at loading state. also, why did you change the minSDK from 16 to 19? thanks.

alr2413 avatar Apr 21 '21 10:04 alr2413

when i set the "fixedRootDirectory" it stuck at loading state.

Fixed that silly bug. I was so focused on the new features that I forgot to test the original ones, my bad.

also, why did you change the minSDK from 16 to 19?

No particular reason. If I'm not mistaken, the original native codes used the old flutter project format, I'm simply too lazy to migrate it and decided to create a new flutter project with the exact same package names, and import the native/android project, and do some minor adjustments. The minSDK 19 was used by default when you create a new project.

kuchienkz avatar Apr 21 '21 11:04 kuchienkz

hmmm,

i agree with that change but you drop the support of older SDKs (the library must be backward compatible). Also, it seems that you made this package to be platform dependent. i think it's better to manage the directory outside of this package with path_provider.

please, let me know if i'm wrong. thanks

alr2413 avatar Apr 21 '21 15:04 alr2413

Now that you mention it, I really forgot to consider another platform since I'm using this package mainly on android projects 😅 .

I agree with that change but you drop the support of older SDKs (the library must be backward compatible).

Based on your suggestion, I modified the native codes so that it is backward compatible to SDK 16 (and changed the minSDK).

Also, it seems that you made this package to be platform-dependent. I think it's better to manage the directory outside of this package with path_provider.

I'm not really familiar with plugin (or package?) development so I don't think I fully understand what you mean.

CMIIW, instead of using the native android codes to get all available storage roots (which made it platform-dependent), so it's better to get storage roots with path_provider?

Or should I just remove the "optional rootDirectory" feature and make it mandatory again?

thanks

kuchienkz avatar Apr 22 '21 07:04 kuchienkz

You're migrating this package from dart to plugin type. Check this Package types for more information. if you make it a plugin type, you've to implement the storage functionality for all platforms.

i think you should do this.

remove the "optional rootDirectory" feature and make it mandatory again

alr2413 avatar Apr 22 '21 07:04 alr2413

@kuchienkz, i've forked your repo and refactored base code for better management. i also created a PR in your repo. Please take a look. Thanks

alr2413 avatar Apr 22 '21 11:04 alr2413

Also, modified example app to use the new themeData parameter.

Please tell me if there is something wrong. Thanks.

kuchienkz avatar Apr 22 '21 16:04 kuchienkz

I couldn't build that for my android 10 device. the permission_handler in example app throws lots of exception. i'm still looking for a solution.

> Task :permission_handler:compileDebugJavaWithJavac FAILED
/Users/alireza/bin/flutter/.pub-cache/hosted/pub.dartlang.org/permission_handler-7.0.0/android/src/main/java/com/baseflow/permissionhandler/PermissionManager.java:54: error: cannot find symbol
            status = Environment.isExternalStorageManager()
                                ^
  symbol:   method isExternalStorageManager()
  location: class Environment
/Users/alireza/bin/flutter/.pub-cache/hosted/pub.dartlang.org/permission_handler-7.0.0/android/src/main/java/com/baseflow/permissionhandler/PermissionManager.java:218: error: cannot find symbol
                    if (permission == PermissionConstants.PERMISSION_GROUP_MANAGE_EXTERNAL_STORAGE && Build.VERSION.SDK_INT < Build.VERSION_CODES.R) {
                                                                                                                                                 ^
  symbol:   variable R
  location: class VERSION_CODES
/Users/alireza/bin/flutter/.pub-cache/hosted/pub.dartlang.org/permission_handler-7.0.0/android/src/main/java/com/baseflow/permissionhandler/PermissionManager.java:232: error: cannot find symbol
            } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R && permission == PermissionConstants.PERMISSION_GROUP_MANAGE_EXTERNAL_STORAGE) {
                                                                   ^
  symbol:   variable R
  location: class VERSION_CODES
/Users/alireza/bin/flutter/.pub-cache/hosted/pub.dartlang.org/permission_handler-7.0.0/android/src/main/java/com/baseflow/permissionhandler/PermissionManager.java:234: error: cannot find symbol
                        Settings.ACTION_MANAGE_APP_ALL_FILES_ACCESS_PERMISSION,
                                ^
  symbol:   variable ACTION_MANAGE_APP_ALL_FILES_ACCESS_PERMISSION
  location: class Settings
/Users/alireza/bin/flutter/.pub-cache/hosted/pub.dartlang.org/permission_handler-7.0.0/android/src/main/java/com/baseflow/permissionhandler/PermissionManager.java:293: error: cannot find symbol
                if (Build.VERSION.SDK_INT < Build.VERSION_CODES.R) {
                                                               ^
  symbol:   variable R
  location: class VERSION_CODES
/Users/alireza/bin/flutter/.pub-cache/hosted/pub.dartlang.org/permission_handler-7.0.0/android/src/main/java/com/baseflow/permissionhandler/PermissionManager.java:322: error: cannot find symbol
                    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.R) {
                                                                   ^
  symbol:   variable R
  location: class VERSION_CODES
/Users/alireza/bin/flutter/.pub-cache/hosted/pub.dartlang.org/permission_handler-7.0.0/android/src/main/java/com/baseflow/permissionhandler/PermissionManager.java:326: error: cannot find symbol
                    return Environment.isExternalStorageManager()
                                      ^
  symbol:   method isExternalStorageManager()
  location: class Environment
/Users/alireza/bin/flutter/.pub-cache/hosted/pub.dartlang.org/permission_handler-7.0.0/android/src/main/java/com/baseflow/permissionhandler/PermissionUtils.java:64: error: cannot find symbol
            case Manifest.permission.MANAGE_EXTERNAL_STORAGE:
                                    ^
  symbol:   variable MANAGE_EXTERNAL_STORAGE
  location: class permission
/Users/alireza/bin/flutter/.pub-cache/hosted/pub.dartlang.org/permission_handler-7.0.0/android/src/main/java/com/baseflow/permissionhandler/PermissionUtils.java:223: error: cannot find symbol
                if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R && hasPermissionInManifest(context, permissionNames, Manifest.permission.MANAGE_EXTERNAL_STORAGE ))
                                                                ^
  symbol:   variable R
  location: class VERSION_CODES
/Users/alireza/bin/flutter/.pub-cache/hosted/pub.dartlang.org/permission_handler-7.0.0/android/src/main/java/com/baseflow/permissionhandler/PermissionUtils.java:223: error: cannot find symbol
                if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R && hasPermissionInManifest(context, permissionNames, Manifest.permission.MANAGE_EXTERNAL_STORAGE ))
                                                                                                                                           ^
  symbol:   variable MANAGE_EXTERNAL_STORAGE
  location: class permission
/Users/alireza/bin/flutter/.pub-cache/hosted/pub.dartlang.org/permission_handler-7.0.0/android/src/main/java/com/baseflow/permissionhandler/PermissionUtils.java:224: error: cannot find symbol
                    permissionNames.add(Manifest.permission.MANAGE_EXTERNAL_STORAGE);
                                                           ^
  symbol:   variable MANAGE_EXTERNAL_STORAGE
  location: class permission
11 errors

alr2413 avatar Apr 23 '21 10:04 alr2413

i updated compileSdkVersion to 30, and it's solved. i'm testing now

alr2413 avatar Apr 23 '21 10:04 alr2413

@kuchienkz nice work. i created a PR that fixed the above issue. thanks.

alr2413 avatar Apr 23 '21 10:04 alr2413

Please note that if you use this on an app that also uses MANAGE_EXTERNAL_STORAGE permission, you can't upload it to PlayStore until 5 May 2021.

Read more: https://support.google.com/googleplay/android-developer/answer/10467955

kuchienkz avatar Apr 23 '21 16:04 kuchienkz

Thank you so much for adding these features! Not sure why this hasn't been merged! At this point you should probably just publish it haha!

MarkisDev avatar Jul 17 '21 23:07 MarkisDev

Actually, I really want Multiple selections.

newproplus avatar Sep 17 '23 09:09 newproplus