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

Image Preloading. #495

Closed
wants to merge 54 commits into from
Closed

Image Preloading. #495

wants to merge 54 commits into from

Conversation

CTLalit
Copy link
Collaborator

@CTLalit CTLalit commented Oct 27, 2023

https://wizrocket.atlassian.net/browse/SDK-3362

Plan:

  • Extract out cache classes to be used where needed in code
  • Extract network calls for bitmap download/caching across inapps module
  • Plug in new caches to inapps code
  • integrate new inapps code along with caches from here, this feature can be plugged

- moved it in different file
- created kotlin class for cache
- converted legacy gif and image cache in kotlin
- CtCaches holds all the caches for in-apps feature for CT
- Minor refactoring
- changed Ct caches signature to not have concrete class ref
- passing logger is optional
- added code to save data in files, as a bytearray stream
- properly to lru cache
- exposed caches for disk and made 2 entries for image and gif
- moved to comp object
- func to fetch and cache image.
- caching is handled internally.
- the inheritance is correctly used
- also changed interface signature to non nullable
- we did not need val.
- props are better immutable as not changed.
- added func to save byte array in response
- we changed logic to get in byte[] data and then make bitmap out of it.
- we will return both byte[] and bitmap so that we can cache data as well.
- we need the byte array for caching in the file.
- we wil reuse code for bitmap download in app.
- it not also contains the byte array of data
- this will help us in saving to cache
- fetch method for network
- cached method for checking from cache
- InAppImageProvider.kt is intented to use to fetch any image needed for inapps feature.
- utils class comp errors removed
- java-kt default argument issue
- fetch image functionality
- provides bitmap/byte data as needed
- made method inline to get generic type
- added functionality to fetch and save gif in cache
- the gif cache is configured similar to inapps image cache
- extracted code for api call
- exposed method to take list of urls as args
- we cannot enforce priority, we will need to support those changes
- passed dispatcher provider as dependency
- added read timeout
- added connection timeout
- we have reused bitmap download code which is used in Push templates
- checked in cached file has a valid bitmap.
- delete image and gif methods added
- In app image provider renamed
- used resource provider to fetch the image and gif and removed previous image cache code.
- fixed the cache directory names
- used to cache and also for deleting resources
- safe refactor to extract variables
- we need to handle null key as LRU cache will internally throw exception
- we used media provider for inapps module to fetch cached image and gif data
- there was compilation prob
- fixed as i passed argument
- deleted legacy cache classes
- assigned bytes to bitmap response
- we missed assigning to DownloadedBitmap class
- we correctly initialised the manager
- we did not have config to get logger which was causing a crash pre commit.
- created hashing method which can be passed on to file cache, this is needed to cache url to unique key
- separated uuid/hash generation logic for url key in cache.
- added test to verify file cache
This was referenced Nov 7, 2023
@CTLalit CTLalit closed this Nov 16, 2023
@CTLalit CTLalit deleted the lp/in_app_caching branch February 5, 2024 12:42
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

Successfully merging this pull request may close these issues.

1 participant