autofill rows on settings page

This commit is contained in:
Kyle Spearrin 2019-05-30 22:45:48 -04:00
parent e3dcf4aed1
commit b356627afd
3 changed files with 49 additions and 8 deletions

View file

@ -498,7 +498,7 @@ namespace Bit.Droid.Services
var manager = activity.GetSystemService(Context.ActivityService) as ActivityManager;
var services = manager.GetRunningServices(int.MaxValue);
return services.Any(s => s.Process.ToLowerInvariant().Contains("bitwarden") &&
s.Service.ClassName.ToLowerInvariant().Contains("autofill"));
s.Service.ClassName.ToLowerInvariant().Contains("accessibilityservice"));
}
public bool AutofillServiceEnabled()

View file

@ -1,21 +1,20 @@
using Bit.App.Resources;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Bit.App.Abstractions;
using Bit.App.Resources;
using Bit.Core.Utilities;
using Xamarin.Forms;
using Xamarin.Forms.Xaml;
namespace Bit.App.Pages
{
public partial class SettingsPage : BaseContentPage
{
private readonly IDeviceActionService _deviceActionService;
private SettingsPageViewModel _vm;
public SettingsPage()
{
InitializeComponent();
_deviceActionService = ServiceContainer.Resolve<IDeviceActionService>("deviceActionService");
_vm = BindingContext as SettingsPageViewModel;
_vm.Page = this;
}
@ -42,6 +41,22 @@ namespace Bit.App.Pages
{
await Navigation.PushModalAsync(new NavigationPage(new SyncPage()));
}
else if(item.Name == AppResources.AutofillAccessibilityService)
{
// await Navigation.PushModalAsync(new NavigationPage(new OptionsPage()));
}
else if(item.Name == AppResources.AutofillService)
{
// await Navigation.PushModalAsync(new NavigationPage(new OptionsPage()));
}
else if(item.Name == AppResources.PasswordAutofill)
{
// await Navigation.PushModalAsync(new NavigationPage(new OptionsPage()));
}
else if(item.Name == AppResources.AppExtension)
{
// await Navigation.PushModalAsync(new NavigationPage(new OptionsPage()));
}
else if(item.Name == AppResources.Options)
{
await Navigation.PushModalAsync(new NavigationPage(new OptionsPage()));

View file

@ -259,6 +259,31 @@ namespace Bit.App.Pages
private 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() ? "✓" : null
});
}
autofillItems.Add(new SettingsPageListItem
{
Name = AppResources.AutofillAccessibilityService,
SubLabel = _deviceActionService.AutofillAccessibilityServiceRunning() ? "✓" : null
});
}
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 },
@ -302,6 +327,7 @@ namespace Bit.App.Pages
};
GroupedItems.ResetWithRange(new List<SettingsPageListGroup>
{
new SettingsPageListGroup(autofillItems, AppResources.Autofill, doUpper),
new SettingsPageListGroup(manageItems, AppResources.Manage, doUpper),
new SettingsPageListGroup(securityItems, AppResources.Security, doUpper),
new SettingsPageListGroup(accountItems, AppResources.Account, doUpper),