rename autofill pages

This commit is contained in:
Kyle Spearrin 2017-11-27 20:45:09 -05:00
parent 40b861acbe
commit 37ea84ffe9
4 changed files with 124 additions and 126 deletions

View file

@ -182,8 +182,8 @@
<Compile Include="Pages\Settings\SettingsEditFolderPage.cs" /> <Compile Include="Pages\Settings\SettingsEditFolderPage.cs" />
<Compile Include="Pages\Lock\LockFingerprintPage.cs" /> <Compile Include="Pages\Lock\LockFingerprintPage.cs" />
<Compile Include="Pages\Settings\SettingsAboutPage.cs" /> <Compile Include="Pages\Settings\SettingsAboutPage.cs" />
<Compile Include="Pages\Tools\ToolsAutofillServicePage2.cs" />
<Compile Include="Pages\Tools\ToolsAutofillServicePage.cs" /> <Compile Include="Pages\Tools\ToolsAutofillServicePage.cs" />
<Compile Include="Pages\Tools\ToolsAccessibilityServicePage.cs" />
<Compile Include="Pages\Tools\ToolsExtensionPage.cs" /> <Compile Include="Pages\Tools\ToolsExtensionPage.cs" />
<Compile Include="Pages\Tools\ToolsPasswordGeneratorSettingsPage.cs" /> <Compile Include="Pages\Tools\ToolsPasswordGeneratorSettingsPage.cs" />
<Compile Include="Pages\Tools\ToolsPasswordGeneratorPage.cs" /> <Compile Include="Pages\Tools\ToolsPasswordGeneratorPage.cs" />

View file

@ -4,17 +4,18 @@ using Xamarin.Forms;
using XLabs.Ioc; using XLabs.Ioc;
using Bit.App.Abstractions; using Bit.App.Abstractions;
using Bit.App.Resources; using Bit.App.Resources;
using FFImageLoading.Forms;
namespace Bit.App.Pages namespace Bit.App.Pages
{ {
public class ToolsAutofillServicePage2 : ExtendedContentPage public class ToolsAccessibilityServicePage : ExtendedContentPage
{ {
private readonly IGoogleAnalyticsService _googleAnalyticsService; private readonly IGoogleAnalyticsService _googleAnalyticsService;
private readonly IAppInfoService _appInfoService; private readonly IAppInfoService _appInfoService;
private readonly IDeviceActionService _deviceActionService; private readonly IDeviceActionService _deviceActionService;
private bool _pageDisappeared = false; private bool _pageDisappeared = false;
public ToolsAutofillServicePage2() public ToolsAccessibilityServicePage()
{ {
_googleAnalyticsService = Resolver.Resolve<IGoogleAnalyticsService>(); _googleAnalyticsService = Resolver.Resolve<IGoogleAnalyticsService>();
_appInfoService = Resolver.Resolve<IAppInfoService>(); _appInfoService = Resolver.Resolve<IAppInfoService>();
@ -46,8 +47,7 @@ namespace Bit.App.Pages
HorizontalTextAlignment = TextAlignment.Center, HorizontalTextAlignment = TextAlignment.Center,
LineBreakMode = LineBreakMode.WordWrap, LineBreakMode = LineBreakMode.WordWrap,
FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label)), FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label)),
TextColor = Color.Black, TextColor = Color.Black
VerticalOptions = LayoutOptions.CenterAndExpand
}; };
var disabledFs = new FormattedString(); var disabledFs = new FormattedString();
@ -66,27 +66,93 @@ namespace Bit.App.Pages
HorizontalTextAlignment = TextAlignment.Center, HorizontalTextAlignment = TextAlignment.Center,
LineBreakMode = LineBreakMode.WordWrap, LineBreakMode = LineBreakMode.WordWrap,
FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label)), FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label)),
TextColor = Color.Black, TextColor = Color.Black
VerticalOptions = LayoutOptions.CenterAndExpand
}; };
var goButton = new ExtendedButton var step1Label = new Label
{ {
Text = AppResources.BitwardenAutofillServiceOpenAutofillSettings, Text = AppResources.BitwardenAutofillServiceStep1,
Command = new Command(() => HorizontalTextAlignment = TextAlignment.Center,
{ LineBreakMode = LineBreakMode.WordWrap,
_googleAnalyticsService.TrackAppEvent("OpenAutofillSettings"); FontSize = Device.GetNamedSize(NamedSize.Small, typeof(Label)),
_deviceActionService.OpenAutofillSettings(); TextColor = Color.Black
}), };
VerticalOptions = LayoutOptions.End,
HorizontalOptions = LayoutOptions.Fill, var step1Image = new CachedImage
Style = (Style)Application.Current.Resources["btn-primary"], {
FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Button)) Source = "accessibility_step1",
HorizontalOptions = LayoutOptions.Center,
Margin = new Thickness(0, 20, 0, 0),
WidthRequest = 300,
HeightRequest = 98
};
var step2Label = new Label
{
Text = AppResources.BitwardenAutofillServiceStep2,
HorizontalTextAlignment = TextAlignment.Center,
LineBreakMode = LineBreakMode.WordWrap,
FontSize = Device.GetNamedSize(NamedSize.Small, typeof(Label)),
TextColor = Color.Black
};
var step2Image = new CachedImage
{
Source = "accessibility_step2",
HorizontalOptions = LayoutOptions.Center,
Margin = new Thickness(0, 20, 0, 0),
WidthRequest = 300,
HeightRequest = 67
};
var stepsStackLayout = new StackLayout
{
Children = { statusDisabledLabel, step1Image, step1Label, step2Image, step2Label },
Orientation = StackOrientation.Vertical,
Spacing = 10,
VerticalOptions = LayoutOptions.CenterAndExpand,
HorizontalOptions = LayoutOptions.Center
};
var notificationsLabel = new Label
{
Text = AppResources.BitwardenAutofillServiceNotification,
HorizontalTextAlignment = TextAlignment.Center,
LineBreakMode = LineBreakMode.WordWrap,
FontSize = Device.GetNamedSize(NamedSize.Small, typeof(Label)),
TextColor = Color.Black
};
var tapNotificationImage = new CachedImage
{
Source = "accessibility_notification.png",
HorizontalOptions = LayoutOptions.Center,
Margin = new Thickness(0, 20, 0, 0),
WidthRequest = 300,
HeightRequest = 74
};
var tapNotificationIcon = new CachedImage
{
Source = "accessibility_notification_icon.png",
HorizontalOptions = LayoutOptions.Center,
Margin = new Thickness(0, 20, 0, 0),
WidthRequest = 300,
HeightRequest = 54
};
var notificationsStackLayout = new StackLayout
{
Children = { statusEnabledLabel, tapNotificationIcon, tapNotificationImage, notificationsLabel },
Orientation = StackOrientation.Vertical,
Spacing = 10,
VerticalOptions = LayoutOptions.CenterAndExpand,
HorizontalOptions = LayoutOptions.Center
}; };
DisabledStackLayout = new StackLayout DisabledStackLayout = new StackLayout
{ {
Children = { BuildServiceLabel(), statusDisabledLabel, goButton, BuildAccessibilityButton() }, Children = { BuildServiceLabel(), stepsStackLayout, BuildGoButton() },
Orientation = StackOrientation.Vertical, Orientation = StackOrientation.Vertical,
Spacing = 20, Spacing = 20,
Padding = new Thickness(20, 30), Padding = new Thickness(20, 30),
@ -95,7 +161,7 @@ namespace Bit.App.Pages
EnabledStackLayout = new StackLayout EnabledStackLayout = new StackLayout
{ {
Children = { BuildServiceLabel(), statusEnabledLabel, BuildAccessibilityButton() }, Children = { BuildServiceLabel(), notificationsStackLayout, BuildGoButton() },
Orientation = StackOrientation.Vertical, Orientation = StackOrientation.Vertical,
Spacing = 20, Spacing = 20,
Padding = new Thickness(20, 30), Padding = new Thickness(20, 30),
@ -111,7 +177,7 @@ namespace Bit.App.Pages
{ {
return false; return false;
} }
UpdateEnabled(); UpdateEnabled();
return true; return true;
}); });
@ -134,14 +200,14 @@ namespace Bit.App.Pages
private void UpdateEnabled() private void UpdateEnabled()
{ {
ScrollView.Content = _appInfoService.AutofillServiceEnabled ? EnabledStackLayout : DisabledStackLayout; ScrollView.Content = _appInfoService.AutofillAccessibilityServiceEnabled ? EnabledStackLayout : DisabledStackLayout;
} }
private Label BuildServiceLabel() private Label BuildServiceLabel()
{ {
return new Label return new Label
{ {
Text = AppResources.AutofillServiceDescription, Text = AppResources.AutofillAccessibilityDescription,
VerticalOptions = LayoutOptions.Start, VerticalOptions = LayoutOptions.Start,
HorizontalTextAlignment = TextAlignment.Center, HorizontalTextAlignment = TextAlignment.Center,
LineBreakMode = LineBreakMode.WordWrap, LineBreakMode = LineBreakMode.WordWrap,
@ -149,21 +215,19 @@ namespace Bit.App.Pages
}; };
} }
private ExtendedButton BuildAccessibilityButton() private ExtendedButton BuildGoButton()
{ {
return new ExtendedButton return new ExtendedButton
{ {
Text = AppResources.AutofillAccessibilityService, Text = AppResources.BitwardenAutofillServiceOpenAccessibilitySettings,
Command = new Command(async () => Command = new Command(() =>
{ {
await Navigation.PushAsync(new ToolsAutofillServicePage()); _googleAnalyticsService.TrackAppEvent("OpenAccessibilitySettings");
_deviceActionService.OpenAccessibilitySettings();
}), }),
VerticalOptions = LayoutOptions.End, VerticalOptions = LayoutOptions.End,
HorizontalOptions = LayoutOptions.Fill, HorizontalOptions = LayoutOptions.Fill,
Style = (Style)Application.Current.Resources["btn-primaryAccent"], Style = (Style)Application.Current.Resources["btn-primary"]
Uppercase = false,
BackgroundColor = Color.Transparent,
FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Button))
}; };
} }
} }

View file

@ -4,7 +4,6 @@ using Xamarin.Forms;
using XLabs.Ioc; using XLabs.Ioc;
using Bit.App.Abstractions; using Bit.App.Abstractions;
using Bit.App.Resources; using Bit.App.Resources;
using FFImageLoading.Forms;
namespace Bit.App.Pages namespace Bit.App.Pages
{ {
@ -47,7 +46,8 @@ namespace Bit.App.Pages
HorizontalTextAlignment = TextAlignment.Center, HorizontalTextAlignment = TextAlignment.Center,
LineBreakMode = LineBreakMode.WordWrap, LineBreakMode = LineBreakMode.WordWrap,
FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label)), FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label)),
TextColor = Color.Black TextColor = Color.Black,
VerticalOptions = LayoutOptions.CenterAndExpand
}; };
var disabledFs = new FormattedString(); var disabledFs = new FormattedString();
@ -66,93 +66,27 @@ namespace Bit.App.Pages
HorizontalTextAlignment = TextAlignment.Center, HorizontalTextAlignment = TextAlignment.Center,
LineBreakMode = LineBreakMode.WordWrap, LineBreakMode = LineBreakMode.WordWrap,
FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label)), FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label)),
TextColor = Color.Black TextColor = Color.Black,
VerticalOptions = LayoutOptions.CenterAndExpand
}; };
var step1Label = new Label var goButton = new ExtendedButton
{ {
Text = AppResources.BitwardenAutofillServiceStep1, Text = AppResources.BitwardenAutofillServiceOpenAutofillSettings,
HorizontalTextAlignment = TextAlignment.Center, Command = new Command(() =>
LineBreakMode = LineBreakMode.WordWrap, {
FontSize = Device.GetNamedSize(NamedSize.Small, typeof(Label)), _googleAnalyticsService.TrackAppEvent("OpenAutofillSettings");
TextColor = Color.Black _deviceActionService.OpenAutofillSettings();
}; }),
VerticalOptions = LayoutOptions.End,
var step1Image = new CachedImage HorizontalOptions = LayoutOptions.Fill,
{ Style = (Style)Application.Current.Resources["btn-primary"],
Source = "accessibility_step1", FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Button))
HorizontalOptions = LayoutOptions.Center,
Margin = new Thickness(0, 20, 0, 0),
WidthRequest = 300,
HeightRequest = 98
};
var step2Label = new Label
{
Text = AppResources.BitwardenAutofillServiceStep2,
HorizontalTextAlignment = TextAlignment.Center,
LineBreakMode = LineBreakMode.WordWrap,
FontSize = Device.GetNamedSize(NamedSize.Small, typeof(Label)),
TextColor = Color.Black
};
var step2Image = new CachedImage
{
Source = "accessibility_step2",
HorizontalOptions = LayoutOptions.Center,
Margin = new Thickness(0, 20, 0, 0),
WidthRequest = 300,
HeightRequest = 67
};
var stepsStackLayout = new StackLayout
{
Children = { statusDisabledLabel, step1Image, step1Label, step2Image, step2Label },
Orientation = StackOrientation.Vertical,
Spacing = 10,
VerticalOptions = LayoutOptions.CenterAndExpand,
HorizontalOptions = LayoutOptions.Center
};
var notificationsLabel = new Label
{
Text = AppResources.BitwardenAutofillServiceNotification,
HorizontalTextAlignment = TextAlignment.Center,
LineBreakMode = LineBreakMode.WordWrap,
FontSize = Device.GetNamedSize(NamedSize.Small, typeof(Label)),
TextColor = Color.Black
};
var tapNotificationImage = new CachedImage
{
Source = "accessibility_notification.png",
HorizontalOptions = LayoutOptions.Center,
Margin = new Thickness(0, 20, 0, 0),
WidthRequest = 300,
HeightRequest = 74
};
var tapNotificationIcon = new CachedImage
{
Source = "accessibility_notification_icon.png",
HorizontalOptions = LayoutOptions.Center,
Margin = new Thickness(0, 20, 0, 0),
WidthRequest = 300,
HeightRequest = 54
};
var notificationsStackLayout = new StackLayout
{
Children = { statusEnabledLabel, tapNotificationIcon, tapNotificationImage, notificationsLabel },
Orientation = StackOrientation.Vertical,
Spacing = 10,
VerticalOptions = LayoutOptions.CenterAndExpand,
HorizontalOptions = LayoutOptions.Center
}; };
DisabledStackLayout = new StackLayout DisabledStackLayout = new StackLayout
{ {
Children = { BuildServiceLabel(), stepsStackLayout, BuildGoButton() }, Children = { BuildServiceLabel(), statusDisabledLabel, goButton, BuildAccessibilityButton() },
Orientation = StackOrientation.Vertical, Orientation = StackOrientation.Vertical,
Spacing = 20, Spacing = 20,
Padding = new Thickness(20, 30), Padding = new Thickness(20, 30),
@ -161,7 +95,7 @@ namespace Bit.App.Pages
EnabledStackLayout = new StackLayout EnabledStackLayout = new StackLayout
{ {
Children = { BuildServiceLabel(), notificationsStackLayout, BuildGoButton() }, Children = { BuildServiceLabel(), statusEnabledLabel, BuildAccessibilityButton() },
Orientation = StackOrientation.Vertical, Orientation = StackOrientation.Vertical,
Spacing = 20, Spacing = 20,
Padding = new Thickness(20, 30), Padding = new Thickness(20, 30),
@ -177,7 +111,7 @@ namespace Bit.App.Pages
{ {
return false; return false;
} }
UpdateEnabled(); UpdateEnabled();
return true; return true;
}); });
@ -200,14 +134,14 @@ namespace Bit.App.Pages
private void UpdateEnabled() private void UpdateEnabled()
{ {
ScrollView.Content = _appInfoService.AutofillAccessibilityServiceEnabled ? EnabledStackLayout : DisabledStackLayout; ScrollView.Content = _appInfoService.AutofillServiceEnabled ? EnabledStackLayout : DisabledStackLayout;
} }
private Label BuildServiceLabel() private Label BuildServiceLabel()
{ {
return new Label return new Label
{ {
Text = AppResources.AutofillAccessibilityDescription, Text = AppResources.AutofillServiceDescription,
VerticalOptions = LayoutOptions.Start, VerticalOptions = LayoutOptions.Start,
HorizontalTextAlignment = TextAlignment.Center, HorizontalTextAlignment = TextAlignment.Center,
LineBreakMode = LineBreakMode.WordWrap, LineBreakMode = LineBreakMode.WordWrap,
@ -215,20 +149,20 @@ namespace Bit.App.Pages
}; };
} }
private ExtendedButton BuildGoButton() private ExtendedButton BuildAccessibilityButton()
{ {
return new ExtendedButton return new ExtendedButton
{ {
Text = AppResources.BitwardenAutofillServiceOpenAccessibilitySettings, Text = AppResources.AutofillAccessibilityService,
Command = new Command(() => Command = new Command(async () =>
{ {
_googleAnalyticsService.TrackAppEvent("OpenAccessibilitySettings"); await Navigation.PushAsync(new ToolsAccessibilityServicePage());
_deviceActionService.OpenAccessibilitySettings();
}), }),
VerticalOptions = LayoutOptions.End, VerticalOptions = LayoutOptions.End,
HorizontalOptions = LayoutOptions.Fill, HorizontalOptions = LayoutOptions.Fill,
Style = (Style)Application.Current.Resources["btn-primary"], Style = (Style)Application.Current.Resources["btn-primaryAccent"],
FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Button)) Uppercase = false,
BackgroundColor = Color.Transparent
}; };
} }
} }

View file

@ -122,11 +122,11 @@ namespace Bit.App.Pages
{ {
if(_deviceInfoService.AutofillServiceSupported) if(_deviceInfoService.AutofillServiceSupported)
{ {
Navigation.PushModalAsync(new ExtendedNavigationPage(new ToolsAutofillServicePage2())); Navigation.PushModalAsync(new ExtendedNavigationPage(new ToolsAutofillServicePage()));
} }
else else
{ {
Navigation.PushModalAsync(new ExtendedNavigationPage(new ToolsAutofillServicePage())); Navigation.PushModalAsync(new ExtendedNavigationPage(new ToolsAccessibilityServicePage()));
} }
} }