diff --git a/src/App/Controls/ExtendedTextCell.cs b/src/App/Controls/ExtendedTextCell.cs index 73341eef5..34fb2467f 100644 --- a/src/App/Controls/ExtendedTextCell.cs +++ b/src/App/Controls/ExtendedTextCell.cs @@ -14,7 +14,7 @@ namespace Bit.App.Controls BindableProperty.Create(nameof(BackgroundColor), typeof(Color), typeof(ExtendedTextCell), Color.White); public static readonly BindableProperty ShowDisclousureProperty = - BindableProperty.Create(nameof(DisclousureImage), typeof(bool), typeof(ExtendedTextCell), false); + BindableProperty.Create(nameof(ShowDisclousure), typeof(bool), typeof(ExtendedTextCell), false); public static readonly BindableProperty DisclousureImageProperty = BindableProperty.Create(nameof(DisclousureImage), typeof(string), typeof(ExtendedTextCell), string.Empty); diff --git a/src/App/Controls/ExtendedViewCell.cs b/src/App/Controls/ExtendedViewCell.cs index 62c0acf21..9a6813273 100644 --- a/src/App/Controls/ExtendedViewCell.cs +++ b/src/App/Controls/ExtendedViewCell.cs @@ -8,10 +8,19 @@ namespace Bit.App.Controls public static readonly BindableProperty BackgroundColorProperty = BindableProperty.Create(nameof(BackgroundColor), typeof(Color), typeof(ExtendedTextCell), Color.White); + public static readonly BindableProperty ShowDisclousureProperty = + BindableProperty.Create(nameof(ShowDisclousure), typeof(bool), typeof(ExtendedTextCell), false); + public Color BackgroundColor { get { return (Color)GetValue(BackgroundColorProperty); } set { SetValue(BackgroundColorProperty, value); } } + + public bool ShowDisclousure + { + get { return (bool)GetValue(ShowDisclousureProperty); } + set { SetValue(ShowDisclousureProperty, value); } + } } } diff --git a/src/App/Pages/MainPage.cs b/src/App/Pages/MainPage.cs index 3c48c8b56..4761463b2 100644 --- a/src/App/Pages/MainPage.cs +++ b/src/App/Pages/MainPage.cs @@ -24,7 +24,7 @@ namespace Bit.App.Pages vaultNavigation.Icon = "fa-lock"; toolsNavigation.Title = AppResources.Tools; - toolsNavigation.Icon = "fa-refresh"; + toolsNavigation.Icon = "wrench"; settingsNavigation.Title = AppResources.Settings; settingsNavigation.Icon = "cogs"; diff --git a/src/App/Pages/ToolsPage.cs b/src/App/Pages/ToolsPage.cs index 5c385de4c..e8b29389b 100644 --- a/src/App/Pages/ToolsPage.cs +++ b/src/App/Pages/ToolsPage.cs @@ -23,8 +23,101 @@ namespace Bit.App.Pages public void Init() { + var generatorCell = new ToolsViewCell("Password Generator", "Automatically generate strong, unique passwords for your logins.", "refresh"); + var extensionCell = new ToolsViewCell("bitwarden App Extension", "Use bitwarden in Safari and other apps to auto-fill your logins.", "upload"); + var webCell = new ToolsViewCell("bitwarden Web Vault", "Manage your logins from any web browser with the bitwarden web vault.", "globe"); + webCell.Tapped += WebCell_Tapped; + var importCell = new ToolsViewCell("Import Logins", "Quickly bulk import your logins from other password management apps.", "cloudup"); + importCell.Tapped += ImportCell_Tapped; + + var table = new ExtendedTableView + { + EnableScrolling = true, + Intent = TableIntent.Menu, + HasUnevenRows = true, + Root = new TableRoot + { + new TableSection() + { + generatorCell, + extensionCell, + webCell, + importCell + } + } + }; + + if(Device.OS == TargetPlatform.iOS) + { + table.RowHeight = -1; + table.EstimatedRowHeight = 100; + } + Title = AppResources.Tools; - Icon = "fa-refresh"; + Content = table; + } + + private void WebCell_Tapped(object sender, EventArgs e) + { + Device.OpenUri(new Uri("https://vault.bitwarden.com")); + } + + private async void ImportCell_Tapped(object sender, EventArgs e) + { + if(!await _userDialogs.ConfirmAsync("You can bulk import logins from the bitwarden.com web vault. Do you want to visit the website now?", null, AppResources.Yes, AppResources.Cancel)) + { + return; + } + + Device.OpenUri(new Uri("https://vault.bitwarden.com")); + } + + public class ToolsViewCell : ExtendedViewCell + { + public ToolsViewCell(string labelText, string detailText, string imageSource) + { + var label = new Label + { + VerticalOptions = LayoutOptions.CenterAndExpand, + LineBreakMode = LineBreakMode.TailTruncation, + Text = labelText + }; + + var detail = new Label + { + FontSize = Device.GetNamedSize(NamedSize.Small, typeof(Label)), + LineBreakMode = LineBreakMode.WordWrap, + VerticalOptions = LayoutOptions.End, + Style = (Style)Application.Current.Resources["text-muted"], + Text = detailText + }; + + var labelDetailStackLayout = new StackLayout + { + HorizontalOptions = LayoutOptions.StartAndExpand, + VerticalOptions = LayoutOptions.FillAndExpand, + Children = { label, detail }, + Spacing = 0 + }; + + var image = new Image + { + HorizontalOptions = LayoutOptions.Start, + VerticalOptions = LayoutOptions.FillAndExpand, + Source = imageSource, + Margin = new Thickness(0, 0, 10, 0) + }; + + var containerStackLayout = new StackLayout + { + Orientation = StackOrientation.Horizontal, + Children = { image, labelDetailStackLayout }, + Padding = new Thickness(15, 25) + }; + + ShowDisclousure = true; + View = containerStackLayout; + } } } } diff --git a/src/iOS/Controls/ExtendedViewCellRenderer.cs b/src/iOS/Controls/ExtendedViewCellRenderer.cs index ca0de6408..2ebb13e83 100644 --- a/src/iOS/Controls/ExtendedViewCellRenderer.cs +++ b/src/iOS/Controls/ExtendedViewCellRenderer.cs @@ -17,6 +17,10 @@ namespace Bit.iOS.Controls if(cell != null) { cell.BackgroundColor = extendedCell.BackgroundColor.ToUIColor(); + if(extendedCell.ShowDisclousure) + { + cell.Accessory = UITableViewCellAccessory.DisclosureIndicator; + } } return cell; diff --git a/src/iOS/Resources/cloudup.png b/src/iOS/Resources/cloudup.png new file mode 100644 index 000000000..66994f79c Binary files /dev/null and b/src/iOS/Resources/cloudup.png differ diff --git a/src/iOS/Resources/cloudup@2x.png b/src/iOS/Resources/cloudup@2x.png new file mode 100644 index 000000000..4ca53c5cd Binary files /dev/null and b/src/iOS/Resources/cloudup@2x.png differ diff --git a/src/iOS/Resources/cloudup@3x.png b/src/iOS/Resources/cloudup@3x.png new file mode 100644 index 000000000..2c1bbc117 Binary files /dev/null and b/src/iOS/Resources/cloudup@3x.png differ diff --git a/src/iOS/Resources/globe.png b/src/iOS/Resources/globe.png new file mode 100644 index 000000000..d4fb1cfbf Binary files /dev/null and b/src/iOS/Resources/globe.png differ diff --git a/src/iOS/Resources/globe@2x.png b/src/iOS/Resources/globe@2x.png new file mode 100644 index 000000000..c33e48299 Binary files /dev/null and b/src/iOS/Resources/globe@2x.png differ diff --git a/src/iOS/Resources/globe@3x.png b/src/iOS/Resources/globe@3x.png new file mode 100644 index 000000000..17d3ce7ef Binary files /dev/null and b/src/iOS/Resources/globe@3x.png differ diff --git a/src/iOS/Resources/refresh.png b/src/iOS/Resources/refresh.png new file mode 100644 index 000000000..5ddde5968 Binary files /dev/null and b/src/iOS/Resources/refresh.png differ diff --git a/src/iOS/Resources/refresh@2x.png b/src/iOS/Resources/refresh@2x.png new file mode 100644 index 000000000..9c264dd74 Binary files /dev/null and b/src/iOS/Resources/refresh@2x.png differ diff --git a/src/iOS/Resources/refresh@3x.png b/src/iOS/Resources/refresh@3x.png new file mode 100644 index 000000000..1778dc218 Binary files /dev/null and b/src/iOS/Resources/refresh@3x.png differ diff --git a/src/iOS/Resources/upload.png b/src/iOS/Resources/upload.png new file mode 100644 index 000000000..c36c2b830 Binary files /dev/null and b/src/iOS/Resources/upload.png differ diff --git a/src/iOS/Resources/upload@2x.png b/src/iOS/Resources/upload@2x.png new file mode 100644 index 000000000..6a2ec4e2c Binary files /dev/null and b/src/iOS/Resources/upload@2x.png differ diff --git a/src/iOS/Resources/upload@3x.png b/src/iOS/Resources/upload@3x.png new file mode 100644 index 000000000..eafb9d623 Binary files /dev/null and b/src/iOS/Resources/upload@3x.png differ diff --git a/src/iOS/Resources/wrench.png b/src/iOS/Resources/wrench.png new file mode 100644 index 000000000..2a90b09ee Binary files /dev/null and b/src/iOS/Resources/wrench.png differ diff --git a/src/iOS/Resources/wrench@2x.png b/src/iOS/Resources/wrench@2x.png new file mode 100644 index 000000000..9834bd070 Binary files /dev/null and b/src/iOS/Resources/wrench@2x.png differ diff --git a/src/iOS/Resources/wrench@3x.png b/src/iOS/Resources/wrench@3x.png new file mode 100644 index 000000000..abdc7ae6f Binary files /dev/null and b/src/iOS/Resources/wrench@3x.png differ diff --git a/src/iOS/iOS.csproj b/src/iOS/iOS.csproj index a5902eae3..893b9f332 100644 --- a/src/iOS/iOS.csproj +++ b/src/iOS/iOS.csproj @@ -439,6 +439,51 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +