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

Unresolved reference: mainFileCache #2806

Open
gusuly0rum opened this issue Oct 21, 2024 · 2 comments
Open

Unresolved reference: mainFileCache #2806

gusuly0rum opened this issue Oct 21, 2024 · 2 comments

Comments

@gusuly0rum
Copy link

Description

Updated Fresco version from 2.6.0 to 3.4.0.
Function ImagePipelineFactory.getMainFileCache() does not exist anymore in 3.4.0.

Reproduction

val imageRequest = ImageRequest.fromUri(url)

val cacheKey = DefaultCacheKeyFactory
    .getInstance()
    .getEncodedCacheKey(imageRequest, null)

val resource = ImagePipelineFactory
    .getInstance()
    .mainFileCache // Unresolved reference: mainFileCache
    .getResource(cacheKey)

val file = (resource as? FileBinaryResource?)?.file

Solution

How do I change the above code to work in 3.4.0?
It would be helpful if the function was marked as deprecated before completely removing it.

Additional Information

  • Fresco version: 3.4.0
  • Platform version: 33
@renanferrari
Copy link

It looks like this breaking change was introduced in 3.3.0 by bf42e89.

I couldn't find any documentation on the current recommended approach, but this seems to work:

val resource = ImagePipelineFactory
    .getInstance()
    .diskCachesStoreSupplier
    .get()
    .mainFileCache
    .getResource(cacheKey)

@gusuly0rum
Copy link
Author

It looks like this breaking change was introduced in 3.3.0 by bf42e89.

I couldn't find any documentation on the current recommended approach, but this seems to work:

val resource = ImagePipelineFactory
    .getInstance()
    .diskCachesStoreSupplier
    .get()
    .mainFileCache
    .getResource(cacheKey)

Thank you, will try this code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants