private MenuFlyoutReactions(IList <Reaction> reactions, MessageViewModel message, MessageBubble bubble, MenuFlyout flyout)
        {
            _reactions     = message.ProtoService.IsPremium ? reactions : reactions.Where(x => !x.IsPremium).ToList();
            _canUnlockMore = message.ProtoService.IsPremiumAvailable && !message.ProtoService.IsPremium && reactions.Any(x => x.IsPremium);
            _message       = message;
            _bubble        = bubble;
            _flyout        = flyout;

            InitializeComponent();

            var last      = flyout.Items.LastOrDefault();
            var presenter = last.Ancestors <MenuFlyoutPresenter>().FirstOrDefault();

            _presenter = presenter;
            _popup     = new Popup();

            var transform = presenter.TransformToVisual(Window.Current.Content);
            var position  = transform.TransformPoint(new Point());

            //var relativeFirst = Math.Abs(absolute.Y - position.Y);
            //var relativeLast = Math.Abs(absolute.Y - (position.Y + presenter.ActualHeight));
            var upsideDown = false; //relativeLast < relativeFirst;

            var count = Math.Min(_reactions.Count, 6);

            var actualWidth = presenter.ActualSize.X + 18 + 12 + 18;
            var width       = 8 + count * 34 - 2;

            var padding = actualWidth - width;

            Shadow.Width        = width;
            Pill.Width          = width;
            ScrollingHost.Width = width;

            Expand.Visibility = _reactions.Count > 6 ? Visibility.Visible : Visibility.Collapsed;

            BubbleMedium.VerticalAlignment = upsideDown ? VerticalAlignment.Top : VerticalAlignment.Bottom;
            BubbleMedium.Margin            = new Thickness(0, upsideDown ? -6 : 0, 18, upsideDown ? 0 : -6);

            BubbleOverlay.VerticalAlignment = upsideDown ? VerticalAlignment.Top : VerticalAlignment.Bottom;
            BubbleOverlay.Margin            = new Thickness(0, upsideDown ? -6 : 0, 18, upsideDown ? 0 : -6);

            LayoutRoot.Padding = new Thickness(16, upsideDown ? 32 : 16, 16, upsideDown ? 16 : 32);

            var offset  = 0;
            var visible = _reactions.Count > 6 ? 5 : 6; //Math.Ceiling((width - 8) / 34);
 public static MenuFlyoutReactions ShowAt(IList <Reaction> reactions, MessageViewModel message, MessageBubble bubble, MenuFlyout flyout)
 {
     return(new MenuFlyoutReactions(reactions, message, bubble, flyout));
 }