Ejemplo n.º 1
0
        public void BuildList()
        {
            var doUpper       = Device.RuntimePlatform != Device.Android;
            var autofillItems = new List <SettingsPageListItem>();

            if (Device.RuntimePlatform == Device.Android)
            {
                if (_deviceActionService.SupportsAutofillService())
                {
                    autofillItems.Add(new SettingsPageListItem
                    {
                        Name     = AppResources.AutofillService,
                        SubLabel = _deviceActionService.AutofillServiceEnabled() ?
                                   AppResources.Enabled : AppResources.Disabled
                    });
                }

                var accessibilityEnabled = _deviceActionService.AutofillAccessibilityServiceRunning() &&
                                           _deviceActionService.AutofillAccessibilityOverlayPermitted();
                autofillItems.Add(new SettingsPageListItem
                {
                    Name     = AppResources.AutofillAccessibilityService,
                    SubLabel = accessibilityEnabled ?
                               AppResources.Enabled : AppResources.Disabled
                });
            }
            else
            {
                if (_deviceActionService.SystemMajorVersion() >= 12)
                {
                    autofillItems.Add(new SettingsPageListItem {
                        Name = AppResources.PasswordAutofill
                    });
                }
                autofillItems.Add(new SettingsPageListItem {
                    Name = AppResources.AppExtension
                });
            }
            var manageItems = new List <SettingsPageListItem>
            {
                new SettingsPageListItem {
                    Name = AppResources.Folders
                },
                new SettingsPageListItem {
                    Name = AppResources.Sync, SubLabel = _lastSyncDate
                }
            };
            var securityItems = new List <SettingsPageListItem>
            {
                new SettingsPageListItem {
                    Name = AppResources.LockOptions, SubLabel = _lockOptionValue
                },
                new SettingsPageListItem
                {
                    Name     = AppResources.UnlockWithPIN,
                    SubLabel = _pin ? AppResources.Enabled : AppResources.Disabled
                },
                new SettingsPageListItem {
                    Name = AppResources.LockNow
                },
                new SettingsPageListItem {
                    Name = AppResources.TwoStepLogin
                }
            };

            if (_supportsFingerprint || _fingerprint)
            {
                var fingerprintName = AppResources.Fingerprint;
                if (Device.RuntimePlatform == Device.iOS)
                {
                    fingerprintName = _deviceActionService.SupportsFaceBiometric() ? AppResources.FaceID :
                                      AppResources.TouchID;
                }
                else if (Device.RuntimePlatform == Device.Android && _deviceActionService.UseNativeBiometric())
                {
                    fingerprintName = AppResources.Biometrics;
                }
                var item = new SettingsPageListItem
                {
                    Name     = string.Format(AppResources.UnlockWith, fingerprintName),
                    SubLabel = _fingerprint ? AppResources.Enabled : AppResources.Disabled
                };
                securityItems.Insert(1, item);
            }
            var accountItems = new List <SettingsPageListItem>
            {
                new SettingsPageListItem {
                    Name = AppResources.ChangeMasterPassword
                },
                new SettingsPageListItem {
                    Name = AppResources.FingerprintPhrase
                },
                new SettingsPageListItem {
                    Name = AppResources.LogOut
                }
            };
            var toolsItems = new List <SettingsPageListItem>
            {
                new SettingsPageListItem {
                    Name = AppResources.ImportItems
                },
                new SettingsPageListItem {
                    Name = AppResources.ExportVault
                },
                new SettingsPageListItem {
                    Name = AppResources.ShareVault
                },
                new SettingsPageListItem {
                    Name = AppResources.WebVault
                }
            };
            var otherItems = new List <SettingsPageListItem>
            {
                new SettingsPageListItem {
                    Name = AppResources.Options
                },
                new SettingsPageListItem {
                    Name = AppResources.About
                },
                new SettingsPageListItem {
                    Name = AppResources.HelpAndFeedback
                },
                new SettingsPageListItem {
                    Name = AppResources.RateTheApp
                }
            };

            GroupedItems.ResetWithRange(new List <SettingsPageListGroup>
            {
                new SettingsPageListGroup(autofillItems, AppResources.Autofill, doUpper, true),
                new SettingsPageListGroup(manageItems, AppResources.Manage, doUpper),
                new SettingsPageListGroup(securityItems, AppResources.Security, doUpper),
                new SettingsPageListGroup(accountItems, AppResources.Account, doUpper),
                new SettingsPageListGroup(toolsItems, AppResources.Tools, doUpper),
                new SettingsPageListGroup(otherItems, AppResources.Other, doUpper)
            });
        }