Beispiel #1
0
        private void OnNavigationStarting(WebView sender, WebViewNavigationStartingEventArgs args)
        {
            this.ResetErrorView();
            this.LoadingState = true;

            var isSignOutWorkflow = GoogleDomainsHelper.IsSignOutWorkflow(args.Uri);

            if (_customHttpHeaderSet && !isSignOutWorkflow)
            {
                _customHttpHeaderSet = false;
                return;
            }

            args.Cancel = true;
            if (isSignOutWorkflow)
            {
                var queryParams = new WwwFormUrlDecoder(args.Uri.Query);
                var uri         = new Uri(queryParams.GetFirstValueByName("continue"));
                UriHelper.ClearCookiesFor(uri);
                this.ManageUri(uri);
            }
            else
            {
                this.ManageUri(args.Uri);
            }
        }
Beispiel #2
0
        private void CheckUriAndUpdateStatusBar()
        {
            var isSearchUri = GoogleDomainsHelper.IsGoogleSearch(_capturedUri);

            if (_statusBar != null)
            {
                _statusBar.BackgroundColor = isSearchUri
                    ? Constants.GoogleStatusBarBackgroundColor
                    : Colors.White;
            }

            this.HomeButtonEnabled = isSearchUri;
            this.BackButtonEnabled = _webView.CanGoBack;
        }
Beispiel #3
0
        public async void ManageUri(Uri uri)
        {
            _capturedUri = uri;

            var isGoogleUri     = GoogleDomainsHelper.IsGoogleUri(_capturedUri);
            var isGoogleService = GoogleDomainsHelper.IsGoogleService(_capturedUri);

            if (!isGoogleUri || isGoogleService)
            {
                this.LoadingState = false;
                await Launcher.LaunchUriAsync(_capturedUri);
            }
            else
            {
                OnNavigate(this);
            }
        }