Exemplo n.º 1
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();
        }
        void ReleaseDesignerOutlets()
        {
            if (AspectHeight != null)
            {
                AspectHeight.Dispose();
                AspectHeight = null;
            }

            if (ChallengeImage != null)
            {
                ChallengeImage.Dispose();
                ChallengeImage = null;
            }

            if (ChallengeTextLbl != null)
            {
                ChallengeTextLbl.Dispose();
                ChallengeTextLbl = null;
            }

            if (cnImagePlaceholderAspect != null)
            {
                cnImagePlaceholderAspect.Dispose();
                cnImagePlaceholderAspect = null;
            }

            if (cnImagesCountHeight != null)
            {
                cnImagesCountHeight.Dispose();
                cnImagesCountHeight = null;
            }

            if (cnMapPlaceholderAspect != null)
            {
                cnMapPlaceholderAspect.Dispose();
                cnMapPlaceholderAspect = null;
            }

            if (cnMarginCount != null)
            {
                cnMarginCount.Dispose();
                cnMarginCount = null;
            }

            if (cnsMapTop1 != null)
            {
                cnsMapTop1.Dispose();
                cnsMapTop1 = null;
            }

            if (cnsWebViewHeight != null)
            {
                cnsWebViewHeight.Dispose();
                cnsWebViewHeight = null;
            }

            if (CountChallengeLbl != null)
            {
                CountChallengeLbl.Dispose();
                CountChallengeLbl = null;
            }

            if (DetailCollectionView != null)
            {
                DetailCollectionView.Dispose();
                DetailCollectionView = null;
            }

            if (DetailCollectionViewAspect != null)
            {
                DetailCollectionViewAspect.Dispose();
                DetailCollectionViewAspect = null;
            }

            if (MapViewBase != null)
            {
                MapViewBase.Dispose();
                MapViewBase = null;
            }

            if (NeedUploadCountText1 != null)
            {
                NeedUploadCountText1.Dispose();
                NeedUploadCountText1 = null;
            }

            if (paddingMap != null)
            {
                paddingMap.Dispose();
                paddingMap = null;
            }

            if (PointsImage != null)
            {
                PointsImage.Dispose();
                PointsImage = null;
            }

            if (PointsText != null)
            {
                PointsText.Dispose();
                PointsText = null;
            }

            if (ScrollContent != null)
            {
                ScrollContent.Dispose();
                ScrollContent = null;
            }

            if (ScrollView != null)
            {
                ScrollView.Dispose();
                ScrollView = null;
            }

            if (SubmitButton != null)
            {
                SubmitButton.Dispose();
                SubmitButton = null;
            }

            if (TimeText != null)
            {
                TimeText.Dispose();
                TimeText = null;
            }

            if (UploadedCountText1 != null)
            {
                UploadedCountText1.Dispose();
                UploadedCountText1 = null;
            }

            if (vImagePlaceholder != null)
            {
                vImagePlaceholder.Dispose();
                vImagePlaceholder = null;
            }

            if (vImagesCount != null)
            {
                vImagesCount.Dispose();
                vImagesCount = null;
            }

            if (WebView != null)
            {
                WebView.Dispose();
                WebView = null;
            }
        }