using System;
using Pixiview.UI;
using Pixiview.Utils;

namespace Pixiview.Login
{
    public partial class LoginPage : AdaptedPage
    {
        private readonly Action action;

        public LoginPage(Action after)
        {
            InitializeComponent();
            webView.UserAgent = Configs.UserAgent;

            BindingContext = this;
            action = after;
        }

        private async void Button_Clicked(object sender, EventArgs e)
        {
            await Navigation.PopModalAsync();
        }

        private async void WebView_LoginHandle(object sender, EventArgs e)
        {
            await Navigation.PopModalAsync();
            action?.Invoke();
        }
    }
}
