opacclient icon indicating copy to clipboard operation
opacclient copied to clipboard

SISIS: covers are downloaded irrespective of preference settings

Open StefRe opened this issue 4 years ago • 2 comments

Download of cover images for SISIS (maybe for others too, didn't check it) is carried out in libopac (in parse_search and in loadDetail) without (of course) honoring the app's setting on_data_load_covers, i.e. cover images are downloaded even if on_data_load_covers is set to false and you're on mobile data. The reason seems to be that you must download the image as long as the session token has not yet expired. Or maybe this just emerged historically as the option was added much later (8ae23c8695) and it wasn't noticed at this point that the download may be performed by libopac itself.

StefRe avatar Nov 02 '20 17:11 StefRe

On the run, but as a quick data point: The reasoning was the session token back then, yes.

raphaelm avatar Nov 02 '20 17:11 raphaelm

Indeed, this is because of the session token. I think the only other API where this is needed is OPEN, where covers sometimes need to be accessed using a POST request. We also recently introduced this for covers in the account view, as it is needed by OPEN (https://github.com/opacapp/opacclient/commit/ca4b725c92de71dcc759a6c1a400d50a8ef21ad0).

Yes, we should respect the option in this case as well. Probably there should be an additional function defined in OpacApi (e.g. setCoverBitmapsEnabled) and implemented in BaseApi which the app then uses after constructing a new API instance. Then, this can be checked anywhere where setCoverBitmap or downloadCover are used, before trying to download the image.

johan12345 avatar Nov 02 '20 17:11 johan12345