Skip to content

Releases: KevinnZou/compose-webview-multiplatform

1.7.0

10 Nov 07:53
Compare
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
Compare
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
Compare
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
Compare
Choose a tag to compare

What's Changed

Full Changelog: 1.3.0...1.4.0

1.3.0

25 Sep 07:52
Compare
Choose a tag to compare

Starting from this version, we switched from JavaFX to the Java CEF Browser for better performance and user experience.
This is a breaking change, and we strongly recommend upgrading to this version as soon as possible.

Note: After switching to JCEF, developers need to configure it for the desktop app. Please see the README.desktop.md for more details.

What's Changed

New Contributors

Full Changelog: 1.2.0...1.3.0

1.2.0

21 Sep 09:45
0a9ea09
Compare
Choose a tag to compare

New Features

  1. Support Javascript Evaluation
  2. Support custom Web settings

What's Changed

Full Changelog: 1.1.0...1.2.0

1.1.0

19 Sep 07:50
Compare
Choose a tag to compare

Release Version 1.1.0. Fix package name issue and Android artifact issue.

1.0.0

13 Sep 12:43
Compare
Choose a tag to compare

Release stable version 1.0.0

0.4.0

13 Sep 01:27
Compare
Choose a tag to compare

Add support for Desktop with JavaFX WebView

0.2.0

08 Sep 08:25
Compare
Choose a tag to compare

Release version 0.2.0. Add load html support.