Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose several internal fields and add factory functions #182

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

coderforlife
Copy link

@coderforlife coderforlife commented Jun 22, 2024

This works to address #181.

Changes:

  • An expect/actual set of typealiases is made for each platform defining a NativeWebView as either android.webkit.WebView, WKWebView, or KCEFBrowser.
  • The webView field in each platform's IWebView is publicly exposed as a NativeWebView
  • WebViewState has a new field nativeWebView which publicly exposes this in the state without exposing anything else
  • Make onCreate and onDispose callbacks of WebView() composable take a NativeWebView argument
    • Minor backwards incompatibility is introduced with this if function references are passed as these callbacks instead of lambda/anonymous functions (which will automatically adapt to and ignore the added argument). Old code may need to place { } around the callback call to make it work again.
  • Add a factory function to the WebView() composable that allows the caller to specify how web view objects should be created.
    • Minor backwards incompatibility in that if there is any code that assumes the final argument of the WebView() composable is the onDispose callback and moved the lambda out of the paratheses will have to move it into the paratheses.

Both of the minor issues could be mitigated with creating a wrapper function that matches the old version. If you want this added, I can add it to the PR.

This adds a common webView field to the IWebView interface allowing multiplatform code to access the native web view. This native web view is exposed in the WebViewState.
@coderforlife coderforlife marked this pull request as ready for review June 24, 2024 15:47
@coderforlife
Copy link
Author

Please review this PR and hopefully create a new release! Thanks.

@KevinnZou KevinnZou self-assigned this Jun 25, 2024
@KevinnZou KevinnZou added the enhancement New feature or request label Jun 25, 2024
@KevinnZou
Copy link
Owner

@coderforlife Thanks for your contribution! I will review it this week and give you feedback! Thanks!

@KevinnZou
Copy link
Owner

Both of the minor issues could be mitigated with creating a wrapper function that matches the old version. If you want this added, I can add it to the PR.

@coderforlife Great jobs! Could you please add the wrapper function to match the old version? Thank you!

@coderforlife
Copy link
Author

Changes complete.

Copy link
Owner

@KevinnZou KevinnZou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great Jobs!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make native webView values public instead of private, add factory() functions
2 participants