using Android.App; using Android.Content.PM; using Android.OS; using cfs_tracker.Services; namespace cfs_tracker; [Activity( Theme = "@style/Maui.SplashTheme", MainLauncher = true, LaunchMode = LaunchMode.SingleTop, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation | ConfigChanges.UiMode | ConfigChanges.ScreenLayout | ConfigChanges.SmallestScreenSize | ConfigChanges.Density)] public class MainActivity : MauiAppCompatActivity { protected override void OnCreate(Bundle? savedInstanceState) { base.OnCreate(savedInstanceState); HandleNotificationIntent(Intent); } protected override void OnNewIntent(Android.Content.Intent? intent) { base.OnNewIntent(intent); if (intent is not null) HandleNotificationIntent(intent); } private static void HandleNotificationIntent(Android.Content.Intent? intent) { if (intent is null) return; var route = intent.GetStringExtra(Platforms.Android.AndroidNotificationScheduler.ExtraRoute); if (!string.Equals(route, "quickentry", StringComparison.OrdinalIgnoreCase)) return; var dateText = intent.GetStringExtra(Platforms.Android.AndroidNotificationScheduler.ExtraDate); var status = intent.GetStringExtra(Platforms.Android.AndroidNotificationScheduler.ExtraStatus); var commit = intent.GetBooleanExtra(Platforms.Android.AndroidNotificationScheduler.ExtraCommit, false); if (!DateTime.TryParse(dateText, out var date)) date = DateTime.Today; var services = IPlatformApplication.Current?.Services; var navigator = services?.GetService(typeof(NotificationNavigationService)) as NotificationNavigationService; if (navigator is null) return; navigator.QueueQuickEntry(date, status, commit); _ = navigator.FlushAsync(); } }