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

[IMPROVEMENT] Introduce Storage Access Framework #172

Closed
K1rakishou opened this issue Jul 6, 2019 · 2 comments · Fixed by #292
Closed

[IMPROVEMENT] Introduce Storage Access Framework #172

K1rakishou opened this issue Jul 6, 2019 · 2 comments · Fixed by #292
Assignees
Labels
enhancement New feature or request

Comments

@K1rakishou
Copy link

K1rakishou commented Jul 6, 2019

So we can have the SD Card support and to prepare for the future Android R release where they introduce the Scoped Storage which will break everything for us. Also to refactor the file manipulation to use SAF. At least for saving threads/images/other files that take space.
Gonna implement it myself.

@K1rakishou K1rakishou changed the title [IMPROVEMENT] Introduce SAF [IMPROVEMENT] Introduce Storage Access Framework Jul 6, 2019
@Adamantcheese Adamantcheese added the enhancement New feature or request label Jul 9, 2019
@Adamantcheese
Copy link
Owner

You may want to look at this stale branch from Clover by the way, Floens was trying to do this a while ago. https://github.com/Floens/Clover/tree/external-storage-support

@K1rakishou
Copy link
Author

Thanks. I see there is a lot of code to handle SAF on both pre and post lollipop devices. Since we don't support pre lollipop devices we don't need that and it makes things a little bit easier. Btw, I already have SAF support for importing/exporting settings and file cache. What is left is thread saving, but it is not merged yet, and I guess that's it (Maybe I forgot something).

@Adamantcheese Adamantcheese added the wontfix This will not be worked on label Jul 15, 2019
@Adamantcheese Adamantcheese removed the wontfix This will not be worked on label Jul 18, 2019
@Adamantcheese Adamantcheese reopened this Jul 18, 2019
K1rakishou added a commit that referenced this issue Aug 10, 2019
K1rakishou added a commit that referenced this issue Aug 17, 2019
Now ExternalFiles uses DocumentFile().listFiles() to find a file inside a directory. It's implemented this way because, apparently, it's the only way to get a fully working DocumentFile that supports such operations as exists(), getName(), canRead()/canWrite(), delete() etc and which getParent() returns an actual file and not the null. This slow, but I don't know another way to do this so that everything works as expected.
K1rakishou added a commit that referenced this issue Aug 17, 2019
Add more tests for AbstractFile
K1rakishou added a commit that referenced this issue Aug 18, 2019
…a SAF)

Bring back SaveLocationController so that people can choose whether they want to use SAF or not (or in case of a bug)
K1rakishou added a commit that referenced this issue Aug 18, 2019
… sub directories (site name/board code/boar

AbstractFile.findFile() now returns a new AbstractFile instead of DocumentFile
Fix RawFile.createNew() which would create a file when it should create directory
Implement RawFile.findFile()
K1rakishou added a commit that referenced this issue Aug 18, 2019
Fix file/directory choosers would not remove the callback from the callback map when we have no activity to handle our intent. Also no message would have been shown in such case.
Give the use a choice when exporting settings whether he wants to open an existing settings file to overwrite it or create a new separate file.
K1rakishou added a commit that referenced this issue Aug 25, 2019
K1rakishou added a commit that referenced this issue Aug 25, 2019
K1rakishou added a commit that referenced this issue Aug 25, 2019
K1rakishou added a commit that referenced this issue Aug 25, 2019
Separate local threads download directory from the save location (app base dir) directory. Basically user can now choose separate directories where images or local threads will be stored (both work with SAF and the old API).
Make ThreadSaveManager work with AbstractFile instead of ExternalFile so that the user can decide for themselves whether to use SAF or the old API.
Local threads now work with AbstractFiles. Some classes had to be changed to use RawFile instead of simple File.
Convert couple of classes to Kotlin.
More tests for the testMethod.
K1rakishou added a commit that referenced this issue Aug 25, 2019
K1rakishou added a commit that referenced this issue Aug 25, 2019
K1rakishou added a commit that referenced this issue Aug 25, 2019
K1rakishou added a commit that referenced this issue Aug 25, 2019
K1rakishou added a commit that referenced this issue Aug 25, 2019
Fix Uri segments not being encoded when appended
K1rakishou added a commit that referenced this issue Aug 25, 2019
…it breaks the app and don't test anything useful)
K1rakishou added a commit that referenced this issue Aug 25, 2019
K1rakishou added a commit that referenced this issue Sep 3, 2019
…-framework

# Conflicts:
#	Kuroba/app/src/main/java/com/github/adamantcheese/chan/core/repository/ImportExportRepository.java
#	Kuroba/app/src/main/res/values/strings.xml
#	Kuroba/build.gradle
K1rakishou added a commit that referenced this issue Sep 3, 2019
…ectory to another

Basically, when a user want to change a local threads directory to another one (let's say they had it on sd-card and then bought another one and want to use it from now on). This is kinda working but it's fucking hacky and some parts of it are really slow.
Fixed a bug with save thread icon being set to the default state when it should be set to stopped state
K1rakishou added a commit that referenced this issue Oct 26, 2019
…lshit a little bit more gracefully, called Fuck Storage Access Framework

Fuck
Storage
Access
Framework
K1rakishou added a commit that referenced this issue Oct 26, 2019
…ped in the database when stopping it by clicking the "save thread" button
K1rakishou added a commit that referenced this issue Oct 26, 2019
Add ability to delete old base directory after moving files into the new one
Small fixes for thread album downloading where folder and file names would not be sanitized
K1rakishou added a commit that referenced this issue Oct 27, 2019
K1rakishou added a commit that referenced this issue Oct 27, 2019
…to (#172)-storage-access-framework

# Conflicts:
#	Kuroba/app/build.gradle
#	README.md
K1rakishou added a commit that referenced this issue Oct 27, 2019
K1rakishou added a commit that referenced this issue Oct 27, 2019
K1rakishou added a commit that referenced this issue Oct 27, 2019
…n the paths thus resulting in losing the sub directories

Fix shared_prefs importing/exporting for dev builds (wrong appId was used)
Extract MediaSettingsControllerCallbacks into it's own class to avoid compilation errors
K1rakishou added a commit that referenced this issue Oct 27, 2019
Additional active local threads checks before allowing the user to change base dir for local threads
Some strings that were forgotten about were moved to resources
K1rakishou added a commit that referenced this issue Oct 27, 2019
…tempts to export a directory path that is located in a directory using SAF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants