WebContentUtils

Properties

Link copied to clipboard

A dummy domain used by the AssetLoader for local items. Instead of "file:///", Braze will have the HTML reference this domain for local files. InAppMessageHtmlBaseView.setWebViewContent and InAppMessageWebViewClient.assetLoader should both use this value. Do not use your own value since it is used internally by Braze for HTML In-App messages with a zip file.

Link copied to clipboard

Functions

Link copied to clipboard
fun getHtmlInAppMessageAssetCacheDirectory(context: <Error class: unknown class>): File

Return the Braze html in-app message asset cache directory. This cache directory stores assets for html in-app messages that are not pre-fetched into the files directory.

Link copied to clipboard
fun getLocalHtmlUrlFromRemoteUrl(localDirectory: File, remoteZipUrl: String): String?

Takes a remote url pointing to zip file assets and then downloads them into a local directory.

Link copied to clipboard
fun replacePrefetchedUrlsWithLocalAssets(originalString: String, remoteToLocalAssetMap: Map<String, String>): String

In the original string, replaces all instances of the remote uri (Map.Entry.getKey with the local uri Map.Entry.getValue.

Link copied to clipboard
fun unpackZipIntoDirectory(unpackDirectory: String, zipFile: File): Boolean

Takes a zip file and unzips it into a destination directory. Creates the destination directory if not already present.

Link copied to clipboard
fun validateChildFileExistsUnderParent(intendedParentDirectory: String, childFilePath: String): String

Validates that the provided filename's canonical path exists under the intended directory. Throws IllegalStateException if not.