Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix aos storage permission not be requested when api above 33 #168

Merged
merged 5 commits into from
Feb 16, 2023

Conversation

Xanonymous-GitHub
Copy link
Member

@Xanonymous-GitHub Xanonymous-GitHub commented Feb 15, 2023

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:

  Permission.videos, // READ_MEDIA_IMAGES & READ_MEDIA_VIDEO
  Permission.audio, // READ_MEDIA_AUDIO

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,

  1. clean install this App, ensure the permission of this App are all still not be granted yet.
  2. launch app, login, and move to the Download page.
  3. check if a dialog (or two) jumped out, which is trying to ask about the allowance of storage permission. please make sure the requested permission should be different depends on your device's API level. You should make sure that the requesting permissions are all correct, as we mentioned above.
  4. After permission is granted, move to the download page again (leave and go back), check if there's not any permission dialog jumped out again, or any Toast which tells about no permission shown.
  5. Move course table page and find a course which has some i-school file published. Download one of them, and make sure you can see the Download success dialog after some time.
  6. Go back to the file page, check if the file you just downloaded is shown, and click on it to check if it can be opened.
  7. See the UI style, especially the color of the page's bar, and the button's color of create folder and rename file are "OK".

Screenshots/GIF/Test Results (Optional)

@Xanonymous-GitHub Xanonymous-GitHub added type: bug Something isn't working alpha-test labels Feb 15, 2023
@Xanonymous-GitHub Xanonymous-GitHub added this to the 1.4.3 milestone Feb 15, 2023
@Xanonymous-GitHub Xanonymous-GitHub self-assigned this Feb 15, 2023
@Xanonymous-GitHub Xanonymous-GitHub changed the title Fix aos storage permission not requested Fix aos storage permission not be requested Feb 15, 2023
@Xanonymous-GitHub Xanonymous-GitHub changed the title Fix aos storage permission not be requested Fix aos storage permission not be requested when api above 33 Feb 15, 2023
@Xanonymous-GitHub Xanonymous-GitHub merged commit 510d499 into master Feb 16, 2023
@Xanonymous-GitHub Xanonymous-GitHub deleted the fix-aos-storage-permission-not-requested branch February 16, 2023 17:17
Xanonymous-GitHub added a commit that referenced this pull request Mar 28, 2023
* chore: add image/video, music/audio permission into android manifest

* feat: seperate permission request content by aos api 33

* chore: add device into package

* refactor: migrate file page to null safety, with pieces of UI improvements such as color

* refactor: null-safety migrations
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
alpha-test type: bug Something isn't working
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

External storage permission of AOS could not be requested now.
1 participant