NativeScript / nativescript-fresco

This repository holds the NativeScript plugin that exposes the functionality of the Fresco image library to NativeScript developers.
Apache License 2.0
53 stars 23 forks source link

[Question]: It's possible to cache web images? #57

Closed ghost closed 6 years ago

ghost commented 6 years ago

I'm not sure if it's working for web images. On my app, I get a model that contains several images, for example:

{ "name": "John Doe", "gallery": [ // multiple urls ] ... }

But every time I open the application, the image loads again. If I load the application without connection, the images are not displayed. Is it something wrong that I'm doing or a possible issue of the plugin?

VladimirAmiorkov commented 6 years ago

Hi @hypertenso ,

The native Android Fresco library on which the nativescript-fresco plugin is based has this as a built-in functionality and it is enabled by default. You can check the example named "Cache" in the demo app in this repository which shows how to interact with the Fresco cache, check its status, reset it etc. please refer to this code.

Note that this built-in cache functionality of the used native Android Fresco library (0.9.0+) in the plugin is designed to be cleared automatically in the even if the phone requires more resources as it is cached in the memory. The newer Fresco library version show some signs of implementation of cache in the "disk" (local storage) of the phone but that is not available in the nativescript-fresco plugin due to it not being updated to the latest version. Here are some materials about cache in the Fresco library. If you feel that you can contribute to this feature of updating the nativescript-fresco plugin to work with the latest native Android Fresco library and providing additional cache functionality we are always welcoming PRs.

nsplugins commented 6 years ago

Closing due to inactivity.