Skip to content

Commit

Permalink
@android.webkit.JavascriptInterface is missing!
Browse files Browse the repository at this point in the history
By changing `HybridJavaScriptInterface` to a class, the JCW now says:

    @android.webkit.JavascriptInterface
    public void sendMessage (java.lang.String p0)
  • Loading branch information
jonathanpeppers committed Sep 30, 2024
1 parent 35cf769 commit 0820530
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import androidx.annotation.NonNull;

public interface HybridJavaScriptInterface {
void sendMessage(@NonNull String message);
public abstract class HybridJavaScriptInterface {
@android.webkit.JavascriptInterface
public abstract void sendMessage(@NonNull String message);
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ protected override AWebView CreatePlatformView()
return platformView;
}

private sealed class HybridWebViewJavaScriptInterface : Java.Lang.Object, IHybridJavaScriptInterface
private sealed class HybridWebViewJavaScriptInterface : HybridJavaScriptInterface
{
private readonly WeakReference<HybridWebViewHandler> _hybridWebViewHandler;

Expand All @@ -47,7 +47,7 @@ public HybridWebViewJavaScriptInterface(HybridWebViewHandler hybridWebViewHandle
private HybridWebViewHandler? Handler => _hybridWebViewHandler is not null && _hybridWebViewHandler.TryGetTarget(out var h) ? h : null;

[JavascriptInterface]
public void SendMessage(string message)
public override void SendMessage(string message)
{
Handler?.MessageReceived(message);
}
Expand Down
Binary file modified src/Core/src/maui.aar
Binary file not shown.

0 comments on commit 0820530

Please sign in to comment.