Esempio n. 1
0
            public FieldViewCell(VaultViewLoginPage page, VaultViewLoginPageModel.Field field, bool?a, bool?b)
                : base(field.Name, field.MaskedValue, string.Empty, AppResources.Copy)
            {
                Value.FontFamily = Helpers.OnPlatform(iOS: "Menlo-Regular",
                                                      Android: "monospace", WinPhone: "Courier");
                if (Device.RuntimePlatform == Device.iOS)
                {
                    Button1.Margin = new Thickness(10, 0);
                }

                Button1.WidthRequest = 40;
                Button1.Image        = "eye";
                Button1.Command      = new Command(() =>
                {
                    field.Revealed = !field.Revealed;
                    if (field.Revealed)
                    {
                        Button1.Image = "eye_slash";
                        Value.Text    = field.Value;
                    }
                    else
                    {
                        Button1.Image = "eye";
                        Value.Text    = field.MaskedValue;
                    }
                });

                Init(page, field, Button2);
            }
Esempio n. 2
0
 public EditLoginToolBarItem(VaultViewLoginPage page, string loginId)
 {
     _page       = page;
     _loginId    = loginId;
     Text        = AppResources.Edit;
     ClickAction = async() => await ClickedItem();
 }
Esempio n. 3
0
 public EditLoginToolBarItem(VaultViewLoginPage page, string loginId)
 {
     _page    = page;
     _loginId = loginId;
     Text     = AppResources.Edit;
     Clicked += ClickedItem;
 }
Esempio n. 4
0
 private void Init(VaultViewLoginPage page, VaultViewLoginPageModel.Field field, ExtendedButton copyButton)
 {
     Value.LineBreakMode = LineBreakMode.WordWrap;
     if (copyButton != null)
     {
         copyButton.Command      = new Command(() => page.Copy(field.Value, field.Name));
         copyButton.WidthRequest = 59;
     }
 }
Esempio n. 5
0
        private async void MoreClickedAsync(VaultListPageModel.Login login)
        {
            var buttons = new List <string> {
                AppResources.View, AppResources.Edit
            };

            if (!string.IsNullOrWhiteSpace(login.Password.Value))
            {
                buttons.Add(AppResources.CopyPassword);
            }
            if (!string.IsNullOrWhiteSpace(login.Username))
            {
                buttons.Add(AppResources.CopyUsername);
            }
            if (!string.IsNullOrWhiteSpace(login.Uri.Value) && (login.Uri.Value.StartsWith("http://") ||
                                                                login.Uri.Value.StartsWith("https://")))
            {
                buttons.Add(AppResources.GoToWebsite);
            }

            var selection = await DisplayActionSheet(login.Name, AppResources.Cancel, null, buttons.ToArray());

            if (selection == AppResources.View)
            {
                var page = new VaultViewLoginPage(login.Id);
                await Navigation.PushForDeviceAsync(page);
            }
            else if (selection == AppResources.Edit)
            {
                var page = new VaultEditLoginPage(login.Id);
                await Navigation.PushForDeviceAsync(page);
            }
            else if (selection == AppResources.CopyPassword)
            {
                Copy(login.Password.Value, AppResources.Password);
            }
            else if (selection == AppResources.CopyUsername)
            {
                Copy(login.Username, AppResources.Username);
            }
            else if (selection == AppResources.GoToWebsite)
            {
                Device.OpenUri(new Uri(login.Uri.Value));
            }
        }
Esempio n. 6
0
        private async void LoginSelected(object sender, SelectedItemChangedEventArgs e)
        {
            var login = e.SelectedItem as VaultListPageModel.Login;

            if (login == null)
            {
                return;
            }

            string selection = null;

            if (!string.IsNullOrWhiteSpace(Uri))
            {
                selection = await DisplayActionSheet(AppResources.AutofillOrView, AppResources.Cancel, null,
                                                     AppResources.Autofill, AppResources.View);
            }

            if (selection == AppResources.View || string.IsNullOrWhiteSpace(Uri))
            {
                var page = new VaultViewLoginPage(login.Id);
                await Navigation.PushForDeviceAsync(page);
            }
            else if (selection == AppResources.Autofill)
            {
                if (_deviceInfoService.Version < 21)
                {
                    MoreClickedAsync(login);
                }
                else
                {
                    _googleAnalyticsService.TrackExtensionEvent("AutoFilled", Uri.StartsWith("http") ? "Website" : "App");
                    MessagingCenter.Send(Application.Current, "Autofill", login);
                }
            }

            ((ListView)sender).SelectedItem = null;
        }
Esempio n. 7
0
 private async void LoginSelected(object sender, SelectedItemChangedEventArgs e)
 {
     var login = e.SelectedItem as VaultListPageModel.Login;
     var page  = new VaultViewLoginPage(login.Id);
     await Navigation.PushForDeviceAsync(page);
 }
Esempio n. 8
0
 public FieldViewCell(VaultViewLoginPage page, VaultViewLoginPageModel.Field field, bool?a)
     : base(field.Name, field.Value, AppResources.Copy)
 {
     Init(page, field, Button1);
 }
Esempio n. 9
0
 public FieldViewCell(VaultViewLoginPage page, VaultViewLoginPageModel.Field field)
     : base(field.Name, field.Value == "true" ? "✓" : "-")
 {
     Init(page, field, null);
 }