public ToastProxyMock WithFilm(FullFilm film, bool isUnlimitedScreening)
        {
            Mock
            .Setup(x => x.ShowToast(
                       It.Is <FullFilm>(y => y.Code == film.Code),
                       It.Is <bool>(y => y == isUnlimitedScreening)));

            return(this);
        }
Esempio n. 2
0
        private bool CanFilmBeDisplayedInternal(bool isForToast, FullFilm film)
        {
            if (!isForToast && !_userPreferencesService.NotificationsFilterAppliesToList)
            {
                return(true);
            }

            if (_userPreferencesService.AlertOnEverything ||
                _userPreferencesService.DontShowAlertsFor.IsNullOrEmpty() ||
                film.Attributes.IsNullOrEmpty())
            {
                return(true);
            }

            return(!film.Attributes.Any(x => _userPreferencesService.DontShowAlertsFor.Contains(x)));
        }
 private ToastContent CreateToastContent(FullFilm film, out string message)
 {
     message = $"{film.FeatureTitle} is now available to book online.";
     return(new ToastContent
     {
         Visual = new ToastVisual
         {
             BindingGeneric = new ToastBindingGeneric
             {
                 AppLogoOverride = new ToastGenericAppLogo
                 {
                     Source = film.PosterSrc.ToCineworldLink(),
                     HintCrop = ToastGenericAppLogoCrop.None
                 },
                 Children =
                 {
                     new AdaptiveText
                     {
                         Text = film.FeatureTitle,
                         HintStyle = AdaptiveTextStyle.Title
                     },
                     new AdaptiveText
                     {
                         Text = message,
                         HintWrap = true
                     },
                 }
             }
         },
         Actions = new ToastActionsCustom
         {
             Buttons =
             {
                 new ToastButton("Book Now", $"{ToastService.LauncherCode}{film.Url.ToCineworldLink()}")
                 {
                     ActivationType = ToastActivationType.Background
                 }
             }
         }
     });
 }
        public async Task AnnounceUnlimitedScreening(FullFilm film)
        {
            var alarmEmoji   = char.ConvertFromUtf32(0x1F6A8);
            var message      = $"{alarmEmoji} NEW UNLIMITED SCREENING {alarmEmoji}";
            var toastContent = new ToastContent
            {
                Visual = new ToastVisual
                {
                    BindingGeneric = new ToastBindingGeneric
                    {
                        AppLogoOverride = new ToastGenericAppLogo
                        {
                            Source   = "ms-appx:///Assets/StoreLogo.png",
                            HintCrop = ToastGenericAppLogoCrop.Circle
                        },
                        Children =
                        {
                            new AdaptiveText
                            {
                                Text      = message,
                                HintStyle = AdaptiveTextStyle.Title
                            },
                            new AdaptiveText
                            {
                                Text     = film.FeatureTitle,
                                HintWrap = true
                            }
                        }
                    }
                }
            };

            var toast = new ToastNotification(toastContent.GetXml());

            ToastNotificationManager.CreateToastNotifier().Show(toast);

            await SendPushNotification(message, film.FeatureTitle);
        }
        public async Task ShowToast(FullFilm film, bool isUnlimitedScreening)
        {
            var toastContent = CreateToastContent(film, out var message);
            var body         = string.Empty;

            if (isUnlimitedScreening && film.DateStarted.HasValue)
            {
                body = $"Screening is on {film.DateStarted:dddd MMMM dd}";
                toastContent.Visual.BindingGeneric.Children.Add(new AdaptiveText
                {
                    Text     = body,
                    HintWrap = true
                });
            }

            var toast = new ToastNotification(toastContent.GetXml())
            {
                ExpirationTime = DateTimeOffset.Now.AddDays(2)
            };

            ToastNotificationManager.CreateToastNotifier().Show(toast);

            await SendPushNotification(message, body, "Click to book", film.Url.ToCineworldLink());
        }
Esempio n. 6
0
 public bool CanFilmBeDisplayed(FullFilm film)
 => CanFilmBeDisplayedInternal(false, film);
Esempio n. 7
0
 public static bool IsUnlimitedScreening(this FullFilm film)
 => film.Attributes?.Contains(FilmCategory.UnlimitedScreening) ?? false;
 public FilmChangedMessage(FullFilm film)
 => Film = film;
 public FilmViewModel(FullFilm film)
 => _film = film;