autofill tools page for ios 12

This commit is contained in:
Kyle Spearrin 2018-09-21 16:03:34 -04:00
parent fce2a7ba94
commit 89c2f62f11
11 changed files with 116 additions and 5 deletions

View file

@ -0,0 +1,65 @@
using System;
using Bit.App.Controls;
using Xamarin.Forms;
using Bit.App.Resources;
using FFImageLoading.Forms;
namespace Bit.App.Pages
{
public class ToolsAutofillPage : ExtendedContentPage
{
public ToolsAutofillPage()
{
Init();
}
public void Init()
{
var notStartedLabel = new Label
{
Text = AppResources.ExtensionInstantAccess,
VerticalOptions = LayoutOptions.Start,
HorizontalOptions = LayoutOptions.Center,
HorizontalTextAlignment = TextAlignment.Center,
LineBreakMode = LineBreakMode.WordWrap,
FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Label))
};
var notStartedSublabel = new Label
{
Text = AppResources.ExtensionTurnOn,
VerticalOptions = LayoutOptions.Start,
HorizontalOptions = LayoutOptions.Center,
HorizontalTextAlignment = TextAlignment.Center,
LineBreakMode = LineBreakMode.WordWrap
};
var keyboardImge = new CachedImage
{
Source = "autofill-kb.png",
VerticalOptions = LayoutOptions.CenterAndExpand,
HorizontalOptions = LayoutOptions.Center,
Margin = new Thickness(0, -10, 0, 0),
WidthRequest = 290,
HeightRequest = 252
};
var stackLayout = new StackLayout
{
Orientation = StackOrientation.Vertical,
Spacing = 20,
Padding = new Thickness(20, 20, 20, 30),
Children = { notStartedLabel, notStartedSublabel, keyboardImge },
VerticalOptions = LayoutOptions.FillAndExpand
};
if(Device.RuntimePlatform == Device.iOS)
{
ToolbarItems.Add(new DismissModalToolBarItem(this, AppResources.Close));
}
Title = AppResources.Autofill;
Content = new ScrollView { Content = stackLayout };
}
}
}

View file

@ -40,11 +40,20 @@ namespace Bit.App.Pages
var section = new TableSection(Helpers.GetEmptyTableSectionTitle()); var section = new TableSection(Helpers.GetEmptyTableSectionTitle());
if(Device.RuntimePlatform == Device.iOS) if(Device.RuntimePlatform == Device.iOS)
{
if(_deviceInfoService.Version < 12)
{ {
ExtensionCell = new ToolsViewCell(AppResources.BitwardenAppExtension, ExtensionCell = new ToolsViewCell(AppResources.BitwardenAppExtension,
AppResources.BitwardenAppExtensionDescription, "upload.png"); AppResources.BitwardenAppExtensionDescription, "upload.png");
section.Add(ExtensionCell); section.Add(ExtensionCell);
} }
else
{
ExtensionCell = new ToolsViewCell(AppResources.Autofill,
AppResources.BitwardenAutofillDescription, "magic.png");
section.Add(ExtensionCell);
}
}
if(Device.RuntimePlatform == Device.Android) if(Device.RuntimePlatform == Device.Android)
{ {
var accessibilityDesc = AppResources.BitwardenAutofillAccessibilityServiceDescription; var accessibilityDesc = AppResources.BitwardenAutofillAccessibilityServiceDescription;
@ -151,15 +160,22 @@ namespace Bit.App.Pages
} }
private void ExtensionCell_Tapped(object sender, EventArgs e) private void ExtensionCell_Tapped(object sender, EventArgs e)
{
if(_deviceInfoService.Version < 12)
{ {
Navigation.PushModalAsync(new ExtendedNavigationPage(new ToolsExtensionPage())); Navigation.PushModalAsync(new ExtendedNavigationPage(new ToolsExtensionPage()));
} }
else
{
Navigation.PushModalAsync(new ExtendedNavigationPage(new ToolsAutofillPage()));
}
}
private void WebCell_Tapped(object sender, EventArgs e) private void WebCell_Tapped(object sender, EventArgs e)
{ {
_googleAnalyticsService.TrackAppEvent("OpenedTool", "Web"); _googleAnalyticsService.TrackAppEvent("OpenedTool", "Web");
var appSettings = Resolver.Resolve<IAppSettingsService>(); var appSettings = Resolver.Resolve<IAppSettingsService>();
if (!string.IsNullOrWhiteSpace(appSettings.BaseUrl)) if(!string.IsNullOrWhiteSpace(appSettings.BaseUrl))
{ {
Device.OpenUri(new Uri(appSettings.BaseUrl)); Device.OpenUri(new Uri(appSettings.BaseUrl));
} }

View file

@ -528,6 +528,15 @@ namespace Bit.App.Resources {
} }
} }
/// <summary>
/// Looks up a localized string similar to AutoFill logins directly from your keyboard when logging into websites and other apps..
/// </summary>
public static string BitwardenAutofillDescription {
get {
return ResourceManager.GetString("BitwardenAutofillDescription", resourceCulture);
}
}
/// <summary> /// <summary>
/// Looks up a localized string similar to We were unable to automatically open the Android autofill settings menu for you. You can navigate to the autofill settings menu manually from Android Settings &gt; System &gt; Languages and input &gt; Advanced &gt; Autofill service.. /// Looks up a localized string similar to We were unable to automatically open the Android autofill settings menu for you. You can navigate to the autofill settings menu manually from Android Settings &gt; System &gt; Languages and input &gt; Advanced &gt; Autofill service..
/// </summary> /// </summary>

View file

@ -1325,4 +1325,7 @@
<data name="AutofillSetup2" xml:space="preserve"> <data name="AutofillSetup2" xml:space="preserve">
<value>We recommend disabling any other AutoFill apps under Settings if you do not plan to use them.</value> <value>We recommend disabling any other AutoFill apps under Settings if you do not plan to use them.</value>
</data> </data>
<data name="BitwardenAutofillDescription" xml:space="preserve">
<value>AutoFill logins directly from your keyboard when logging into websites and other apps.</value>
</data>
</root> </root>

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 83 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 136 KiB

BIN
src/iOS/Resources/magic.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 778 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

View file

@ -735,5 +735,23 @@
<ItemGroup> <ItemGroup>
<BundleResource Include="Resources\cog_alt%403x.png" /> <BundleResource Include="Resources\cog_alt%403x.png" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<BundleResource Include="Resources\autofill-kb.png" />
</ItemGroup>
<ItemGroup>
<BundleResource Include="Resources\autofill-kb%402x.png" />
</ItemGroup>
<ItemGroup>
<BundleResource Include="Resources\autofill-kb%403x.png" />
</ItemGroup>
<ItemGroup>
<BundleResource Include="Resources\magic.png" />
</ItemGroup>
<ItemGroup>
<BundleResource Include="Resources\magic%402x.png" />
</ItemGroup>
<ItemGroup>
<BundleResource Include="Resources\magic%403x.png" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" /> <Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" />
</Project> </Project>