Skip to content

Bunch of fixes and improvements related to SAF/FSAF, image loading etc#712

Merged
Adamantcheese merged 7 commits into
multi-featurefrom
saf-fsaf-bug-fixes
Feb 24, 2020
Merged

Bunch of fixes and improvements related to SAF/FSAF, image loading etc#712
Adamantcheese merged 7 commits into
multi-featurefrom
saf-fsaf-bug-fixes

Conversation

@K1rakishou

@K1rakishou K1rakishou commented Feb 23, 2020

Copy link
Copy Markdown

Closes #694, #687, #638, #579, #703
Maybe closes #696, #690, #560

  • Update FSAF to v1.0-alpha36. (Snapshots have been reworked, a bug related to snapshots has been fixed (now we shouldn't see bugs where files or directories cannot be created for some unknown reason),
    some changes to clone() methods, flattenSegments() implementation, get rid of cloneUnsafe() in Kuroba and some other changes).
  • Move handleLocalThreadFile() method call to a background thread to avoid micro freezes when swiping images in a local thread.
  • Do not download inlined files for local threads (inlined files now have isInlined flag set to true, it's false by default and only being set in one place - where we parse them).
  • Use new Snapshots in ThreadSaveManager.
  • Try to create default base directories, if they weren't set by the user and do not exist, when trying to download an image or an album.
  • A little bit of optimization for getSaveLocation(). First of all, it won't be called twice now. Second, it will return a flattened AbstractFile (no intermediate segments).
  • Fix MissingBackpressureException when downloading thread albums.
  • Fix app freezing (and depending on how many images in a thread even ANRing) when downloading thread albums. Because we need to check a lot of stuff before downloading an album (like create all the necessary directories, deduplicate the file name, etc).
  • Relax directory and file name filtering rules. Previous regex was really strict, so if an image contained any non-english letters, they would all be replaced with _ which is a big problem for
    non-english image boards (almost every image name would contain lots of _ symbols and it could even cause collisions). Now it only filters out special symbols and periods (only in directory names). Everything else is allowed.
  • Do not download inlined files when downloading thread albums. Some of the hosts are bad and cause SSL exceptions and other stuff. Also, inlined files may be really big and we can't check how big they are unless we download them first.
  • Fix bugs related to not being able to move files from an old base directory to a new one when both of them are using the same file provider (update FSAF to v1.0-alpha38)

- Update FSAF to v1.0-alpha36. (Snapshots have been reworked, a bug related to snapshots has been fixed (now we shouldn't see bugs where files or directories cannot be created for some unknown reason),
some changes to clone() methods, flattenSegments() implementation, get rid of cloneUnsafe() in Kuroba and some other changes).
- Move handleLocalThreadFile() method call to a background thread to avoid micro freezes when swiping images in a local thread or in a downloading thread.
- Do not download inlined files for local threads (inlined files now have isInlined flag set to true, it's false by default and only being set in one place - where we parse them).
- Use new Snapshots in ThreadSaveManager.
- Try to create default base directories, if they weren't set by the user and if they don't exist, when trying to download an image or an album.
- A little bit of optimization for getSaveLocation(). First of all it now won't be called twice. Second it will return a flattened AbstractFile (no intermediate segments).
- Fix MissingBackpressureException when downloading thread albums.
- Fix app freezing (and depending on how many images in a thread even ANRing) when downloading thread albums. Because we need to check a lot of stuff before downloading an image (like create all the necessary directories, deduplicate the file name, etc).
- Relax directory and file name filtering rules. Previous regex was really strict, so if an image contained any non-english letters, they all would be replaced with "_" which is a big problem for
non-english image boards (almost every image name would contain lots of "_" symbols and it could even cause collisions). Now it only filters out special symbols and periods (only in directory names). Everything else is allowed.
- Do not download inlined files when downloading thread albums. Some of the hosts are bad and cause SSL exceptions and other stuff. Also, inlined files may be really big and we can't check how big they are unless we download them first.
…ctory to a new one when both of them were using the same file provider (update FSAF to v1.0-alpha38)
@Adamantcheese

Copy link
Copy Markdown
Owner

This looks good and all, but what issues does this close? There's quite a few of them and it would be good to close them out when this gets merged.

@K1rakishou

Copy link
Copy Markdown
Author

Oh yeah, I forgot to link them.

@K1rakishou

Copy link
Copy Markdown
Author

Alright, I linked some issues that are related to this PR.

@K1rakishou

Copy link
Copy Markdown
Author

Wait, do not merge this one yet. I'm gonna change how we copy the apk that we download in UpdateManager to use SAF so we don't have those strange errors anymore.

@K1rakishou

Copy link
Copy Markdown
Author

Alright, it's ready.

@Adamantcheese

Copy link
Copy Markdown
Owner

Yeah I dunno about that last commit. Seems like it's gonna get super annoying for people on dev.

@K1rakishou

Copy link
Copy Markdown
Author

Well, probably. But at least it shouldn't crash anymore with this #703 message

@K1rakishou

Copy link
Copy Markdown
Author

It seems like this (https://stackoverflow.com/questions/42516126/fileprovider-illegalargumentexception-failed-to-find-configured-root) is the solution but since I can't reproduce it and I have no idea what's going on there I can't use it

@K1rakishou

Copy link
Copy Markdown
Author

And it seems like we are already doing the same thing. We have both cache-path and external-cache-path so I have no idea what it doesn't like.

@K1rakishou

K1rakishou commented Feb 24, 2020

Copy link
Copy Markdown
Author

I can revert the last commit if you have a better solution that does not involve SAF.

@Adamantcheese

Copy link
Copy Markdown
Owner

I think I'd be fine with a setting in Behvaiour -> Other that disabled the check, with the setting being "show the dialog" by default.

@K1rakishou

Copy link
Copy Markdown
Author

Alright.

…exiting immediately when called right after exiting the SAF file chooser
@Adamantcheese Adamantcheese merged commit 13878b2 into multi-feature Feb 24, 2020
@K1rakishou K1rakishou deleted the saf-fsaf-bug-fixes branch February 24, 2020 08:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants