mirror of
https://github.com/bitwarden/android.git
synced 2024-12-24 01:48:25 +03:00
rename autofill pages
This commit is contained in:
parent
40b861acbe
commit
37ea84ffe9
4 changed files with 124 additions and 126 deletions
|
@ -182,8 +182,8 @@
|
|||
<Compile Include="Pages\Settings\SettingsEditFolderPage.cs" />
|
||||
<Compile Include="Pages\Lock\LockFingerprintPage.cs" />
|
||||
<Compile Include="Pages\Settings\SettingsAboutPage.cs" />
|
||||
<Compile Include="Pages\Tools\ToolsAutofillServicePage2.cs" />
|
||||
<Compile Include="Pages\Tools\ToolsAutofillServicePage.cs" />
|
||||
<Compile Include="Pages\Tools\ToolsAccessibilityServicePage.cs" />
|
||||
<Compile Include="Pages\Tools\ToolsExtensionPage.cs" />
|
||||
<Compile Include="Pages\Tools\ToolsPasswordGeneratorSettingsPage.cs" />
|
||||
<Compile Include="Pages\Tools\ToolsPasswordGeneratorPage.cs" />
|
||||
|
|
|
@ -4,17 +4,18 @@ using Xamarin.Forms;
|
|||
using XLabs.Ioc;
|
||||
using Bit.App.Abstractions;
|
||||
using Bit.App.Resources;
|
||||
using FFImageLoading.Forms;
|
||||
|
||||
namespace Bit.App.Pages
|
||||
{
|
||||
public class ToolsAutofillServicePage2 : ExtendedContentPage
|
||||
public class ToolsAccessibilityServicePage : ExtendedContentPage
|
||||
{
|
||||
private readonly IGoogleAnalyticsService _googleAnalyticsService;
|
||||
private readonly IAppInfoService _appInfoService;
|
||||
private readonly IDeviceActionService _deviceActionService;
|
||||
private bool _pageDisappeared = false;
|
||||
|
||||
public ToolsAutofillServicePage2()
|
||||
public ToolsAccessibilityServicePage()
|
||||
{
|
||||
_googleAnalyticsService = Resolver.Resolve<IGoogleAnalyticsService>();
|
||||
_appInfoService = Resolver.Resolve<IAppInfoService>();
|
||||
|
@ -46,8 +47,7 @@ namespace Bit.App.Pages
|
|||
HorizontalTextAlignment = TextAlignment.Center,
|
||||
LineBreakMode = LineBreakMode.WordWrap,
|
||||
FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label)),
|
||||
TextColor = Color.Black,
|
||||
VerticalOptions = LayoutOptions.CenterAndExpand
|
||||
TextColor = Color.Black
|
||||
};
|
||||
|
||||
var disabledFs = new FormattedString();
|
||||
|
@ -66,27 +66,93 @@ namespace Bit.App.Pages
|
|||
HorizontalTextAlignment = TextAlignment.Center,
|
||||
LineBreakMode = LineBreakMode.WordWrap,
|
||||
FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label)),
|
||||
TextColor = Color.Black,
|
||||
VerticalOptions = LayoutOptions.CenterAndExpand
|
||||
TextColor = Color.Black
|
||||
};
|
||||
|
||||
var goButton = new ExtendedButton
|
||||
var step1Label = new Label
|
||||
{
|
||||
Text = AppResources.BitwardenAutofillServiceOpenAutofillSettings,
|
||||
Command = new Command(() =>
|
||||
{
|
||||
_googleAnalyticsService.TrackAppEvent("OpenAutofillSettings");
|
||||
_deviceActionService.OpenAutofillSettings();
|
||||
}),
|
||||
VerticalOptions = LayoutOptions.End,
|
||||
HorizontalOptions = LayoutOptions.Fill,
|
||||
Style = (Style)Application.Current.Resources["btn-primary"],
|
||||
FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Button))
|
||||
Text = AppResources.BitwardenAutofillServiceStep1,
|
||||
HorizontalTextAlignment = TextAlignment.Center,
|
||||
LineBreakMode = LineBreakMode.WordWrap,
|
||||
FontSize = Device.GetNamedSize(NamedSize.Small, typeof(Label)),
|
||||
TextColor = Color.Black
|
||||
};
|
||||
|
||||
var step1Image = new CachedImage
|
||||
{
|
||||
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
|
||||
{
|
||||
Children = { BuildServiceLabel(), statusDisabledLabel, goButton, BuildAccessibilityButton() },
|
||||
Children = { BuildServiceLabel(), stepsStackLayout, BuildGoButton() },
|
||||
Orientation = StackOrientation.Vertical,
|
||||
Spacing = 20,
|
||||
Padding = new Thickness(20, 30),
|
||||
|
@ -95,7 +161,7 @@ namespace Bit.App.Pages
|
|||
|
||||
EnabledStackLayout = new StackLayout
|
||||
{
|
||||
Children = { BuildServiceLabel(), statusEnabledLabel, BuildAccessibilityButton() },
|
||||
Children = { BuildServiceLabel(), notificationsStackLayout, BuildGoButton() },
|
||||
Orientation = StackOrientation.Vertical,
|
||||
Spacing = 20,
|
||||
Padding = new Thickness(20, 30),
|
||||
|
@ -111,7 +177,7 @@ namespace Bit.App.Pages
|
|||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
UpdateEnabled();
|
||||
return true;
|
||||
});
|
||||
|
@ -134,14 +200,14 @@ namespace Bit.App.Pages
|
|||
|
||||
private void UpdateEnabled()
|
||||
{
|
||||
ScrollView.Content = _appInfoService.AutofillServiceEnabled ? EnabledStackLayout : DisabledStackLayout;
|
||||
ScrollView.Content = _appInfoService.AutofillAccessibilityServiceEnabled ? EnabledStackLayout : DisabledStackLayout;
|
||||
}
|
||||
|
||||
private Label BuildServiceLabel()
|
||||
{
|
||||
return new Label
|
||||
{
|
||||
Text = AppResources.AutofillServiceDescription,
|
||||
Text = AppResources.AutofillAccessibilityDescription,
|
||||
VerticalOptions = LayoutOptions.Start,
|
||||
HorizontalTextAlignment = TextAlignment.Center,
|
||||
LineBreakMode = LineBreakMode.WordWrap,
|
||||
|
@ -149,21 +215,19 @@ namespace Bit.App.Pages
|
|||
};
|
||||
}
|
||||
|
||||
private ExtendedButton BuildAccessibilityButton()
|
||||
private ExtendedButton BuildGoButton()
|
||||
{
|
||||
return new ExtendedButton
|
||||
{
|
||||
Text = AppResources.AutofillAccessibilityService,
|
||||
Command = new Command(async () =>
|
||||
Text = AppResources.BitwardenAutofillServiceOpenAccessibilitySettings,
|
||||
Command = new Command(() =>
|
||||
{
|
||||
await Navigation.PushAsync(new ToolsAutofillServicePage());
|
||||
_googleAnalyticsService.TrackAppEvent("OpenAccessibilitySettings");
|
||||
_deviceActionService.OpenAccessibilitySettings();
|
||||
}),
|
||||
VerticalOptions = LayoutOptions.End,
|
||||
HorizontalOptions = LayoutOptions.Fill,
|
||||
Style = (Style)Application.Current.Resources["btn-primaryAccent"],
|
||||
Uppercase = false,
|
||||
BackgroundColor = Color.Transparent,
|
||||
FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Button))
|
||||
Style = (Style)Application.Current.Resources["btn-primary"]
|
||||
};
|
||||
}
|
||||
}
|
|
@ -4,7 +4,6 @@ using Xamarin.Forms;
|
|||
using XLabs.Ioc;
|
||||
using Bit.App.Abstractions;
|
||||
using Bit.App.Resources;
|
||||
using FFImageLoading.Forms;
|
||||
|
||||
namespace Bit.App.Pages
|
||||
{
|
||||
|
@ -47,7 +46,8 @@ namespace Bit.App.Pages
|
|||
HorizontalTextAlignment = TextAlignment.Center,
|
||||
LineBreakMode = LineBreakMode.WordWrap,
|
||||
FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label)),
|
||||
TextColor = Color.Black
|
||||
TextColor = Color.Black,
|
||||
VerticalOptions = LayoutOptions.CenterAndExpand
|
||||
};
|
||||
|
||||
var disabledFs = new FormattedString();
|
||||
|
@ -66,93 +66,27 @@ namespace Bit.App.Pages
|
|||
HorizontalTextAlignment = TextAlignment.Center,
|
||||
LineBreakMode = LineBreakMode.WordWrap,
|
||||
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,
|
||||
HorizontalTextAlignment = TextAlignment.Center,
|
||||
LineBreakMode = LineBreakMode.WordWrap,
|
||||
FontSize = Device.GetNamedSize(NamedSize.Small, typeof(Label)),
|
||||
TextColor = Color.Black
|
||||
};
|
||||
|
||||
var step1Image = new CachedImage
|
||||
{
|
||||
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
|
||||
Text = AppResources.BitwardenAutofillServiceOpenAutofillSettings,
|
||||
Command = new Command(() =>
|
||||
{
|
||||
_googleAnalyticsService.TrackAppEvent("OpenAutofillSettings");
|
||||
_deviceActionService.OpenAutofillSettings();
|
||||
}),
|
||||
VerticalOptions = LayoutOptions.End,
|
||||
HorizontalOptions = LayoutOptions.Fill,
|
||||
Style = (Style)Application.Current.Resources["btn-primary"],
|
||||
FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Button))
|
||||
};
|
||||
|
||||
DisabledStackLayout = new StackLayout
|
||||
{
|
||||
Children = { BuildServiceLabel(), stepsStackLayout, BuildGoButton() },
|
||||
Children = { BuildServiceLabel(), statusDisabledLabel, goButton, BuildAccessibilityButton() },
|
||||
Orientation = StackOrientation.Vertical,
|
||||
Spacing = 20,
|
||||
Padding = new Thickness(20, 30),
|
||||
|
@ -161,7 +95,7 @@ namespace Bit.App.Pages
|
|||
|
||||
EnabledStackLayout = new StackLayout
|
||||
{
|
||||
Children = { BuildServiceLabel(), notificationsStackLayout, BuildGoButton() },
|
||||
Children = { BuildServiceLabel(), statusEnabledLabel, BuildAccessibilityButton() },
|
||||
Orientation = StackOrientation.Vertical,
|
||||
Spacing = 20,
|
||||
Padding = new Thickness(20, 30),
|
||||
|
@ -177,7 +111,7 @@ namespace Bit.App.Pages
|
|||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
UpdateEnabled();
|
||||
return true;
|
||||
});
|
||||
|
@ -200,14 +134,14 @@ namespace Bit.App.Pages
|
|||
|
||||
private void UpdateEnabled()
|
||||
{
|
||||
ScrollView.Content = _appInfoService.AutofillAccessibilityServiceEnabled ? EnabledStackLayout : DisabledStackLayout;
|
||||
ScrollView.Content = _appInfoService.AutofillServiceEnabled ? EnabledStackLayout : DisabledStackLayout;
|
||||
}
|
||||
|
||||
private Label BuildServiceLabel()
|
||||
{
|
||||
return new Label
|
||||
{
|
||||
Text = AppResources.AutofillAccessibilityDescription,
|
||||
Text = AppResources.AutofillServiceDescription,
|
||||
VerticalOptions = LayoutOptions.Start,
|
||||
HorizontalTextAlignment = TextAlignment.Center,
|
||||
LineBreakMode = LineBreakMode.WordWrap,
|
||||
|
@ -215,20 +149,20 @@ namespace Bit.App.Pages
|
|||
};
|
||||
}
|
||||
|
||||
private ExtendedButton BuildGoButton()
|
||||
private ExtendedButton BuildAccessibilityButton()
|
||||
{
|
||||
return new ExtendedButton
|
||||
{
|
||||
Text = AppResources.BitwardenAutofillServiceOpenAccessibilitySettings,
|
||||
Command = new Command(() =>
|
||||
Text = AppResources.AutofillAccessibilityService,
|
||||
Command = new Command(async () =>
|
||||
{
|
||||
_googleAnalyticsService.TrackAppEvent("OpenAccessibilitySettings");
|
||||
_deviceActionService.OpenAccessibilitySettings();
|
||||
await Navigation.PushAsync(new ToolsAccessibilityServicePage());
|
||||
}),
|
||||
VerticalOptions = LayoutOptions.End,
|
||||
HorizontalOptions = LayoutOptions.Fill,
|
||||
Style = (Style)Application.Current.Resources["btn-primary"],
|
||||
FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Button))
|
||||
Style = (Style)Application.Current.Resources["btn-primaryAccent"],
|
||||
Uppercase = false,
|
||||
BackgroundColor = Color.Transparent
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -122,11 +122,11 @@ namespace Bit.App.Pages
|
|||
{
|
||||
if(_deviceInfoService.AutofillServiceSupported)
|
||||
{
|
||||
Navigation.PushModalAsync(new ExtendedNavigationPage(new ToolsAutofillServicePage2()));
|
||||
Navigation.PushModalAsync(new ExtendedNavigationPage(new ToolsAutofillServicePage()));
|
||||
}
|
||||
else
|
||||
{
|
||||
Navigation.PushModalAsync(new ExtendedNavigationPage(new ToolsAutofillServicePage()));
|
||||
Navigation.PushModalAsync(new ExtendedNavigationPage(new ToolsAccessibilityServicePage()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue