public class WebContentUtils
extends java.lang.Object
Constructor and Description |
---|
WebContentUtils() |
Modifier and Type | Method and Description |
---|---|
static java.io.File |
getHtmlInAppMessageAssetCacheDirectory(android.content.Context context)
Return the Braze html in-app message asset cache directory.
|
static java.lang.String |
getLocalHtmlUrlFromRemoteUrl(java.io.File localDirectory,
java.lang.String remoteZipUrl)
Takes a remote url pointing to zip file assets and then downloads them into a local directory.
|
static java.lang.String |
replacePrefetchedUrlsWithLocalAssets(java.lang.String originalString,
java.util.Map<java.lang.String,java.lang.String> remoteToLocalAssetMap)
In the original string, replaces all instances of the remote uri (
Map.Entry#getKey()
with the local uri Map.Entry#getValue() . |
public static java.lang.String getLocalHtmlUrlFromRemoteUrl(java.io.File localDirectory, java.lang.String remoteZipUrl)
The local content folder will be created one level under localDirectory and the assets from remoteZipUrl will be unzipped into that location. Finally, this method will return the local URL pointing to the assets using the "file://" protocol.
We clear the cache directory before any downloads in case orphaned in-app messages exist on the system.
In case of error, any files created will be deleted. This includes any files downloaded or unzipped.
localDirectory
- the directory where the assets will be downloadedremoteZipUrl
- the URL for the assets zippublic static java.io.File getHtmlInAppMessageAssetCacheDirectory(android.content.Context context)
See com.braze.triggers.managers.TriggerAssetManager
context
- public static java.lang.String replacePrefetchedUrlsWithLocalAssets(java.lang.String originalString, java.util.Map<java.lang.String,java.lang.String> remoteToLocalAssetMap)
Map.Entry#getKey()
with the local uri Map.Entry#getValue()
.
If the map is empty, then this method should return the same input string.