Exemple #1
0
        /// <summary>
        /// Check to make sure it is ok to autofill still on the current screen
        /// </summary>
        private bool NeedToAutofill(AutofillCredentials creds, string currentUriString)
        {
            if (creds == null)
            {
                return(false);
            }

            Uri lastUri, currentUri;

            if (Uri.TryCreate(creds.LastUri, UriKind.Absolute, out lastUri) &&
                Uri.TryCreate(currentUriString, UriKind.Absolute, out currentUri) &&
                lastUri.Host == currentUri.Host)
            {
                return(true);
            }

            return(false);
        }
Exemple #2
0
        protected override void OnActivityResult(int requestCode, [GeneratedEnum] Result resultCode, Intent data)
        {
            base.OnActivityResult(requestCode, resultCode, data);
            if (data == null)
            {
                LastCredentials = null;
                return;
            }

            try
            {
                if (data.GetStringExtra("canceled") != null)
                {
                    LastCredentials = null;
                }
                else
                {
                    var uri      = data.GetStringExtra("uri");
                    var username = data.GetStringExtra("username");
                    var password = data.GetStringExtra("password");

                    LastCredentials = new AutofillCredentials
                    {
                        Username = username,
                        Password = password,
                        Uri      = uri,
                        LastUri  = _lastQueriedUri
                    };
                }
            }
            catch
            {
                LastCredentials = null;
            }
            finally
            {
                Xamarin.Forms.MessagingCenter.Send(Xamarin.Forms.Application.Current, "SetMainPage");
                Finish();
            }
        }
        protected override void OnActivityResult(int requestCode, [GeneratedEnum] Result resultCode, Intent data)
        {
            base.OnActivityResult(requestCode, resultCode, data);
            if (data == null)
            {
                LastCredentials = null;
            }
            else
            {
                try
                {
                    if (data.GetStringExtra("canceled") != null)
                    {
                        LastCredentials = null;
                    }
                    else
                    {
                        var uri      = data.GetStringExtra("uri");
                        var username = data.GetStringExtra("username");
                        var password = data.GetStringExtra("password");

                        LastCredentials = new AutofillCredentials
                        {
                            Username = username,
                            Password = password,
                            Uri      = uri,
                            LastUri  = _lastQueriedUri
                        };
                    }
                }
                catch
                {
                    LastCredentials = null;
                }
            }

            Finish();
        }