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

Replace open_file package with open_file_plus. #636

Merged
merged 3 commits into from
May 4, 2023

Conversation

Jonas-Sander
Copy link
Collaborator

@Jonas-Sander Jonas-Sander commented May 3, 2023

Fixes Android permission errors that come up on >= Android 11: Permission denied: android.Manifest.permission.MANAGE_EXTERNAL_STORAGE.

Note: I only tested this works on Android 11, not earlier versions.

Fixes Android permission errors that come up on >= Android 13: `Permission denied: android.Manifest.permission.MANAGE_EXTERNAL_STORAGE`.
@docs-page
Copy link

docs-page bot commented May 3, 2023

To view this pull requests documentation preview, visit the following URL:

docs.page/sharezoneapp/sharezone-app~636

Documentation is deployed and generated using docs.page.

@github-actions github-actions bot added dependencies Changing, updating, adding or removing one or more dependencies. feature: file-sharing Files can be shared inside Sharezone e.g. by uploading them in a file-sharing folder of a course. feature: universal file features File features (downloading, preview, etc.) that are used by multiple Sharezone features. ui / ux labels May 3, 2023
@github-actions
Copy link

github-actions bot commented May 3, 2023

Visit the preview URL for this PR (updated for commit 8333b03):

https://sharezone-test--pr636-replace-open-file-wi-tcze195v.web.app

(expires Wed, 10 May 2023 16:46:44 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: 4cb3ae61e1e018abfd9841fd3239f5b49ccc034b

@Jonas-Sander
Copy link
Collaborator Author

Jonas-Sander commented May 3, 2023

Right now when trying to open files on Android with an extension in uppercase (e.g. Warning.PNG) the following error will come up: open file result: the /data/user/0/de.codingbrain.sharezone.dev/cache/libCachedImageData/Warning.png file does not exists.

If _getFilePathWithLowerCaseExtension is removed it works, but idk if this would break clients below Android 11. For now I'll not change the behavior in this PR.

if (PlatformCheck.isIOS) {
OpenFile.open(future.data.getPath());
} else {
OpenFile.open(
_getFilePathWithLowerCaseExtension(future.data.getPath()))
.then((result) => log('open file result: ${result.message}'));
}

@Jonas-Sander
Copy link
Collaborator Author

Hm idk why the file diffs look so weird, did the line endings change because I'm on Windows maybe? But I made several PRs from Windows and this hasn't happend before 🤔

@Jonas-Sander
Copy link
Collaborator Author

Hm idk why the file diffs look so weird, did the line endings change because I'm on Windows maybe? But I made several PRs from Windows and this hasn't happend before 🤔

Hm, fixed it now by running git config --global core.autocrlf true and git add --renormalize [file_path] for the affected files.

@Jonas-Sander
Copy link
Collaborator Author

Jonas-Sander commented May 3, 2023

Right now when trying to open files on Android with an extension in uppercase (e.g. Warning.PNG) the following error will come up: open file result: the /data/user/0/de.codingbrain.sharezone.dev/cache/libCachedImageData/Warning.png file does not exists.

If _getFilePathWithLowerCaseExtension is removed it works, but idk if this would break clients below Android 11. For now I'll not change the behavior in this PR.

if (PlatformCheck.isIOS) {
OpenFile.open(future.data.getPath());
} else {
OpenFile.open(
_getFilePathWithLowerCaseExtension(future.data.getPath()))
.then((result) => log('open file result: ${result.message}'));
}

Idk if I'll get to it atm, could I pass this task to you @nilsreichardt ? (In another PR though)

@nilsreichardt
Copy link
Member

_getFilePathWithLowerCaseExtension

Yes, I'm opened #637

Copy link
Member

@nilsreichardt nilsreichardt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

I have successfully tested it with Android 13 and macOS. On Android 5 (I used an emulator) it opened the app to view the file on the phone. However, this app couldn't the image. Not sure if this an issue caused by the package or just an issue with the Android emulator. I would just merge it for now 👍

@Jonas-Sander Jonas-Sander added this pull request to the merge queue May 4, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks May 4, 2023
@nilsreichardt nilsreichardt added this pull request to the merge queue May 4, 2023
Merged via the queue into main with commit d91cdbc May 4, 2023
@nilsreichardt nilsreichardt deleted the replace-open-file-with-open-file-plus branch May 4, 2023 07:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Changing, updating, adding or removing one or more dependencies. feature: file-sharing Files can be shared inside Sharezone e.g. by uploading them in a file-sharing folder of a course. feature: universal file features File features (downloading, preview, etc.) that are used by multiple Sharezone features. ui / ux
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants