Package io.didomi.sdk.remote
Class RemoteFilesHelper
-
- All Implemented Interfaces:
-
io.didomi.sdk.remote.ConnectivityListener
public final class RemoteFilesHelper implements ConnectivityListener
Download, cache and manage remote files
-
-
Constructor Summary
Constructors Constructor Description RemoteFilesHelper(Context context, ConnectivityHelper connectivityHelper, HttpRequestHelper httpRequestHelper, CoroutineDispatcher coroutineDispatcher)
-
Method Summary
Modifier and Type Method Description final DidomigetDidomi()UnitonBackOnline()Method called once the device is back online. final FilegetCacheFileIfExists(String cacheFilePath, RemoteFile remoteFile)final LonggetRetryDelayOnError()final IntegergetMaxRetriesOnError()final UnitsetContentToCache(String cacheFilePath, RemoteFile remoteFile, String content)Update the local cache with content final StringgetContent(RemoteFile remoteFile)Get the file content from any source that has it final StringgetContentFromCache(String cacheFilePath, RemoteFile remoteFile)Get the file content from our local cache, if available final StringgetContentFromFallback(AssetManager assetManager, RemoteFile remoteFile)Get the file content from its local fall back (in the assets/ folder) if possible final StringgetContentFromRemoteFile(RemoteFile remoteFile, Long cacheDate)Get the content of the remote file final UnitrefreshCacheIfNeeded(String cacheFilePath, RemoteFile remoteFile)Refresh the cache if needed -
-
Constructor Detail
-
RemoteFilesHelper
RemoteFilesHelper(Context context, ConnectivityHelper connectivityHelper, HttpRequestHelper httpRequestHelper, CoroutineDispatcher coroutineDispatcher)
-
-
Method Detail
-
onBackOnline
Unit onBackOnline()
Method called once the device is back online.
-
getCacheFileIfExists
final File getCacheFileIfExists(String cacheFilePath, RemoteFile remoteFile)
-
getRetryDelayOnError
final Long getRetryDelayOnError()
-
getMaxRetriesOnError
final Integer getMaxRetriesOnError()
-
setContentToCache
final Unit setContentToCache(String cacheFilePath, RemoteFile remoteFile, String content)
Update the local cache with content
-
getContent
final String getContent(RemoteFile remoteFile)
Get the file content from any source that has it
-
getContentFromCache
final String getContentFromCache(String cacheFilePath, RemoteFile remoteFile)
Get the file content from our local cache, if available
-
getContentFromFallback
final String getContentFromFallback(AssetManager assetManager, RemoteFile remoteFile)
Get the file content from its local fall back (in the assets/ folder) if possible
-
getContentFromRemoteFile
final String getContentFromRemoteFile(RemoteFile remoteFile, Long cacheDate)
Get the content of the remote file
-
refreshCacheIfNeeded
final Unit refreshCacheIfNeeded(String cacheFilePath, RemoteFile remoteFile)
Refresh the cache if needed
-
-
-
-