void DrillDown(RewardItemModel reward)
 {
     if (reward != null)
     {
         if (reward.Type == "REWARD")
         {
             UIStoryboard board = UIStoryboard.FromName("Rewards", null);
             RewardDetailViewController ctrl = (RewardDetailViewController)board.InstantiateViewController("RewardDetailViewController") as RewardDetailViewController;
             ctrl.Reward = reward;
             RewardsViewController.NavigationController.PushViewController(ctrl, true);
         }
         else if (reward.Type == "CATEGORY")
         {
             UIStoryboard          board = UIStoryboard.FromName("Rewards", null);
             RewardsViewController ctrl  = (RewardsViewController)board.InstantiateViewController("RewardsViewController") as RewardsViewController;
             if (reward.ChildList != null)
             {
                 ctrl.RewardList = reward.ChildList;
             }
             else
             {
                 ctrl.CategoryID = reward.ID;
             }
             RewardsViewController.NavigationController.PushViewController(ctrl, true);
         }
     }
 }
 private void DrillDown(RewardItemModel reward)
 {
     if (reward != null)
     {
         if (reward.Type == "REWARD")
         {
             UIStoryboard board = UIStoryboard.FromName("Rewards", null);
             RewardDetailViewController ctrl = (RewardDetailViewController)board.InstantiateViewController("RewardDetailViewController") as RewardDetailViewController;
             ctrl.Reward   = reward;
             ctrl.Subtitle = string.Format("{0} | {1}", RewardsViewController.RewardsCategoryName, RewardsViewController.RewardsSubcategoryName);
             RewardsViewController.NavigationController.PushViewController(ctrl, true);
         }
         else if (reward.Type == "CATEGORY")
         {
             UIStoryboard          board = UIStoryboard.FromName("Rewards", null);
             RewardsViewController ctrl  = (RewardsViewController)board.InstantiateViewController("RewardsViewController") as RewardsViewController;
             ctrl.RewardsCategoryName    = RewardsViewController.RewardsCategoryName;
             ctrl.RewardsSubcategoryName = reward.Name;
             if (reward.ChildList != null)
             {
                 ctrl.RewardList = reward.ChildList;
             }
             else
             {
                 ctrl.CategoryID = reward.ID;
                 SL.RewardList   = null;
             }
             RewardsViewController.NavigationController.PushViewController(ctrl, true);
         }
     }
 }
Exemple #3
0
        public void UpdateCellData(RewardItemModel item)
        {
            this.SelectionStyle = UITableViewCellSelectionStyle.None;
            UIStringAttributes stringAttributes = new UIStringAttributes
            {
                Font            = RewardName.Font,
                ForegroundColor = UIColor.Black,
                ParagraphStyle  = new NSMutableParagraphStyle()
                {
                    LineSpacing = 6.0f
                }
            };
            var AttributedText = new NSMutableAttributedString(item.Name);

            AttributedText.AddAttributes(stringAttributes, new NSRange(0, item.Name.Length));
            RewardName.AttributedText = AttributedText;
            RewardName.SizeToFit();
            //if (((RewardName.ContentSize.Height - RewardName.TextContainerInset.Top - RewardName.TextContainerInset.Bottom) / RewardName.Font.LineHeight) < 2)
            //{
            //    var frame = RewardName.Frame;
            //    frame.Y += (nfloat)(RewardName.Font.LineHeight * 0.6);
            //    RewardName.Frame = frame;
            //}
            RewardImage.Image = UIImage.FromBundle("CellImagePlaceholder");
        }
        private void GetRewardByUrlComplete(RewardItemModel rewardItem)
        {
            var          rootViewController = UIApplication.SharedApplication.KeyWindow.RootViewController as UINavigationController;
            UIStoryboard board = UIStoryboard.FromName("Rewards", null);

            if (rewardItem.Type == "REWARD")
            {
                var vc = (RewardDetailViewController)board.InstantiateViewController("RewardDetailViewController");
                vc.Reward = rewardItem;
                rootViewController.PushViewController(vc, true);
                return;
            }

            if (rewardItem.Type == "CATEGORY")
            {
                RewardsViewController ctrl = (RewardsViewController)board.InstantiateViewController("RewardsViewController") as RewardsViewController;
                ctrl.RewardsCategoryName = rewardItem.Name;
                if (rewardItem.ChildList != null)
                {
                    ctrl.RewardList = rewardItem.ChildList;
                }
                else
                {
                    ctrl.CategoryID = rewardItem.ID;
                    SL.RewardList   = null;
                }

                rootViewController.PushViewController(ctrl, true);
            }
        }
        public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath)
        {
            var             list   = RewardList;
            RewardItemModel reward = list != null ? list[indexPath.Row] : null;

            UITableViewCell cell;

            if (reward.Type == "REWARD")
            {
                cell = tableView.DequeueReusableCell(AvailableRewardsTableCell.ClassName);
                IRewardTableCell rewardCell = cell as IRewardTableCell;
                if (rewardCell != null)
                {
                    rewardCell.UpdateCellData(reward, -10, RewardStatus.Aviable, false);
                }
            }
            else
            {
                cell = tableView.DequeueReusableCell(RewardCategoryTableViewCell.ClassName);
                RewardCategoryTableViewCell rewardCell = cell as RewardCategoryTableViewCell;
                if (rewardCell != null)
                {
                    rewardCell.UpdateCellData(reward);
                }
            }
            return(cell);
        }
Exemple #6
0
        private async Task OnRewardCategorySelected(RewardItemModel reward)
        {
            await _navigationService.Navigate <RewardsViewModel>();

            MessangerRewardModel rewardMessage = new MessangerRewardModel(this, reward);

            _messenger.Publish <MessangerRewardModel>(rewardMessage);
        }
        public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath)
        {
            var             list   = RewardList;
            RewardItemModel reward = list != null ? list[indexPath.Row] : null;

            UITableViewCell cell;

            if (reward != null && reward.Type == "REWARD")
            {
                cell = tableView.DequeueReusableCell(RewardsTableViewCell.ClassName);
                RewardsTableViewCell rewardCell = cell as RewardsTableViewCell;
                cell.Frame = new CoreGraphics.CGRect(cell.Frame.X, cell.Frame.Y, tableView.Frame.Width, cell.Frame.Height);
                cell.UpdateConstraintsIfNeeded();
                if (rewardCell != null)
                {
                    int itemIndex = list.IndexOf(reward);

                    nfloat rewardLittleOffset = UIScreen.MainScreen.Bounds.Width / 100 * 2.17f;
                    nfloat rewardBigOffset    = UIScreen.MainScreen.Bounds.Width / 100 * 7.73f;

                    bool noPoints = reward.MinScore > SL.Profile.Score;
                    bool locked   = (reward.AutoUnlockDate?.ToLocalTime() ?? DateTime.Now) > DateTime.Now;

                    rewardCell.PrepareForReuse();
                    if (noPoints && locked)
                    {
                        rewardCell.UpdateCellData(reward, rewardLittleOffset, false);
                    }
                    else if (noPoints && !locked)
                    {
                        rewardCell.UpdateCellData(reward, rewardBigOffset, false);
                    }
                    else if (!noPoints && locked)
                    {
                        rewardCell.UpdateCellData(reward, -rewardBigOffset, true);
                    }
                    else if (!noPoints && !locked)//Available
                    {
                        rewardCell.UpdateCellData(reward, -rewardLittleOffset, true);
                    }
                }
            }
            else
            {
                cell = tableView.DequeueReusableCell(RewardCategoryTableViewCell.ClassName);
                RewardCategoryTableViewCell rewardCell = cell as RewardCategoryTableViewCell;
                rewardCell.SelectionStyle = UITableViewCellSelectionStyle.None;
                if (reward != null && rewardCell != null)
                {
                    rewardCell.UpdateCellData(reward);
                }
            }
            return(cell);
        }
Exemple #8
0
 public void UpdateCellData(RewardItemModel item, nfloat offset, RewardStatus status, bool isRightOrientation = true)
 {
     if (status == RewardStatus.Aviable)
     {
         IconStatus.Image = UIImage.FromBundle("circle_green");
     }
     if (status == RewardStatus.Claimed)
     {
         IconStatus.Image = UIImage.FromBundle("gift_icon");
     }
     UpdateCellData(item);
 }
        public override void RowSelected(UITableView tableView, NSIndexPath indexPath)
        {
            RewardsTableView rewardTable = tableView as RewardsTableView;

            if (rewardTable != null)
            {
                var             list   = RewardList;
                RewardItemModel reward = list != null ? list[indexPath.Row] : null;
                if (reward != null)
                {
                    DrillDown(reward);
                }
            }
        }
        public override nfloat GetHeightForRow(UITableView tableView, NSIndexPath indexPath)
        {
            var             list   = RewardList;
            RewardItemModel reward = list != null ? list[indexPath.Row] : null;
            nfloat          heightForRow;

            if (reward != null && reward.Type == "REWARD")
            {
                heightForRow = tableView.Bounds.Width * 0.43f;
            }
            else
            {
                heightForRow = tableView.Bounds.Width * 0.915f;
            }
            return(heightForRow);
        }
        public override void RowSelected(UITableView tableView, NSIndexPath indexPath)
        {
            if (Platform.IsInternetConnectionAvailable() == false)
            {
                return;
            }
            RewardsTableView rewardTable = tableView as RewardsTableView;

            if (rewardTable != null)
            {
                var             list   = RewardList;
                RewardItemModel reward = list != null ? list[indexPath.Row] : null;
                if (reward != null)
                {
                    DrillDown(reward);
                }
            }
        }
        public override UIView GetViewForHeader(UITableView tableView, nint section)
        {
            var             tableHeaderView = TableHeaderView.Create();
            var             list            = RewardList;
            RewardItemModel reward          = (list != null && (list.Count > 0)) ? list[0] : null;

            if (reward == null)
            {
                return(tableHeaderView);
            }
            if (reward?.Type == "REWARD")
            {
                tableHeaderView.UpdateText(RewardsViewController.RewardsCategoryName, RewardsViewController.RewardsSubcategoryName);
            }
            else
            {
                tableHeaderView.UpdateText(RewardsViewController.RewardsCategoryName, RewardsViewController.RewardsSubcategoryName);
            }
            return(tableHeaderView);
        }
        private async void GetRewardByUrlComplete(RewardItemModel rewardItem)
        {
            if (rewardItem.Type == ActionTypeConstants.RewardRewardType)
            {
                var parameter = new MessangerRewardModel(this, rewardItem);
                await _navigationService.Navigate <RewardsDetailsViewModel>();

                _messenger.Publish <MessangerRewardModel>(parameter);
                return;
            }

            if (rewardItem.Type == ActionTypeConstants.CategoryRewardType)
            {
                var parameter = new MessangerRewardModel(this, rewardItem, rewardItem.Name);
                await _navigationService.Navigate <RewardsViewModel>();

                _messenger.Publish <MessangerRewardModel>(parameter);
                return;
            }
        }
        public void UpdateCellData(RewardItemModel item, nfloat offset, bool isRightOrientation = true)
        {
            PrepareForReuse();
            UpdateCellData(item);

            if (isRightOrientation)
            {
                //var test = RewardImage.Frame.Width;
                //var test1 = RewardImage.Bounds.Width;
                //LeadingSpaceImageConstraint.Constant = this.Frame.Width - RewardImage.Frame.Width + offset;
                LeadingSpaceImageConstraint.Constant        = this.Frame.Width - _rewardWidthConstant + offset;
                LeadingSpaceDescriptionConstraint.Constant  = 0;
                TrailingSpaceDescriptionConstraint.Constant = _rewardWidthConstant - offset;
                //TrailingSpaceDescriptionConstraint.Constant = RewardImage.Frame.Width - offset;
            }
            else
            {
                LeadingSpaceImageConstraint.Constant = offset;
                //LeadingSpaceDescriptionConstraint.Constant = RewardImage.Frame.Width + offset;
                LeadingSpaceDescriptionConstraint.Constant  = _rewardWidthConstant + offset;
                TrailingSpaceDescriptionConstraint.Constant = 0;
            }
            this.UpdateConstraintsIfNeeded();
        }
        public void UpdateCellData(RewardItemModel item)
        {
            var test = this.Frame.Width;

            lblPointsCount.Text  = item.MinScore.ToString();
            lblAviableUnits.Text = string.Format("{0} Units Available", item.RemainingUnits);
            ImageService.Instance.LoadUrl(item.MainImageURL).Into(RewardImage);
            this.SelectionStyle = UITableViewCellSelectionStyle.None;
            LikeButton.SetImage(UIImage.FromBundle("points-icon_off"), UIControlState.Normal);
            UIStringAttributes stringAttributes = new UIStringAttributes
            {
                Font            = UIFont.FromName("ProximaNova-Bold", UIScreen.MainScreen.Bounds.Width * 0.055f),
                ForegroundColor = UIColor.Black,
                ParagraphStyle  = new NSMutableParagraphStyle()
                {
                    LineSpacing = 6.0f
                }
            };
            var attributedText = new NSMutableAttributedString(item.Name);

            attributedText.AddAttributes(stringAttributes, new NSRange(0, item.Name.Length));
            RewardName.AttributedText = attributedText;

            RewardImage.Layer.CornerRadius = RewardImageOverlay.Layer.CornerRadius = UIScreen.MainScreen.Bounds.Width / 100 * 0.48f;

            bool noPoints = item.MinScore > SL.Profile.Score;
            bool Locked   = (item.AutoUnlockDate?.ToLocalTime() ?? DateTime.Now) > DateTime.Now;

            //item.MinScore = (int)(SL.Profile.Score * 0.8f);//Hardcode

            if (noPoints && Locked)
            {
                lockStatus.Image  = UIImage.FromBundle("lock-icon");
                unlockStatus.Text = item.NextEventCountDown; //string.Format("{0} {1:hh}h:{1:mm}m:{1:ss}s", "Unlocks in", (TimeSpan)((item?.AutoUnlockDate?? DateTime.Now) - DateTime.Now));//.ToString(@"hh h\:mm m\:ss s\"));
                float iconStatusWidth  = (float)(Frame.Width / 7.009);
                float statusLabelWidth = (float)(Frame.Width / 8.8);


                topLeftIcon.BackgroundColor          = UIColor.White;
                topLeftIcon.Layer.BorderColor        = UIColor.FromRGB(229, 229, 229).CGColor;
                topLeftIcon.Layer.BorderWidth        = iconStatusWidth * 0.037f;
                topLeftIcon.Layer.CornerRadius       = iconStatusWidth / 2;
                vStatusBorderLeft.Layer.BorderWidth  = iconStatusWidth * 0.037f;
                vStatusBorderLeft.Layer.CornerRadius = iconStatusWidth / 2;
                vStatusBorderLeft.Layer.BorderColor  = UIColor.FromRGB(232, 31, 138).CGColor;
                vStatusCircleLeft.Layer.CornerRadius = statusLabelWidth / 2;
                //topLeftIcon.BackgroundColor = UIColor.White;
                //topLeftIcon.Layer.BorderColor = UIColor.FromRGB(229, 229, 229).CGColor;
                //topLeftIcon.Layer.BorderWidth = topLeftIcon.Bounds.Width * 0.037f;
                //topLeftIcon.Layer.CornerRadius = topLeftIcon.Bounds.Width / 2;
                //vStatusBorderLeft.Layer.BorderWidth = vStatusBorderLeft.Bounds.Width * 0.037f;
                //vStatusBorderLeft.Layer.CornerRadius = vStatusBorderLeft.Bounds.Width / 2;
                //vStatusBorderLeft.Layer.BorderColor = UIColor.FromRGB(232, 31, 138).CGColor;
                //vStatusCircleLeft.Layer.CornerRadius = vStatusCircleLeft.Bounds.Width / 2;

                //cnStatusPercentLeft.Constant = (nfloat)(vPercentContainerLeft.Bounds.Width * (SL.Profile.Score / item.MinScore) - vPercentContainerLeft.Bounds.Width / 2);

                vPercentContainerLeft.Hidden = false;

                //UILabel lblStatusCount;
                //if (SL.Profile.Score / item.MinScore > 0.7)
                //{
                //    lblStatusCount = lblStatusCountBottomLeft;
                //}
                //else
                //{
                //    lblStatusCount = lblStatusCountTopLeft;
                //}
                //lblStatusCount.Hidden = false;
                //lblStatusCount.Text = (item.MinScore - SL.Profile.Score).ToString();
                //topLeftIcon.Image = UIImage.FromBundle("small-score-icon");
                lblStatusCountTopLeft.Hidden = false;
                lblStatusCountTopLeft.Text   = (item.MinScore - SL.Profile.Score).ToString();
            }
            else if (noPoints && !Locked)
            {
                //iconStatus.Image = UIImage.FromBundle("small-score-icon");
                iconStatus.BackgroundColor   = UIColor.White;
                iconStatus.Layer.BorderColor = UIColor.FromRGB(229, 229, 229).CGColor;
                float iconStatusWidth  = (float)(Frame.Width / 7.211);
                float statusLabelWidth = (float)(Frame.Width / 8.8);
                iconStatus.Layer.BorderWidth     = iconStatusWidth * 0.037f;
                iconStatus.Layer.CornerRadius    = iconStatusWidth / 2;
                vStatusBorder.Layer.BorderWidth  = iconStatusWidth * 0.037f;
                vStatusBorder.Layer.CornerRadius = iconStatusWidth / 2;
                vStatusBorder.Layer.BorderColor  = UIColor.FromRGB(232, 31, 138).CGColor;
                vStatusCircle.Layer.CornerRadius = statusLabelWidth / 2;

                /*
                 * iconStatus.Layer.BorderWidth = iconStatus.Bounds.Width * 0.037f;
                 * iconStatus.Layer.CornerRadius = iconStatus.Bounds.Width / 2;
                 * vStatusBorder.Layer.BorderWidth = vStatusBorder.Bounds.Width * 0.037f;
                 * vStatusBorder.Layer.CornerRadius = vStatusBorder.Bounds.Width / 2;
                 * vStatusBorder.Layer.BorderColor = UIColor.FromRGB(232, 31, 138).CGColor;
                 * vStatusCircle.Layer.CornerRadius = vStatusCircle.Bounds.Width / 2;
                 */
                //cnStatusPercent.Constant = (nfloat)(vPercentContainer.Bounds.Width * (SL.Profile.Score / item.MinScore) - vPercentContainer.Bounds.Width / 2);

                needMoreStatus.Text = "MORE NEEDED";

                vPercentContainer.Hidden = false;

                //UILabel lblStatusCount;
                //if (SL.Profile.Score / item.MinScore > 0.7)
                //{
                //    lblStatusCount = lblStatusCountBottom;
                //}
                //else
                //{
                //  lblStatusCount = lblStatusCountTop;
                //}
                lblStatusCountTop.Text   = (item.MinScore - SL.Profile.Score).ToString();
                lblStatusCountTop.Hidden = false;
                //lblStatusCount = lblStatusCountBottom;
                //lblStatusCount.Hidden = false;
                //lblStatusCount.Text = (item.MinScore - SL.Profile.Score).ToString();
            }
            else if (!noPoints && Locked)
            {
                lockStatus.Image     = UIImage.FromBundle("lock-icon");
                unlockStatus.Text    = item.NextEventCountDown; //string.Format("{0} {1:hh}h:{1:mm}m:{1:ss}s", "Unlocks in", (TimeSpan)((item?.AutoUnlockDate?? DateTime.Now) - DateTime.Now));//.ToString(@"hh h\:mm m\:ss s\"));
                topStatusImage.Image = UIImage.FromBundle("circle_green");
            }
            else if (!noPoints && !Locked)//Available
            {
                cnCenterStatusWidth.Constant = RewardImageOverlay.Bounds.Width * cnTopStatusImageWidth.Multiplier - RewardImageOverlay.Bounds.Width * cnCenterStatusWidth.Multiplier;
                iconStatus.Image             = UIImage.FromBundle("circle_green");
            }
        }
Exemple #16
0
 public void UpdateCellData(RewardItemModel item, nfloat offset, bool isRightOrientation = true)
 {
     throw new NotImplementedException();
 }
        private List <RewardItemModel> GetMockData()
        {
            List <RewardItemModel> rewardList   = new List <RewardItemModel>();
            RewardItemModel        rewardModel1 = new RewardItemModel();

            rewardModel1.AutoUnlockDate   = DateTime.Now + TimeSpan.FromDays(1);
            rewardModel1.AvailabilityDate = DateTime.Now + TimeSpan.FromDays(40);
            rewardModel1.ButtonLockStatus = true;
            rewardModel1.ID                 = 1;
            rewardModel1.isOffersInline     = false;
            rewardModel1.LocationLat        = null;
            rewardModel1.Name               = "3 Day GA Ticket";
            rewardModel1.SubTitle           = "SubTitle 2";
            rewardModel1.Type               = "REWARD";
            rewardModel1.Description        = "test1231";
            rewardModel1.RemainingUnits     = 90;
            rewardModel1.SmallImageURL      = "https://cdn4.iconfinder.com/data/icons/miu-square-flat-social/60/linkedin-square-social-media-128.png";
            rewardModel1.SmallImageClickURL = "https://cdn4.iconfinder.com/data/icons/miu-square-flat-social/60/linkedin-square-social-media-128.png";

            RewardItemModel rewardModel2 = new RewardItemModel();

            rewardModel2.AutoUnlockDate   = DateTime.Now + TimeSpan.FromDays(1);
            rewardModel2.AvailabilityDate = DateTime.Now + TimeSpan.FromDays(4);
            rewardModel2.ButtonLockStatus = true;
            rewardModel2.ID                 = 1;
            rewardModel2.isOffersInline     = false;
            rewardModel2.LocationLat        = null;
            rewardModel2.Name               = "3 Day Parking Pass";
            rewardModel2.SubTitle           = "SubTitle 2";
            rewardModel2.Type               = "REWARD";
            rewardModel2.Description        = "test1231";
            rewardModel2.RemainingUnits     = 90;
            rewardModel2.SmallImageURL      = "https://cdn4.iconfinder.com/data/icons/miu-square-flat-social/60/linkedin-square-social-media-128.png";
            rewardModel2.SmallImageClickURL = "https://cdn4.iconfinder.com/data/icons/miu-square-flat-social/60/linkedin-square-social-media-128.png";

            RewardItemModel rewardModel3 = new RewardItemModel();

            rewardModel3.AutoUnlockDate   = DateTime.Now + TimeSpan.FromDays(1);
            rewardModel3.AvailabilityDate = DateTime.Now + TimeSpan.FromDays(4);
            rewardModel3.ButtonLockStatus = true;
            rewardModel3.ID                 = 1;
            rewardModel3.isOffersInline     = false;
            rewardModel3.LocationLat        = null;
            rewardModel3.Name               = "3 Day Parking Pass";
            rewardModel3.SubTitle           = "SubTitle 2";
            rewardModel3.Type               = "REWARD";
            rewardModel3.Description        = "test1231";
            rewardModel3.RemainingUnits     = 90;
            rewardModel3.SmallImageURL      = "https://cdn4.iconfinder.com/data/icons/miu-square-flat-social/60/linkedin-square-social-media-128.png";
            rewardModel3.SmallImageClickURL = "https://cdn4.iconfinder.com/data/icons/miu-square-flat-social/60/linkedin-square-social-media-128.png";

            RewardItemModel rewardModel4 = new RewardItemModel();

            rewardModel4.AutoUnlockDate   = DateTime.Now + TimeSpan.FromDays(1);
            rewardModel4.AvailabilityDate = DateTime.Now + TimeSpan.FromDays(70);
            rewardModel4.ButtonLockStatus = true;
            rewardModel4.ID                 = 1;
            rewardModel4.isOffersInline     = false;
            rewardModel4.LocationLat        = null;
            rewardModel4.Name               = "3 Day Parking";
            rewardModel4.SubTitle           = "SubTitle 2";
            rewardModel4.Type               = "REWARD";
            rewardModel4.Description        = "test1231";
            rewardModel4.RemainingUnits     = 90;
            rewardModel4.SmallImageURL      = "https://cdn4.iconfinder.com/data/icons/miu-square-flat-social/60/linkedin-square-social-media-128.png";
            rewardModel4.SmallImageClickURL = "https://cdn4.iconfinder.com/data/icons/miu-square-flat-social/60/linkedin-square-social-media-128.png";


            RewardItemModel rewardModel5 = new RewardItemModel();

            rewardModel5.AutoUnlockDate   = DateTime.Now + TimeSpan.FromDays(1);
            rewardModel5.AvailabilityDate = DateTime.Now + TimeSpan.FromDays(4);
            rewardModel5.ButtonLockStatus = true;
            rewardModel5.ID                 = 1;
            rewardModel5.isOffersInline     = false;
            rewardModel5.LocationLat        = null;
            rewardModel5.Name               = "Testete";
            rewardModel5.SubTitle           = "SubTitle 2";
            rewardModel5.Type               = "REWARD";
            rewardModel5.Description        = "test1231";
            rewardModel5.RemainingUnits     = 90;
            rewardModel5.SmallImageURL      = "https://cdn4.iconfinder.com/data/icons/miu-square-flat-social/60/linkedin-square-social-media-128.png";
            rewardModel5.SmallImageClickURL = "https://cdn4.iconfinder.com/data/icons/miu-square-flat-social/60/linkedin-square-social-media-128.png";


            RewardItemModel rewardModel6 = new RewardItemModel();

            rewardModel6.AutoUnlockDate   = DateTime.Now + TimeSpan.FromDays(1);
            rewardModel6.AvailabilityDate = DateTime.Now + TimeSpan.FromDays(4);
            rewardModel6.ButtonLockStatus = true;
            rewardModel6.ID                 = 1;
            rewardModel6.isOffersInline     = false;
            rewardModel6.LocationLat        = null;
            rewardModel6.Name               = "Testetdsfgsde";
            rewardModel6.SubTitle           = "SubTitle 2";
            rewardModel6.Type               = "REWARD";
            rewardModel6.Description        = "test1231";
            rewardModel6.RemainingUnits     = 90;
            rewardModel6.SmallImageURL      = "https://cdn4.iconfinder.com/data/icons/miu-square-flat-social/60/linkedin-square-social-media-128.png";
            rewardModel6.SmallImageClickURL = "https://cdn4.iconfinder.com/data/icons/miu-square-flat-social/60/linkedin-square-social-media-128.png";

            rewardList.Add(rewardModel1);
            rewardList.Add(rewardModel2);
            rewardList.Add(rewardModel3);
            rewardList.Add(rewardModel4);
            rewardList.Add(rewardModel5);
            rewardList.Add(rewardModel6);

            return(rewardList);
        }
 public MessangerRewardModel(object sender, RewardItemModel rewardItem, string categoryName = null) : base(sender)
 {
     RewardItem   = rewardItem;
     CategoryName = categoryName;
 }
        //public void Update(FeedItemModel feed)
        public void Update(UIView container, RewardResponseModel rewardResponse, RewardItemModel reward, RewardDetailViewController ctrl = null)
        {
            ResponseCode = rewardResponse?.ResponseCode ?? 0;
            Container    = container;
            Controller   = ctrl;

            UpdateFonts();

            //float backgroundToOverlayWidthRatio = 0.9227f;      //from spec
            //float backgroundToOverlayHegithRatio = 0.761f;

            //float backgroundToOverlayHegithRatio = 0.461f;
            nfloat width  = container.Frame.Width;
            nfloat height = width * 0.89f;                            //cell.Height;
            nfloat x      = (container.Frame.Width - width) / 2.0f;   //center in overlay
            nfloat y      = (container.Frame.Height - height) / 2.0f; //center in overlay

            Frame = new CGRect(x, y, width, height);

            CloseButton.TouchUpInside             += CloseAction;
            (Container as UIButton).TouchUpInside += CloseAction;

            apologizeLabel.Text = rewardResponse.ResponseCode > 0 ? "Congratulations, " : "Oh No, we`re sorry!";
            reasonLabel.Text    = rewardResponse.ResponseCode > 0 ? "You got this reward!" : "You did not get this reward...";

            MessageText.Text = !string.IsNullOrWhiteSpace(rewardResponse.ResponseMessage) ? rewardResponse.ResponseMessage
                : (rewardResponse.ResponseCode > 0 ? $"You spent {reward.MinScore} pts" : "There are no more units available");
            MessageText.Lines = 0;//can be 5 lines if email not confirmed

            if (rewardResponse.ResponseCode <= 0)
            {
                btnSeeOtherRewards.Hidden = false;
                btnSeeOtherRewards.SetTitle("See what other rewards you qualify for >", UIControlState.Normal);
                btnSeeOtherRewards.TouchUpInside += (object sender, EventArgs e) =>
                {
                    onViewClosed?.Invoke();
                    container.RemoveFromSuperview();
                    ctrl?.NavigationController.PopViewController(true);//go to rewards list
                };
            }

            EventImage.ContentMode     = UIViewContentMode.ScaleAspectFit;
            EventImage.BackgroundColor = UIColor.White; // Border Color

            double borderMultiplier  = 0.265;
            double contentMultiplier = 0.25;

            var borderMaskImageView = new UIImageView();

            borderMaskImageView.Image       = UIImage.FromBundle("Polygon-mask1");
            borderMaskImageView.Frame       = new CGRect(0, 0, container.Frame.Width * borderMultiplier, (container.Frame.Width * borderMultiplier) * 1.1);
            borderMaskImageView.ContentMode = UIViewContentMode.ScaleAspectFit;

            var contentMaskImageView = new UIImageView();

            contentMaskImageView.Image       = UIImage.FromBundle("Polygon-mask1");
            contentMaskImageView.Frame       = new CGRect(0, 0, container.Frame.Width * contentMultiplier, (container.Frame.Width * contentMultiplier) * 1.1);
            contentMaskImageView.ContentMode = UIViewContentMode.ScaleAspectFit;

            float startContentX = (float)(container.Frame.Width * borderMultiplier - container.Frame.Width * contentMultiplier) / 2;
            float startContentY = (float)((container.Frame.Width * borderMultiplier) * 1.1 - (container.Frame.Width * contentMultiplier) * 1.1) / 2;

            var profileImage = new UIImageView();

            //profileImage.Image = UIImage.FromBundle("CellImagePlaceholder"); //hardcode
            profileImage.BackgroundColor = UIColor.Gray;
            ImageService.Instance.LoadUrl(reward.MainImageURL).Into(profileImage);

            profileImage.ContentMode = UIViewContentMode.ScaleAspectFill;
            profileImage.MaskView    = contentMaskImageView;

            // Make a little bit smaller to show "border" image behind it
            profileImage.Frame = new CGRect(startContentX, startContentY, container.Frame.Width * contentMultiplier, (container.Frame.Width * contentMultiplier) * 1.1);

            EventImage.MaskView = borderMaskImageView;
            EventImage.AddSubview(profileImage);

            if (rewardResponse.ResponseCode > 0)
            {
                collectButton.Hidden         = false;
                collectButton.TouchUpInside += (object sender, EventArgs e) =>
                {
                    var webView = new WKWebView(ctrl.View.Frame, new WKWebViewConfiguration());
                    webView.NavigationDelegate = new NavDelegate(this);
                    Overlay = Platform.AddOverlay(ctrl.View, webView.Frame, UIColor.White, true, true, 0.1f);
                    webView.LoadRequest(new NSUrlRequest(new NSUrl("https://socialladder.rkiapps.com/SL/HelpDesk/RewardStatus?deviceUUID=" + SL.DeviceUUID + "&AreaGUID=" + SL.AreaGUID)));
                    ctrl.View.AddSubview(webView);

                    onViewClosed?.Invoke();
                    container.RemoveFromSuperview();
                };
            }
        }