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

[HybridWebView] fix trimmer warnings on Android #24744

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.microsoft.maui;

import androidx.annotation.NonNull;

public interface HybridJavaScriptInterface {
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
private sealed class HybridWebViewJavaScriptInterface : Java.Lang.Object, IHybridJavaScriptInterface
{
private readonly WeakReference<HybridWebViewHandler> _hybridWebViewHandler;

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

[JavascriptInterface]
[Export("sendMessage")]
public void SendMessage(string message)
{
Handler?.VirtualView?.MessageReceived(message);
Expand Down
6 changes: 4 additions & 2 deletions src/Core/src/Transforms/Metadata.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@
<!-- Normalize the namespace for .NET -->
<attr path="//package[@name='com.microsoft.maui']" name="managedName">Microsoft.Maui</attr>

<!-- Make all classes internal by default -->
<!-- Make all types internal by default -->
<attr path="//class[@visibility='public']" name="visibility">internal</attr>
<!-- Public classes -->
<attr path="//interface[@visibility='public']" name="visibility">internal</attr>
<!-- Public types -->
<attr path="//class[@name='PlatformAppCompatTextView']" name="visibility">public</attr>
<attr path="//class[@name='PlatformContentViewGroup']" name="visibility">public</attr>
<attr path="//class[@name='PlatformWrapperView']" name="visibility">public</attr>
<attr path="//class[@name='MauiViewGroup']" name="visibility">public</attr>
<attr path="//interface[@name='ImageLoaderCallback']" name="visibility">public</attr>
<!-- Internal methods & constructors -->
<attr path="//class[@name='PlatformAppCompatTextView']/method" name="visibility">internal</attr>
<attr path="//class[@name='PlatformAppCompatTextView']/constructor" name="visibility">internal</attr>
Expand Down
Binary file modified src/Core/src/maui.aar
Binary file not shown.
Loading