Fix aos storage permission not be requested when api above 33 #168
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
refer to: Baseflow/flutter-permission-handler#888 (comment)
Android API level 33 introduced a new storage permission policy: Granular media permissions.
That means the
READ_EXTERNAL_STORAGE
can not be directly requested when api version >= 33.We should request one of READ_MEDIA_IMAGES, READ_MEDIA_VIDEO, and READ_MEDIA_AUDIO for accessing the app-scoped storage.
In this case, since the
permission_handler: 10.2.0
still not implement this change yet, we should request the following permissions by ourselves:So we refactored the permission utility to this state in this PR.
Also, we've changed some UI color of
file_viewer_page
, which makes them looks more close to the design of Material 3.And with some null-safety migration refactors. (We have no time to separate them into different PR 😢)
How to Verify?
For verifying this change, you should prepare at least two aos devices. One is API 33 or above, the other is API 32 or below.
In all devices,
no permission
shown.Download success
dialog after some time.create folder
andrename file
are "OK".Screenshots/GIF/Test Results (Optional)