Skip to content

Releases: KevinnZou/compose-webview-multiplatform

1.8.2

08 Jan 02:41

Choose a tag to compare

What's Changed

Full Changelog: 1.8.0...1.8.2

1.8.0

27 Dec 13:24

Choose a tag to compare

New Features

  • JsBridge: Starting from version 1.8.0, this library provides a WebViewJsBridge to allow developers to communicate between the WebView and Native. Developers can use the JsBridge to register a handler to handle the message from the WebView.

Please refer to https://github.com/KevinnZou/compose-webview-multiplatform?tab=readme-ov-file#communication-between-webview-and-native for detailed instructions.

What's Changed

Full Changelog: 1.7.8...1.8.0

1.7.8

15 Dec 12:19

Choose a tag to compare

What's Changed

  • bugfix:Fix navigator.loadHtml error by @KevinnZou in #63
  • feat:Android WebView setLayerType LAYER_TYPE_SOFTWARE by @KevinnZou in #65
  • feat:Workaround for navigator not working on the Desktop issue. by @KevinnZou in #67

Full Changelog: 1.7.6...1.7.8

1.7.6

07 Dec 11:55

Choose a tag to compare

New Features

  • Support setting zoom level
state.webSettings.apply {
    zoomLevel = 2.0
}

What's Changed

Full Changelog: 1.7.4...1.7.6

1.7.4

25 Nov 00:12

Choose a tag to compare

What's Changed

Full Changelog: 1.7.2...1.7.4

1.7.2

16 Nov 01:50

Choose a tag to compare

Breaking Changes

If you are a developer upgrading from a version lower than 1.7.0 to 1.7.*, please refer to the release note for version 1.7.0 here for upgrade instructions.

New Features

  • Support file access from the file Urls. You can config it in WebSettings like this:
webViewState.webSettings.apply {
    isJavaScriptEnabled = true
    allowFileAccessFromFileURLs = true
    allowUniversalAccessFromFileURLs = true
    androidWebSettings.apply {
        allowFileAccess = true
    }
}

What's Changed

Full Changelog: 1.7.0...1.7.2

1.7.0

10 Nov 07:53

Choose a tag to compare

Breaking Changes

Starting from version 1.7.0, we switched from Java CEF Browser to Kotlin CEF Browser for more features and better performance.

After switching to KCEF, developers need to configure it for the desktop app.

  • For new users, just follow this instruction to config the KCEF.
  • For developers that upgrade from a lower version, you have to delete the origin jcef-bundle and update the initialization configuration from CEF to KCEF like below:
LaunchedEffect(Unit) {
    withContext(Dispatchers.IO) {
        KCEF.init(builder = {
            installDir(File("kcef-bundle"))
            settings {
                cachePath = File("cache").absolutePath
            }
        }, onError = {
            it?.printStackTrace()
        }, onRestartRequired = {
        })
    }
}
DisposableEffect(Unit) {
    onDispose {
        KCEF.disposeBlocking()
    }
}

Jogamp's Maven is also required for KCEF:

repositories {
    maven("https://jogamp.org/deployment/maven")
}

Please see the README.desktop.md for more details.

New Features

  • Upgrade to Compose 1.5.10 and Kotlin 1.9.20
  • Support CookieManager for Desktop
  • Support custom headers for iOS

What's Changed

Full Changelog: 1.6.0...1.7.0

1.6.0

25 Oct 10:33

Choose a tag to compare

New Features

  • Local HTML file load support
/**
 * Creates a WebView state for HTML file loading that is remembered across Compositions.
 *
 * @param fileName The file to load in the WebView
 * Please note that the file should be placed in the commonMain/resources/assets folder.
 * The fileName just need to be the relative path to the assets folder.
 */
@Composable
fun rememberWebViewStateWithHTMLFile(
    fileName: String,
): WebViewState =
    remember {
        WebViewState(WebContent.File(fileName))
    }.apply {
        this.content = WebContent.File(fileName)
    }

Please refer to https://github.com/KevinnZou/compose-webview-multiplatform/blob/main/sample/shared/src/commonMain/kotlin/com/kevinnzou/sample/HtmlWebViewSample.kt for detail example.

  • Log Severity Support
  webViewState.webSettings.apply {
      isJavaScriptEnabled = true
      logSeverity = KLogSeverity.Debug
  }

By default, logSeverity is set to Info in order to suppress test logs from being printed. If you wish to view them, you can change it to Debug in webSettings.

What's Changed

Full Changelog: 1.5.0...1.6.0

1.5.0

12 Oct 08:56

Choose a tag to compare

New Features

  • Cookie Management.
interface CookieManager {

    /**
     * Sets a cookie for the given url.
     * @param url The url for which the cookie is to be set.
     * @param cookie The cookie to be set.
     * */
    suspend fun setCookie(url: String, cookie: Cookie)

    /**
     * Gets all the cookies for the given url.
     * @param url The url for which the cookies are to be retrieved.
     *
     * @return A list of cookies for the given url.
     * */
    suspend fun getCookies(url: String): List<Cookie>

    /**
     * Removes all the cookies.
     * */
    suspend fun removeAllCookies()

    /**
     * Removes all the cookies for the given url.
     * @param url The url for which the cookies are to be removed.
     * */
    suspend fun removeCookies(url: String)
}

Due to some issues with JCEF, we have decided to support Android and iOS platforms at first. Once the KCEF testing is stable, we will switch to it and also support cookies on the Desktop platform.

What's Changed

Full Changelog: 1.4.0...1.5.0

1.4.0

09 Oct 07:28

Choose a tag to compare

What's Changed

Full Changelog: 1.3.0...1.4.0