#if ANDROID
using AndroidX.Activity;
using MauiBlazorPermissionsExample.Platforms.Android;
#endif
using Microsoft.AspNetCore.Components.WebView;
using Microsoft.Maui.Platform;
using System;
namespace HybridApp
{

    public partial class MainPage : ContentPage
    {

#if ANDROID

        private partial void BlazorWebViewInitialized(object? sender, BlazorWebViewInitializedEventArgs e)
        {
            if (e.WebView.Context?.GetActivity() is not ComponentActivity activity)
            {
                throw new InvalidOperationException($"The permission-managing WebChromeClient requires that the current activity be a '{nameof(ComponentActivity)}'.");
            }

            e.WebView.Settings.JavaScriptEnabled = true;
            e.WebView.SetWebChromeClient(new PermissionManagingBlazorWebChromeClient(e.WebView.WebChromeClient!, activity));                        
        }



#else
private partial void BlazorWebViewInitialized(object? sender, BlazorWebViewInitializedEventArgs e)
{

}
#endif
    }
}