示例#1
0
        protected override async void OnResume()
        {
            base.OnResume();

            if (Presenter != null && Settings.IsUserAuthenticated)
            {
                if (Intent.GetBooleanExtra(DisplayNotificationsIntentKey, false))
                {
                    Intent.RemoveExtra(DisplayNotificationsIntentKey);
                    AniListNotificationsDialog.Create(this, Presenter.GetNotificationsEnumerable(),
                                                      _unreadNotificationCount, () => SetNotificationCount(0));
                }
                else
                {
                    await Presenter.GetUserNotificationCount();
                }
            }

            if (Settings.EnableNotificationService && Settings.IsUserAuthenticated)
            {
                AniDroidJobManager.EnableAniListNotificationJob(this);
            }
            else
            {
                AniDroidJobManager.DisableAniListNotificationJob(this);
            }
        }
示例#2
0
        public void CreateEnableNotificationServiceItem(bool enableNotificationService)
        {
            _settingsContainer.AddView(
                CreateSwitchSettingRow(this, "Enable Notification Alerts",
                                       "Check for new AniList notifications every 30 minutes.",
                                       enableNotificationService, true,
                                       (sender, args) =>
            {
                Presenter.SetEnableNotificationService(args.IsChecked);

                if (args.IsChecked)
                {
                    AniDroidJobManager.EnableAniListNotificationJob(this);
                }
                else
                {
                    AniDroidJobManager.DisableAniListNotificationJob(this);
                }
            }));
            _settingsContainer.AddView(CreateSettingDivider(this));
        }