private async void CipherSelected(object sender, SelectedItemChangedEventArgs e) { var cipher = e.SelectedItem as AutofillCipher; if (cipher == null) { return; } if (_deviceInfoService.Version < 21) { Helpers.CipherMoreClickedAsync(this, cipher, true); } else { bool doAutofill = true; if (cipher.Fuzzy) { doAutofill = await DisplayAlert(null, string.Format(AppResources.BitwardenAutofillServiceMatchConfirm, _name), AppResources.Yes, AppResources.No); } if (doAutofill) { GoogleAnalyticsService.TrackExtensionEvent("AutoFilled", Uri.StartsWith("http") ? "Website" : "App"); DeviceActionService.Autofill(cipher); } } ((ListView)sender).SelectedItem = null; }
private async void CipherSelected(object sender, SelectedItemChangedEventArgs e) { var cipher = e.SelectedItem as AutofillCipher; if (cipher == null) { return; } if (_deviceInfoService.Version < 21) { Helpers.CipherMoreClickedAsync(this, cipher, true); } else { var autofillResponse = AppResources.Yes; if (cipher.Fuzzy) { var options = new List <string> { AppResources.Yes }; if (cipher.Type == CipherType.Login && _connectivity.IsConnected) { options.Add(AppResources.YesAndSave); } autofillResponse = await DeviceActionService.DisplayAlertAsync(null, string.Format(AppResources.BitwardenAutofillServiceMatchConfirm, _name), AppResources.No, options.ToArray()); } if (autofillResponse == AppResources.YesAndSave && cipher.Type == CipherType.Login) { if (!_connectivity.IsConnected) { Helpers.AlertNoConnection(this); } else { var uris = cipher.CipherModel.Login?.Uris?.ToList(); if (uris == null) { uris = new List <LoginUri>(); } uris.Add(new LoginUri { Uri = Uri.Encrypt(cipher.CipherModel.OrganizationId), Match = null }); cipher.CipherModel.Login.Uris = uris; await DeviceActionService.ShowLoadingAsync(AppResources.Saving); var saveTask = await _cipherService.SaveAsync(cipher.CipherModel); await DeviceActionService.HideLoadingAsync(); if (saveTask.Succeeded) { GoogleAnalyticsService.TrackAppEvent("AddedLoginUriDuringAutofill"); } } } if (autofillResponse == AppResources.Yes || autofillResponse == AppResources.YesAndSave) { GoogleAnalyticsService.TrackExtensionEvent("AutoFilled", Uri.StartsWith("http") ? "Website" : "App"); DeviceActionService.Autofill(cipher); } } ((ListView)sender).SelectedItem = null; }