Beispiel #1
0
        public virtual void SubmitChallengeComplete(UIButton button, ResponseModel response)
        {
            RemoveOverlay();
            Platform.AnimateRotationComplete(button);

            if (SubmitButtonImage != null)
            {
                button.SetBackgroundImage(SubmitButtonImage, UIControlState.Normal);
            }

            if (response != null)
            {
                UIView overlay = Platform.AddOverlay(response.ResponseCode > 0);
                if (overlay != null)
                {
                    ChallengeCompleteView challengeComplete = ChallengeCompleteView.Create();
                    overlay.AddSubview(challengeComplete);
                    if (response is ChallengeResponseModel)
                    {
                        challengeComplete.Update(overlay, response as ChallengeResponseModel, Challenge, this);
                    }
                    else if (response is ShareResponseModel)
                    {
                        challengeComplete.Update(overlay, response as ShareResponseModel, Challenge, this);
                    }

                    challengeComplete.TranslatesAutoresizingMaskIntoConstraints = false;
                    overlay.AddConstraint(ChallengesConstraints.ChallengesCollectionCellCenterXConstraint(challengeComplete, overlay));
                    overlay.AddConstraint(ChallengesConstraints.ChallengesConstantTopConstraint(challengeComplete, overlay, 0f));
                    overlay.AddConstraint(ChallengesConstraints.ChallengesCollectionCellWidthConstraint(challengeComplete, overlay, 0.94f));
                    overlay.AddConstraint(ChallengesConstraints.ChallengesCollectionCellHeightConstraint(challengeComplete, overlay, 0.81f));
                }
            }
        }
        /*
         * public override void LoadChallengeData()
         * {
         *  base.LoadChallengeData();
         *
         *  SL.Manager.RefreshChallengeDetail(Challenge.ChallengeDetailsURL, Refresh);
         * }
         */

        public override void ViewWillAppear(bool animated)
        {
            base.ViewWillAppear(animated);

            //LoadChallengeData();

            CheckInCollectionView.TranslatesAutoresizingMaskIntoConstraints = false;
            CheckInCollectionView.RemoveConstraint(CheckInCollectionViewAspect);
            CheckInCollectionView.AddConstraint(ChallengesConstraints.ChallengesConstantHeightConstraint(CheckInCollectionView, 0f));

            //   CollectionViewsDescription.Font = PointText.Font = UIFont.FromName("ProximaNova-Regular", SizeConstants.Screen.Width * 0.035f);
            //Overlay = Platform.AddCover(View);

            /*
             * Overlay = Platform.AddOverlay(View.Frame, UIColor.White, true);
             * if (Overlay != null)
             * {
             *  nfloat w = Overlay.Frame.Width;//View.Frame.Width;//UIScreen.MainScreen.Bounds.Width;
             *  nfloat h = Overlay.Frame.Height;//View.Frame.Height;//UIScreen.MainScreen.Bounds.Height;
             *  nfloat s = w * 0.2f;
             *  UIImageView progress = new UIImageView(new CGRect((w - s) / 2.0f, ((h - s) / 2.0f), s, s));
             *  progress.Image = UIImage.FromBundle("loading-indicator");
             *  Overlay.AddSubview(progress);
             *  Platform.AnimateRotation(progress);
             * }
             */
            //SL.Manager.RefreshChallengeDetail(Challenge.ChallengeDetailsURL, Refresh);
        }
 public override void ViewWillAppear(bool animated)
 {
     base.ViewWillAppear(animated);
     InstaCollectionView.TranslatesAutoresizingMaskIntoConstraints = false;
     InstaCollectionView.RemoveConstraint(InstaCollectionViewAspect);
     InstaCollectionView.AddConstraint(ChallengesConstraints.ChallengesConstantHeightConstraint(InstaCollectionView, 0f));
     PointsImage.Image = null;
     PointsText.Text   = string.Empty;
 }
        public override void ViewWillAppear(bool animated)
        {
            base.ViewWillAppear(animated);

            SL.Manager.RefreshShareTemplate(Challenge.ShareTemplateURL, ShareTemplateRefreshed);

            //LoadChallengeData();

            FBCollectionView.TranslatesAutoresizingMaskIntoConstraints = false;
            FBCollectionView.RemoveConstraint(FBCollectionViewAspect);
            FBCollectionView.AddConstraint(ChallengesConstraints.ChallengesConstantHeightConstraint(FBCollectionView, 0f));
        }
Beispiel #5
0
        public override void ViewDidLoad()
        {
            Crashlytics.Instance.Log("Challenges_ChallengeDetailViewController_ViewDidLoad()");

            base.ViewDidLoad();

            Reset();
            SetupFonts();
            _messageService = new PlatformServices.SmsService();
            ImageService.Instance.LoadUrl(Challenge.Image).Into(ChallengeImage);
            ChallengeTextLbl.Text = Challenge.Name;
            TimeText.Text         = Challenge.NextEventCountDown;

            if (Challenge.TypeCode == "SHARE")
            {
                SubmitButton.SetBackgroundImage(UIImage.FromBundle("challenge-btn_share"), UIControlState.Normal);
            }
            else if (Challenge.TypeCode == "INVITE")
            {
                SubmitButton.SetBackgroundImage(UIImage.FromBundle("challenge-btn_itb"), UIControlState.Normal);
            }
            else if (new List <string> {
                "POSTERING", "COLLATERAL TRACKING", "FLYERING", "MANUAL"
            }.Contains(Challenge.TypeCode))                                                                                     //else if (Challenge.TypeCode == "COLLATERAL TRACKING" && Challenge.TypeCodeDisplayName == "Postering")
            {
                SubmitButton.SetBackgroundImage(UIImage.FromBundle("challenge-btn_photo"), UIControlState.Normal);
                SetupCollateral();
            }
            else if (Challenge.TypeCode == "FB ENGAGEMENT")
            {
                SubmitButton.SetBackgroundImage(UIImage.FromBundle("challenge-btn_fb"), UIControlState.Normal);
            }

            DetailCollectionView.TranslatesAutoresizingMaskIntoConstraints = false;
            DetailCollectionView.RemoveConstraint(DetailCollectionViewAspect);
            DetailCollectionView.AddConstraint(ChallengesConstraints.ChallengesConstantHeightConstraint(DetailCollectionView, 0f));

            NSString viewportScriptString = (NSString)"var meta = document.createElement('meta'); meta.setAttribute('name', 'viewport'); meta.setAttribute('content', 'width=500'); meta.setAttribute('initial-scale', '1.0'); meta.setAttribute('maximum-scale', '1.0'); meta.setAttribute('minimum-scale', '1.0'); meta.setAttribute('user-scalable', 'no'); document.getElementsByTagName('head')[0].appendChild(meta);";

            WebView.Configuration.UserContentController.AddUserScript(new WKUserScript(source: viewportScriptString, injectionTime: WKUserScriptInjectionTime.AtDocumentEnd, isForMainFrameOnly: true));

            WebView.ScrollView.ScrollEnabled            = false;
            WebView.ScrollView.Bounces                  = false;
            WebView.AllowsBackForwardNavigationGestures = false;
            Platform.ClearBrowserCache();
        }
        public void UpdateItem(nfloat constraintSize)
        {
            Background.TranslatesAutoresizingMaskIntoConstraints = false;
            List <NSLayoutConstraint> constants = new List <NSLayoutConstraint>();

            foreach (var constraint in ContentView.Constraints)
            {
                if (constraint.FirstAttribute == NSLayoutAttribute.Width || constraint.FirstAttribute == NSLayoutAttribute.Height || constraint.FirstAttribute == NSLayoutAttribute.CenterX || constraint.FirstAttribute == NSLayoutAttribute.CenterY)
                {
                    constants.Add(constraint);
                }
            }
            ContentView.RemoveConstraints(constants.ToArray());
            ContentView.AddConstraint(ChallengesConstraints.ChallengesCollectionCellCenterXConstraint(Background, ContentView));
            ContentView.AddConstraint(ChallengesConstraints.ChallengesCollectionCellCenterYConstraint(Background, ContentView));
            ContentView.AddConstraint(ChallengesConstraints.ChallengesCollectionCellWidthConstraint(Background, ContentView, constraintSize));
            ContentView.AddConstraint(ChallengesConstraints.ChallengesCollectionCellHeightConstraint(Background, ContentView, constraintSize));
        }