using Microsoft.Maui.Controls.PlatformConfiguration;
using RBLNews.Shared.Services;

namespace RBLNews.Maui
{
    public partial class App : Application
    {
        private readonly AppLifecycleService _appLifecycleService;

        public App(AppLifecycleService appLifecycleService)
        {
            _appLifecycleService = appLifecycleService;
            InitializeComponent();

            MainPage = new MainPage();
        }

        protected override Window CreateWindow(IActivationState activationState)
        {
            Window window = base.CreateWindow(activationState);
            window.Activated += (sender, eventArgs) =>
            {
                _appLifecycleService.Activated();

            };
            window.Resumed += (sender, eventArgs) =>
            {
                _appLifecycleService.Resumed();
                // take actions here...
            };
            
            return window;
        }
    }
}
