コード例 #1
0
        public override void Refresh(ChallengeResponseModel response)
        {
            base.Refresh(response);

            if (response == null)
            {
                return;
            }

            CheckStatus(response.Challenge);
            Challenge          = response.Challenge;
            ChallengeText.Text = Challenge.Name;
            TimeText.Text      = Challenge.NextEventCountDown;
            HashText.Text      = Challenge.InstaCaption;

            var navigationDelegate = new ChallengeDetailWebViewNavigationDelegate();

            navigationDelegate.NavigationFinished += SetupConstraint;
            this.WebView.NavigationDelegate        = navigationDelegate;

            WebView.LoadHtmlString(Challenge.Desc, null);
            ImageService.Instance.LoadUrl(Challenge.Image).Into(ChallengeImage);

            HashText.Hidden       = false;
            HashBottomText.Hidden = false;
            HashText.Hidden       = false;
        }
コード例 #2
0
        public override void Refresh(ChallengeResponseModel response)
        {
            base.Refresh(response);

            if (response == null)
            {
                return;
            }

            Challenge          = response.Challenge;
            TimeText.Text      = Challenge.NextEventCountDown;
            PointsText.Text    = "+" + Challenge.PointValue.ToString() + " pts";
            ChallengeText.Text = Challenge.Name;
            ImageService.Instance.LoadUrl(Challenge.Image).Into(ChallengeImage);

            var navigationDelegate = new ChallengeDetailWebViewNavigationDelegate();

            navigationDelegate.NavigationFinished += SetupConstraint;
            this.WebView.NavigationDelegate        = navigationDelegate;
            WebView.LoadHtmlString(Challenge.Desc, null);

            TableView.ReloadData();

            if (response.Challenge.IsSurvey)
            {
                SelectAllThatApply.Text = "Select all that apply";
            }
            else
            {
                SelectAllThatApply.Text = "Select an answer below!";
            }
        }
コード例 #3
0
        public override void Refresh(ChallengeResponseModel challengeResponse)
        {
            Crashlytics.Instance.Log("ChallengeDetailViewController_Refresh()");
            base.Refresh(challengeResponse);

            if (challengeResponse == null)
            {
                return;
            }

            Challenge             = challengeResponse.Challenge;
            TimeText.Text         = Challenge.NextEventCountDown;
            PointsText.Text       = "+" + Challenge.PointValue.ToString() + " pts";
            ChallengeTextLbl.Text = Challenge.Name;

            var navigationDelegate = new ChallengeDetailWebViewNavigationDelegate();

            navigationDelegate.NavigationFinished += SetupConstraint;
            this.WebView.NavigationDelegate        = navigationDelegate;
            WebView.LoadHtmlString(Challenge.Desc, null);
            ImageService.Instance.LoadUrl(Challenge.Image).Into(ChallengeImage);

            if (!DidSetupMap && Challenge.LocationLat != null && Challenge.LocationLong != null)
            {
                ChallengeImage.Hidden = true;
                vImagePlaceholder.RemoveConstraint(cnImagePlaceholderAspect);
                vImagePlaceholder.AddConstraint(cnImagePlaceholderAspect = NSLayoutConstraint.Create(vImagePlaceholder, NSLayoutAttribute.Height, NSLayoutRelation.Equal, 1, 0));

                double radius = Challenge.RadiusMeters ?? 100.0;
                if (radius > 6000000)
                {
                    radius = 6000000;
                }
                double mapRegion = radius * 2.5;

                CLLocationCoordinate2D mapCoordinate = new CLLocationCoordinate2D(Challenge.LocationLat.Value, Challenge.LocationLong.Value);
                MapViewBase.SetRegion(MKCoordinateRegion.FromDistance(mapCoordinate, mapRegion, mapRegion), true);

                MKCircle circle = MKCircle.Circle(mapCoordinate, radius);
                MapViewBase.AddOverlay(circle);

                MKPointAnnotation annotation = new MKPointAnnotation();
                annotation.Coordinate = new CLLocationCoordinate2D(Challenge.LocationLat.Value, Challenge.LocationLong.Value);
                MapViewBase.AddAnnotation(annotation);

                DidSetupMap = true;
            }
            else
            {
                MapViewBase.Hidden = true;
                paddingMap.RemoveConstraint(cnMapPlaceholderAspect);
                paddingMap.AddConstraint(cnMapPlaceholderAspect = NSLayoutConstraint.Create(paddingMap, NSLayoutAttribute.Height, NSLayoutRelation.Equal, 1, 0));
            }

            CheckStatus();
        }
コード例 #4
0
        void SubmitResponse(ChallengeResponseModel challengeResponse)
        {
            SubmitChallengeComplete(SubmitButton, challengeResponse);

            //UIView overlay = Platform.AddOverlay(challengeResponse.ResponseCode > 0);  //from spec
            //if (overlay != null)
            //{
            //    ChallengeCompleteView challengeComplete = ChallengeCompleteView.Create();
            //    overlay.AddSubview(challengeComplete);
            //    challengeComplete.Update(overlay, challengeResponse, Challenge);
            //}
        }
コード例 #5
0
        public override void Refresh(ChallengeResponseModel challengeResponse)
        {
            Challenge = challengeResponse.Challenge;

            //NSAttributedString attributedString = new NSAttributedString(Challenge.TargetObjectURL, )
            //NSAttributedString attributedString = [[NSAttributedString alloc] initWithString: @"Google"
            //                                                           attributes:@{ NSLinkAttributeName: [NSURL URLWithString: @"http://www.google.com"] }];
            //self.textView.attributedText = attributedString;

            //LinkText.Text = Challenge.TargetObjectURL;

            //Platform.LinkText(LinkText, Challenge.TargetObjectURL);

            //RefreshShareTemplateIfNeeded();

            RemoveOverlay();
        }
コード例 #6
0
        public void SubmitContentResponse(ChallengeResponseModel challengeResponse = null)
        {
            if (challengeResponse != null)
            {
                Responses.Add(challengeResponse);
            }

            Challenge.CompletedCount = CompletedCount + (challengeResponse.ResponseCode > 0 ? 1 : 0);

            if (Responses.Count < ImagesAttach.Count && challengeResponse.ResponseMessage != "You completed that challenge!")
            {
                return;
            }

            /*
             * var errorResponces = Responses.FindAll((x) => x.ResponseCode <= 0);
             * if (errorResponces?.Count > 0)
             * {
             *  string message = String.Empty;
             *  int count = 0;
             *  foreach (var item in errorResponces)
             *  {
             *      message += $"{(++count).ToString()}) {item.ResponseMessage} \n\n";
             *  }
             *  new UIAlertView("Some images are not added", message, new UIAlertViewDelegate() as IUIAlertViewDelegate, "Ok").Show();
             * }
             */
            if (PosteringOverlay != null)
            {
                PosteringOverlay.RemoveFromSuperview();
                PosteringOverlay = null;
                Platform.AnimateRotationComplete(Spinner);
                Spinner.RemoveFromSuperview();
                Spinner = null;
            }

            if (CompletedCount >= TargetCount)//max responce
            {
                SubmitChallengeComplete(btnSubmitChallenge, challengeResponse);
            }
            else
            {
                SubmitChallengeComplete(btnSubmitChallenge, null);//remove overlay && animation
            }
            Responses.Clear();
        }
コード例 #7
0
        //public void Update(FeedItemModel feed)
        //public void Update(UIView container, ChallengeResponseModel challengeResponse, ChallengeModel challenge)
        public void Update(UIView container, ChallengeResponseModel challengeResponse, ChallengeModel challenge, ChallengeDetailBaseViewController ctrl = null)
        {
            ResponseCode = challengeResponse?.ResponseCode ?? 0;
            Controller   = ctrl;

            Container = container;
            (Container as UIButton).TouchUpInside += CloseAction;
            btnCloseBgBottom.TouchUpInside        += CloseAction;
            btnCloseBg.TouchUpInside += CloseAction;

            RoundImage.Image = UIImage.FromBundle("ScoreCircle");
            //Commit
            //CGRect cell = TableView.RectForRowAtIndexPath(NSIndexPath.FromIndex(0));
            float  backgroundToOverlayWidthRatio = 0.9227f;     //from spec
            nfloat width = container.Frame.Width * backgroundToOverlayWidthRatio;
            //float backgroundHeightToWidthRatio = 0.9529f;       //from spec
            //nfloat height = width * backgroundHeightToWidthRatio;
            nfloat height = TableView.Frame.Y + CellHeight + 200;     //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);

            //ChallengeImage.SetNeedsLayout();

            /*
             * TableView.Source = new FeedTableSource();
             * TableView.RowHeight = UITableView.AutomaticDimension;
             * TableView.EstimatedRowHeight = 130.0f;
             * TableView.ReloadData();
             */

            MessageText.Text = challengeResponse.ResponseMessage;
            if (challenge.CollateralReview ?? false)
            {
                PointsText.Text = String.Empty;
            }
            else
            {
                PointsText.Text = challengeResponse.ResponseCode > 0 && challenge.PointValue > 0 ? (challenge.CompPointValue + (challenge.PointsPerInstance * challenge.CompletedCount)) + " pts added to your account" : "";
            }

            AddTriangularView();
        }
コード例 #8
0
        public override void Refresh(ChallengeResponseModel challengeResponce)
        {
            base.Refresh(challengeResponce);

            if (challengeResponce == null)
            {
                return;
            }

            Challenge      = challengeResponce.Challenge;
            HeaderLbl.Text = Challenge.Name;
            //MainTextLable.Text = Challenge.Desc;
            TimeDisLbl.Text = Challenge.NextEventCountDown;

            var navigationDelegate = new ChallengeDetailWebViewNavigationDelegate();

            navigationDelegate.NavigationFinished += SetupConstraint;
            this.WebView.NavigationDelegate        = navigationDelegate;
            WebView.LoadHtmlString(Challenge.Desc, null);

            if (!DidSetupMap && Challenge.LocationLat != null && Challenge.LocationLong != null)
            {
                double radius = Challenge.RadiusMeters ?? 100.0;
                if (radius > 6000000)
                {
                    radius = 6000000;
                }
                double mapRegion = radius * 2.5;

                CLLocationCoordinate2D mapCoordinate = new CLLocationCoordinate2D(Challenge.LocationLat.Value, Challenge.LocationLong.Value);
                MapView.SetRegion(MKCoordinateRegion.FromDistance(mapCoordinate, mapRegion, mapRegion), true);

                MKCircle circle = MKCircle.Circle(mapCoordinate, radius);
                MapView.AddOverlay(circle);

                MKPointAnnotation annotation = new MKPointAnnotation();
                annotation.Coordinate = new CLLocationCoordinate2D(Challenge.LocationLat.Value, Challenge.LocationLong.Value);
                MapView.AddAnnotation(annotation);

                DidSetupMap = true;
            }
        }
コード例 #9
0
        public override void Refresh(ChallengeResponseModel challengeResponse)
        {
            base.Refresh(challengeResponse);

            if (challengeResponse == null)
            {
                return;
            }

            Challenge           = challengeResponse.Challenge;
            TimeLastLbl.Text    = Challenge.NextEventCountDown;
            CountPeopleLbl.Text = "+" + Challenge.PointValue.ToString() + " pts";
            HeaderTextLbl.Text  = Challenge.Name;

            var navigationDelegate = new ChallengeDetailWebViewNavigationDelegate();

            navigationDelegate.NavigationFinished += SetupConstraint;
            this.WebView.NavigationDelegate        = navigationDelegate;
            WebView.LoadHtmlString(Challenge.Desc, null);
            ImageService.Instance.LoadUrl(Challenge.Image).Into(ChallengesImage);
        }
コード例 #10
0
 public virtual void Refresh(ChallengeResponseModel response)
 {
     DidLoadChallengeData = true;
     RemoveOverlay();
 }
コード例 #11
0
 void RefreshChallengesComplete(ChallengeResponseModel response)
 {
     didRefreshChallenges = true;
     RefreshComplete();
 }
コード例 #12
0
 public void PostCheckInAndVerifyResponse(ChallengeResponseModel challengeResponse)
 {
     SubmitChallengeComplete(SubmitButton, challengeResponse);
 }
コード例 #13
0
 public void SubmitContentResponse(ChallengeResponseModel challengeResponse)
 {
     //ChallengeComplete(challengeResponse);
     SubmitChallengeComplete(CameraButton, challengeResponse);
 }
コード例 #14
0
 public void SubmitResponse(ChallengeResponseModel challengeResponse)
 {
     SubmitChallengeComplete(SubmitButton, challengeResponse);
 }