using Microsoft.AspNetCore.Components.WebView;
using Microsoft.Maui.Platform;
using BlazorPages.Tools;
namespace HybridApp
{

    public partial class MainPage : ContentPage
    {
        private string _deviceToken;
        public MainPage()
        {
            RequestCameraPermission();

            InitializeComponent();
            blazorWebView.BlazorWebViewInitialized += BlazorWebViewInitialized;
            if (Preferences.ContainsKey("DeviceToken"))
            {
                _deviceToken = Preferences.Get("DeviceToken", "");
                Statics.FcmToken = _deviceToken;
            }

        }

        private async Task RequestCameraPermission()
        {
            PermissionStatus status = await Permissions.CheckStatusAsync<Permissions.Camera>();

            if (status != PermissionStatus.Granted)
                await Permissions.RequestAsync<Permissions.Camera>();
        }
        private partial void BlazorWebViewInitialized(object? sender, BlazorWebViewInitializedEventArgs e);
    }
}
