Ejemplo n.º 1
0
        public async void Run(IBackgroundTaskInstance taskInstance)
        {
            var details = taskInstance.TriggerDetails as ToastNotificationActionTriggerDetail;

            if (details != null)
            {
                string arguments = details.Argument;

                var args = arguments.Split(';');

                if (args[0] == MarkReadAction)
                {
                    try
                    {
                        ResourceLocator.RegisterAppDataServiceAdapter(new ApplicationDataServiceService());
                        ResourceLocator.RegisterPasswordVaultAdapter(new PasswordVaultProvider());
                        ResourceLocator.RegisterMessageDialogAdapter(new MessageDialogProvider());
                        Credentials.Init();
                    }
                    catch (Exception)
                    {
                        //we may be already up and running, pure voodoo
                    }
                    var deff = taskInstance.GetDeferral();
                    await MalNotificationsQuery.MarkNotifiactionsAsRead(new MalNotification(args[1]));

                    deff.Complete();
                }
            }
        }
Ejemplo n.º 2
0
        private void ProcessLaunchArgs(string args, bool startup)
        {
            if (!string.IsNullOrWhiteSpace(args))
            {
                Tuple <int, string>       navArgs     = null;
                Tuple <PageIndex, object> fullNavArgs = null;
                if (args.Contains('~')) //from notification -> mark read
                {
                    var arg = args;
                    var pos = arg.IndexOf('~');
                    if (pos != -1)
                    {
                        var id = arg.Substring(0, pos);
                        arg = arg.Substring(pos + 1);
                        MalNotificationsQuery.MarkNotifiactionsAsRead(new MalNotification(id));
                        fullNavArgs = MalLinkParser.GetNavigationParametersForUrl(arg);
                    }
                    else
                    {
                        fullNavArgs = MalLinkParser.GetNavigationParametersForUrl(arg);
                    }
                }
                else if (Regex.IsMatch(args, @"[OpenUrl,OpenDetails];.*"))
                {
                    var options = args.Split(';');
                    if (args.Contains('|')) //legacy
                    {
                        var detailArgs = options[1].Split('|');
                        navArgs = new Tuple <int, string>(int.Parse(detailArgs[0]), detailArgs[1]);
                    }
                    else
                    {
                        fullNavArgs = MalLinkParser.GetNavigationParametersForUrl(options[1]);
                    }
                }
                else
                {
                    fullNavArgs = MalLinkParser.GetNavigationParametersForUrl(args);
                }

                if (startup)
                {
                    MainViewModelBase.InitDetailsFull = fullNavArgs;
                    MainViewModelBase.InitDetails     = navArgs;
                }
                else
                {
                    if (navArgs != null)
                    {
                        ViewModelLocator.GeneralMain.Navigate(PageIndex.PageAnimeDetails,
                                                              new AnimeDetailsPageNavigationArgs(navArgs.Item1, navArgs.Item2, null, null));
                    }
                    if (fullNavArgs != null)
                    {
                        ViewModelLocator.GeneralMain.Navigate(fullNavArgs.Item1, fullNavArgs.Item2);
                    }
                }
            }
        }
        public async void Init(bool force = false)
        {
            if (AllNotifications == null || force)
            {
                Loading          = true;
                AllNotifications = await MalNotificationsQuery.GetNotifications();

                CurrentNotificationType = null;
                Loading = false;
            }
        }
Ejemplo n.º 4
0
        public override async void OnReceive(Context context, Intent intent)
        {
            var details = intent.Extras?.GetString(NotificationReadKey, null);

            if (details != null)
            {
                try
                {
                    ResourceLocator.RegisterAppDataServiceAdapter(new ApplicationDataServiceService());
                    ResourceLocator.RegisterPasswordVaultAdapter(new PasswordVaultProvider());
                    ResourceLocator.RegisterMessageDialogAdapter(new MessageDialogProvider());
                    Credentials.Init();
                }
                catch (Exception)
                {
                    //we may be already up and running, pure voodoo
                }

                var notificationManager = (NotificationManager)context.GetSystemService(Context.NotificationService);
                notificationManager.Cancel(details.GetHashCode());

                await MalNotificationsQuery.MarkNotifiactionsAsRead(new MalNotification(details));
            }
        }
        public async void Run(IBackgroundTaskInstance taskInstance)
        {
            Defferal = taskInstance?.GetDeferral();

            //var details = taskInstance.TriggerDetails as ToastNotificationActionTriggerDetail;
            //if (details != null)
            //{
            //    await Launcher.LaunchUriAsync(new Uri(details.Argument));
            //    Defferal.Complete();
            //    return;
            //}

            try
            {
                if (taskInstance != null) //we are already running -> started on demand
                {
                    ResourceLocator.RegisterBase();
                    ResourceLocator.RegisterAppDataServiceAdapter(new ApplicationDataServiceService());
                    ResourceLocator.RegisterPasswordVaultAdapter(new PasswordVaultProvider());
                    ResourceLocator.RegisterMessageDialogAdapter(new MessageDialogProvider());
                    ResourceLocator.RegisterHttpContextAdapter(new MalHttpContextProvider());
                    ResourceLocator.RegisterDataCacheAdapter(new Adapters.DataCache(null));
                    Credentials.Init();
                }
            }
            catch (Exception)
            {
                //app is running so we don't check, checks are conducted in runtime manually
                //Defferal?.Complete();
                //return;
            }


            List <MalNotification> notifications = new List <MalNotification>();

            try
            {
                if (
                    Settings.EnabledNotificationTypes.HasFlag(MalNotificationsTypes.FriendRequestAcceptDeny) ||
                    Settings.EnabledNotificationTypes.HasFlag(MalNotificationsTypes.NewRelatedAnime) ||
                    Settings.EnabledNotificationTypes.HasFlag(MalNotificationsTypes.BlogComment) ||
                    Settings.EnabledNotificationTypes.HasFlag(MalNotificationsTypes.ClubMessages) ||
                    Settings.EnabledNotificationTypes.HasFlag(MalNotificationsTypes.ForumQuoute) ||
                    Settings.EnabledNotificationTypes.HasFlag(MalNotificationsTypes.FriendRequest) ||
                    Settings.EnabledNotificationTypes.HasFlag(MalNotificationsTypes.NowAiring) ||
                    Settings.EnabledNotificationTypes.HasFlag(MalNotificationsTypes.ProfileComment) ||
                    Settings.EnabledNotificationTypes.HasFlag(MalNotificationsTypes.Payment) ||
                    Settings.EnabledNotificationTypes.HasFlag(MalNotificationsTypes.UserMentions) ||
                    Settings.EnabledNotificationTypes.HasFlag(MalNotificationsTypes.WatchedTopics))
                {
                    notifications.AddRange(await MalNotificationsQuery.GetNotifications());
                    notifications =
                        notifications.Where(
                            notification =>
                            !notification.IsRead &&
                            (Settings.EnabledNotificationTypes & notification.Type) == notification.Type).ToList();
                }
            }
            catch (Exception)
            {
                //http exec error
            }


            if ((Settings.EnabledNotificationTypes & MalNotificationsTypes.Messages) == MalNotificationsTypes.Messages)
            {
                try
                {
                    var msgs = await AccountMessagesManager.GetMessagesAsync(1);

                    foreach (var malMessageModel in msgs)
                    {
                        if (!malMessageModel.IsRead)
                        {
                            notifications.Add(new MalNotification(malMessageModel)); //I'm assuming that Ids are unique
                        }
                    }
                }
                catch (Exception)
                {
                    //no messages
                }
            }

            bool watchedTopicsUpdated = false;

            foreach (var watchedTopic in ResourceLocator.HandyDataStorage.WatchedTopics.StoredItems)
            {
                if (!watchedTopic.OnCooldown)
                {
                    var count = await new ForumTopicMessageCountQuery(watchedTopic.Id).GetMessageCount(true);
                    if (count == null)
                    {
                        continue;
                    }

                    if (count > watchedTopic.LastCheckedReplyCount)
                    {
                        var notif = new MalNotification(watchedTopic);
                        var diff  = count - watchedTopic.LastCheckedReplyCount;
                        if (diff == 1)
                        {
                            notif.Content += " There is one new reply.";
                        }
                        else
                        {
                            notif.Content += $" There are {diff} new replies.";
                        }

                        notifications.Add(notif);

                        watchedTopic.OnCooldown            = true;
                        watchedTopic.LastCheckedReplyCount = count.Value;
                        watchedTopicsUpdated = true;
                    }
                }
            }
            if (watchedTopicsUpdated)
            {
                ResourceLocator.HandyDataStorage.WatchedTopics.SaveData();
            }

            if (!notifications.Any())
            {
                Defferal?.Complete();
                return;
            }

            var allTriggeredNotifications = (string)(ApplicationData.Current.LocalSettings.Values[nameof(RoamingDataTypes.ReadNotifications)] ?? string.Empty);
            var triggeredNotifications    = allTriggeredNotifications.Split(';').ToList();
            var triggeredAny = false;

            //trigger new notifications
            foreach (var notification in notifications)
            {
                if (triggeredNotifications.Contains(notification.Id))
                {
                    continue;
                }

                triggeredNotifications.Add(notification.Id);
                triggeredAny = true;
                ScheduleToast(notification);
            }
            //remove old triggered entries
            var presentNotifications = new List <string>();

            foreach (var triggeredNotification in triggeredNotifications)
            {
                if (notifications.Any(notif => notif.Id == triggeredNotification))
                {
                    presentNotifications.Add(triggeredNotification);
                }
            }

            ApplicationData.Current.LocalSettings.Values[nameof(RoamingDataTypes.ReadNotifications)] = string.Join(";", presentNotifications);

            if (!triggeredAny)
            {
                Defferal?.Complete();
            }
        }
Ejemplo n.º 6
0
        protected async void OnLaunchedOrActivated(IActivatedEventArgs e)
        {
            ApplicationView.GetForCurrentView().SetPreferredMinSize(new Size(500, 500));
            var rootFrame = Window.Current.Content as Frame;
            Tuple <int, string>       navArgs     = null;
            Tuple <PageIndex, object> fullNavArgs = null;
            var launchArgs = e as LaunchActivatedEventArgs;

            if (!string.IsNullOrWhiteSpace(launchArgs?.Arguments))
            {
                if (Regex.IsMatch(launchArgs.Arguments, @"[OpenUrl,OpenDetails];.*"))
                {
                    var options = launchArgs.Arguments.Split(';');
                    if (options[0] == TileActions.OpenUrl.ToString())
                    {
                        LaunchUri(options[1]);
                    }
                    else if (launchArgs.Arguments.Contains('|')) //legacy
                    {
                        var detailArgs = options[1].Split('|');
                        navArgs = new Tuple <int, string>(int.Parse(detailArgs[0]), detailArgs[1]);
                    }
                    else
                    {
                        fullNavArgs = MalLinkParser.GetNavigationParametersForUrl(options[1]);
                    }
                }
                else
                {
                    fullNavArgs = MalLinkParser.GetNavigationParametersForUrl(launchArgs.Arguments);
                }
            }
            else if (e is ProtocolActivatedEventArgs)
            {
                fullNavArgs = MalLinkParser.GetNavigationParametersForUrl("https:" + (e as ProtocolActivatedEventArgs).Uri.AbsolutePath);
            }
            else
            {
                var activationArgs = e as ToastNotificationActivatedEventArgs;
                if (activationArgs != null)
                {
                    var arg = activationArgs.Argument;
                    var pos = arg.IndexOf('~');
                    if (pos != -1)
                    {
                        var id = arg.Substring(0, pos);
                        arg = arg.Substring(pos + 1);
                        MalNotificationsQuery.MarkNotifiactionsAsRead(new MalNotification(id));
                    }
                    if (arg.Contains(";"))
                    {
                        var options = activationArgs.Argument.Split(';');
                        if (options[0] == TileActions.OpenUrl.ToString())
                        {
                            LaunchUri(options[1]);
                        }
                    }
                    else
                    {
                        fullNavArgs = MalLinkParser.GetNavigationParametersForUrl(arg);
                    }
                }
            }



            // Do not repeat app initialization when the Window already has content,
            // just ensure that the window is active
            if (rootFrame == null)
            {
                // Create a Frame to act as the navigation context and navigate to the first page
                rootFrame = new Frame();

                rootFrame.NavigationFailed += OnNavigationFailed;

                if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    //nothing
                }
                if (e.PreviousExecutionState == ApplicationExecutionState.NotRunning)
                //Crashed - we have to remove cached anime list
                {
                    if (Settings.IsCachingEnabled)
                    {
                        await DataCache.ClearAnimeListData(); //clear all cached users data
                    }
                }



                // Place the frame in the current Window
                Window.Current.Content = rootFrame;
            }

            if (rootFrame.Content == null)
            {
                // When the navigation stack isn't restored navigate to the first page,
                // configuring the new page by passing required information as a navigation
                // parameter
                if (navArgs != null)
                {
                    MainViewModelBase.InitDetails = navArgs;
                }
                else if (fullNavArgs != null)
                {
                    MainViewModelBase.InitDetailsFull = fullNavArgs;
                }
                rootFrame.Navigate(typeof(MainPage));
            }
            else if (navArgs != null)
            {
                ViewModelLocator.GeneralMain.Navigate(PageIndex.PageAnimeDetails,
                                                      new AnimeDetailsPageNavigationArgs(navArgs.Item1, navArgs.Item2, null, null));
            }

            if (_initialized && fullNavArgs != null)
            {
                ViewModelLocator.GeneralMain.Navigate(fullNavArgs.Item1, fullNavArgs.Item2);
            }
            // Ensure the current window is active
            if (_initialized)
            {
                return;
            }

            InitializationRoutines.InitApp();

            NotificationTaskManager.StartNotificationTask(BgTasks.ToastActivation, false);
            NotificationTaskManager.StartNotificationTask(BgTasks.Notifications, false);
            NotificationTaskManager.OnNotificationTaskRequested += NotificationTaskManagerOnOnNotificationTaskRequested;
            ImageCache.PerformScheduledCacheCleanup();

            LiveTilesManager.LoadTileCache();

            Window.Current.Activate();
            RateReminderPopUp.ProcessRatePopUp();
            ProcessStatusBar();
            ProcessUpdate();
            StoreLogoWorkaroundHacker.Hack();
            _initialized = true;
        }
Ejemplo n.º 7
0
        private async void OnLaunchedOrActivated(IActivatedEventArgs e)
        {
            var rootFrame = Window.Current.Content as Frame;
            Tuple <int, string>       navArgs     = null;
            Tuple <PageIndex, object> fullNavArgs = null;
            var launchArgs = e as LaunchActivatedEventArgs;

            if (!string.IsNullOrWhiteSpace(launchArgs?.Arguments))
            {
                if (Regex.IsMatch(launchArgs.Arguments, @"[OpenUrl,OpenDetails];.*"))
                {
                    var options = launchArgs.Arguments.Split(';');
                    if (options[0] == TileActions.OpenUrl.ToString())
                    {
                        LaunchUri(options[1]);
                    }
                    else if (launchArgs.Arguments.Contains('|')) //legacy
                    {
                        var detailArgs = options[1].Split('|');
                        navArgs = new Tuple <int, string>(int.Parse(detailArgs[0]), detailArgs[1]);
                    }
                    else
                    {
                        fullNavArgs = MalLinkParser.GetNavigationParametersForUrl(options[1]);
                    }
                }
                else
                {
                    fullNavArgs = MalLinkParser.GetNavigationParametersForUrl(launchArgs.Arguments);
                }
            }
            else if (e is ProtocolActivatedEventArgs)
            {
                fullNavArgs = MalLinkParser.GetNavigationParametersForUrl("https:" + (e as ProtocolActivatedEventArgs).Uri.OriginalString.Replace("malclient://", ""));
            }
            else
            {
                var activationArgs = e as ToastNotificationActivatedEventArgs;
                if (activationArgs != null)
                {
                    var arg = activationArgs.Argument;
                    var pos = arg.IndexOf('~');
                    if (pos != -1)
                    {
                        var id = arg.Substring(0, pos);
                        arg = arg.Substring(pos + 1);
                        await MalNotificationsQuery.MarkNotifiactionsAsRead(new MalNotification(id));
                    }
                    if (arg.Contains(";"))
                    {
                        var options = activationArgs.Argument.Split(';');
                        if (options[0] == TileActions.OpenUrl.ToString())
                        {
                            LaunchUri(options[1]);
                        }
                    }
                    else
                    {
                        fullNavArgs = MalLinkParser.GetNavigationParametersForUrl(arg);
                    }
                }
            }



            // Do not repeat app initialization when the Window already has content,
            // just ensure that the window is active
            if (rootFrame == null)
            {
                // Create a Frame to act as the navigation context and navigate to the first page
                rootFrame = new Frame();

                rootFrame.NavigationFailed += OnNavigationFailed;

                if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    //nothing
                }



                // Place the frame in the current Window
                Window.Current.Content = rootFrame;
            }

            if (rootFrame.Content == null)
            {
                // When the navigation stack isn't restored navigate to the first page,
                // configuring the new page by passing required information as a navigation
                // parameter
                if (navArgs != null)
                {
                    MainViewModelBase.InitDetails = navArgs;
                }
                else if (fullNavArgs != null)
                {
                    MainViewModelBase.InitDetailsFull = fullNavArgs;
                }
                rootFrame.Navigate(typeof(MainPage));
            }
            else if (navArgs != null)
            {
                ViewModelLocator.GeneralMain.Navigate(PageIndex.PageAnimeDetails,
                                                      new AnimeDetailsPageNavigationArgs(navArgs.Item1, navArgs.Item2, null, null));
            }

            if (_initialized && fullNavArgs != null)
            {
                ViewModelLocator.GeneralMain.Navigate(fullNavArgs.Item1, fullNavArgs.Item2);
            }
            // Ensure the current window is active
            if (_initialized)
            {
                return;
            }

            await InitializationRoutines.InitApp();

            NotificationTaskManager.StartNotificationTask(BgTasks.ToastActivation, false);
            NotificationTaskManager.StartNotificationTask(BgTasks.Notifications, false);
            NotificationTaskManager.OnNotificationTaskRequested += NotificationTaskManagerOnOnNotificationTaskRequested;
            LiveTilesManager.LoadTileCache();
            ImageCache.PerformScheduledCacheCleanup();
            Window.Current.Activate();
            RateReminderPopUp.ProcessRatePopUp();
            JumpListManager.InitJumpList();

            var  tb   = ApplicationView.GetForCurrentView().TitleBar;
            bool dark = Settings.SelectedTheme == (int)ApplicationTheme.Dark;

            if (dark)
            {
                tb.ButtonBackgroundColor         = Colors.Transparent;
                tb.ButtonForegroundColor         = Colors.White;
                tb.ButtonHoverBackgroundColor    = Color.FromArgb(30, 255, 255, 255);
                tb.ButtonHoverForegroundColor    = Colors.White;
                tb.ButtonInactiveBackgroundColor = Colors.Transparent;
                tb.ButtonInactiveForegroundColor = Colors.Gray;
                tb.ButtonPressedBackgroundColor  = Color.FromArgb(80, 255, 255, 255);
                tb.ButtonPressedForegroundColor  = Colors.White;
            }
            else
            {
                tb.ButtonBackgroundColor         = Colors.Transparent;
                tb.ButtonForegroundColor         = Colors.Black;
                tb.ButtonHoverBackgroundColor    = Color.FromArgb(30, 0, 0, 0);
                tb.ButtonHoverForegroundColor    = Colors.Black;
                tb.ButtonInactiveBackgroundColor = Colors.Transparent;
                tb.ButtonInactiveForegroundColor = Colors.Gray;
                tb.ButtonPressedBackgroundColor  = Color.FromArgb(80, 0, 0, 0);
                tb.ButtonPressedForegroundColor  = Colors.Black;
            }
            ProcessUpdate();
            StoreLogoWorkaroundHacker.Hack();
            _initialized = true;
        }
        public override async void OnReceive(Context context, Intent sourceIntent)
        {
            try
            {
                ResourceLocator.RegisterBase();
                ResourceLocator.RegisterAppDataServiceAdapter(new ApplicationDataServiceService());
                ResourceLocator.RegisterPasswordVaultAdapter(new PasswordVaultProvider());
                ResourceLocator.RegisterMessageDialogAdapter(new MessageDialogProvider());
                ResourceLocator.RegisterHttpContextAdapter(new MalHttpContextProvider());
                ResourceLocator.RegisterDataCacheAdapter(new Adapters.DataCache(null));
                Credentials.Init();
            }
            catch (Exception)
            {
                //may be already registered... voodoo I guess
            }


            List <MalNotification> notifications = new List <MalNotification>();

            try
            {
                if (
                    Settings.EnabledNotificationTypes.HasFlag(MalNotificationsTypes.FriendRequestAcceptDeny) ||
                    Settings.EnabledNotificationTypes.HasFlag(MalNotificationsTypes.NewRelatedAnime) ||
                    Settings.EnabledNotificationTypes.HasFlag(MalNotificationsTypes.BlogComment) ||
                    Settings.EnabledNotificationTypes.HasFlag(MalNotificationsTypes.ClubMessages) ||
                    Settings.EnabledNotificationTypes.HasFlag(MalNotificationsTypes.ForumQuoute) ||
                    Settings.EnabledNotificationTypes.HasFlag(MalNotificationsTypes.FriendRequest) ||
                    Settings.EnabledNotificationTypes.HasFlag(MalNotificationsTypes.NowAiring) ||
                    Settings.EnabledNotificationTypes.HasFlag(MalNotificationsTypes.ProfileComment) ||
                    Settings.EnabledNotificationTypes.HasFlag(MalNotificationsTypes.Payment) ||
                    Settings.EnabledNotificationTypes.HasFlag(MalNotificationsTypes.UserMentions) ||
                    Settings.EnabledNotificationTypes.HasFlag(MalNotificationsTypes.WatchedTopics))
                {
                    List <MalNotification> notifs = null;
                    await Task.Run(async() =>
                    {
                        notifs = await MalNotificationsQuery.GetNotifications();
                    });

                    notifications.AddRange(notifs);
                    notifications =
                        notifications.Where(
                            notification =>
                            !notification.IsRead &&
                            (Settings.EnabledNotificationTypes & notification.Type) == notification.Type).ToList();
                }
            }
            catch (Exception e)
            {
                //http exec error
            }


            if ((Settings.EnabledNotificationTypes & MalNotificationsTypes.Messages) == MalNotificationsTypes.Messages)
            {
                try
                {
                    List <MalMessageModel> msgs = null;
                    await Task.Run(async() =>
                    {
                        msgs = await AccountMessagesManager.GetMessagesAsync(1);
                    });

                    foreach (var malMessageModel in msgs)
                    {
                        if (!malMessageModel.IsRead)
                        {
                            notifications.Add(new MalNotification(malMessageModel)); //I'm assuming that Ids are unique
                        }
                    }
                }
                catch (Exception)
                {
                    //no messages
                }
            }

            bool watchedTopicsUpdated = false;

            foreach (var watchedTopic in ResourceLocator.HandyDataStorage.WatchedTopics.StoredItems)
            {
                if (!watchedTopic.OnCooldown)
                {
                    var count = await new ForumTopicMessageCountQuery(watchedTopic.Id).GetMessageCount(true);
                    if (count == null)
                    {
                        continue;
                    }

                    if (count > watchedTopic.LastCheckedReplyCount)
                    {
                        var notif = new MalNotification(watchedTopic);
                        var diff  = count - watchedTopic.LastCheckedReplyCount;
                        if (diff == 1)
                        {
                            notif.Content += " There is one new reply.";
                        }
                        else
                        {
                            notif.Content += $" There are {diff} new replies.";
                        }

                        notifications.Add(notif);

                        watchedTopic.OnCooldown            = true;
                        watchedTopic.LastCheckedReplyCount = count.Value;
                        watchedTopicsUpdated = true;
                    }
                }
            }
            if (watchedTopicsUpdated)
            {
                ResourceLocator.HandyDataStorage.WatchedTopics.SaveData();
            }


            if (!notifications.Any())
            {
                return;
            }

            var dataService = (ResourceLocator.ApplicationDataService as ApplicationDataServiceService);

            dataService.OverridePreferenceManager(context);

            var allTriggeredNotifications = (ResourceLocator.ApplicationDataService[nameof(RoamingDataTypes.ReadNotifications)] ?? string.Empty) as string;
            var triggeredNotifications    = allTriggeredNotifications?.Split(';').ToList() ?? new List <string>();

            Log.Debug("MALClient",
                      $"Checking notifications: trig: {triggeredNotifications.Count} fetched: {notifications.Count}");
            //trigger new notifications
            foreach (var notification in notifications)
            {
                if (triggeredNotifications.Contains(notification.Id))
                {
                    continue;
                }

                triggeredNotifications.Add(notification.Id);
                ScheduleToast(context, notification);
            }

            //remove old triggered entries
            var presentNotifications = new List <string>();

            foreach (var triggeredNotification in triggeredNotifications)
            {
                if (notifications.Any(notif => notif.Id == triggeredNotification))
                {
                    presentNotifications.Add(triggeredNotification);
                }
            }

            ResourceLocator.ApplicationDataService[nameof(RoamingDataTypes.ReadNotifications)] = string.Join(";",
                                                                                                             presentNotifications);

            dataService.ResetPreferenceManagerOverride();
        }