diff --git a/src/iOS.Core/Views/StepperTableViewCell.cs b/src/iOS.Core/Views/StepperTableViewCell.cs
new file mode 100644
index 000000000..8b8400847
--- /dev/null
+++ b/src/iOS.Core/Views/StepperTableViewCell.cs
@@ -0,0 +1,39 @@
+using System;
+using UIKit;
+
+namespace Bit.iOS.Core.Views
+{
+ public class StepperTableViewCell : UITableViewCell
+ {
+ // Give some space to the right of the detail in between the spacer.
+ // This is a bit of a hack, but I did not see a way to specify a margin on the
+ // detaul DetailTextLabel or AccessoryView
+ private string _detailRightSpace = "\t";
+
+ public StepperTableViewCell(string labelName, double value, double min, double max, double increment)
+ : base(UITableViewCellStyle.Value1, nameof(SwitchTableViewCell))
+ {
+ TextLabel.Text = labelName;
+ DetailTextLabel.Text = string.Concat(value.ToString(), _detailRightSpace);
+ DetailTextLabel.TextColor = new UIColor(red: 0.47f, green: 0.47f, blue: 0.47f, alpha: 1.0f);
+
+ Stepper = new UIStepper
+ {
+ TintColor = new UIColor(red: 0.47f, green: 0.47f, blue: 0.47f, alpha: 1.0f),
+ Value = value,
+ MinimumValue = min,
+ MaximumValue = max
+ };
+ Stepper.ValueChanged += Stepper_ValueChanged;
+
+ AccessoryView = Stepper;
+ }
+
+ private void Stepper_ValueChanged(object sender, EventArgs e)
+ {
+ DetailTextLabel.Text = string.Concat(Stepper.Value.ToString(), _detailRightSpace);
+ }
+
+ public UIStepper Stepper { get; private set; }
+ }
+}
diff --git a/src/iOS.Core/iOS.Core.csproj b/src/iOS.Core/iOS.Core.csproj
index 9a237ba2c..72016c1ba 100644
--- a/src/iOS.Core/iOS.Core.csproj
+++ b/src/iOS.Core/iOS.Core.csproj
@@ -70,6 +70,7 @@
+
diff --git a/src/iOS.Extension/MainInterface.storyboard b/src/iOS.Extension/MainInterface.storyboard
index 70de6226a..e736ccaf7 100644
--- a/src/iOS.Extension/MainInterface.storyboard
+++ b/src/iOS.Extension/MainInterface.storyboard
@@ -40,7 +40,7 @@
-
+
@@ -57,7 +57,7 @@
-
+
@@ -78,7 +78,7 @@
-
+
@@ -200,7 +200,7 @@
-
+
@@ -246,7 +246,7 @@
-
+
@@ -262,7 +262,7 @@
-
+
@@ -279,7 +279,7 @@
-
+
diff --git a/src/iOS.Extension/PasswordGeneratorViewController.cs b/src/iOS.Extension/PasswordGeneratorViewController.cs
index c0c2b51ca..221efcd88 100644
--- a/src/iOS.Extension/PasswordGeneratorViewController.cs
+++ b/src/iOS.Extension/PasswordGeneratorViewController.cs
@@ -14,6 +14,7 @@ using Bit.App;
using Plugin.Connectivity.Abstractions;
using Bit.iOS.Core.Utilities;
using Plugin.Settings.Abstractions;
+using CoreGraphics;
namespace Bit.iOS.Extension
{
@@ -32,6 +33,8 @@ namespace Bit.iOS.Extension
public SwitchTableViewCell LowercaseCell { get; set; } = new SwitchTableViewCell("a-z");
public SwitchTableViewCell NumbersCell { get; set; } = new SwitchTableViewCell("0-9");
public SwitchTableViewCell SpecialCell { get; set; } = new SwitchTableViewCell("!@#$%^&*");
+ public StepperTableViewCell MinNumbersCell { get; set; } = new StepperTableViewCell("Minimum Numbers", 1, 0, 5, 1);
+ public StepperTableViewCell MinSpecialCell { get; set; } = new StepperTableViewCell("Minimum Special", 1, 0, 5, 1);
public override void ViewWillAppear(bool animated)
{
@@ -48,7 +51,11 @@ namespace Bit.iOS.Extension
View.BackgroundColor = new UIColor(red: 0.94f, green: 0.94f, blue: 0.96f, alpha: 1.0f);
PasswordLabel.Text = _passwordGenerationService.GeneratePassword();
- PasswordLabel.Font = UIFont.FromName("Courier", 17);
+ var descriptor = UIFontDescriptor.PreferredBody;
+ PasswordLabel.Font = UIFont.FromName("Courier", descriptor.PointSize * 1.3f);
+ PasswordLabel.LineBreakMode = UILineBreakMode.TailTruncation;
+ PasswordLabel.Lines = 1;
+ PasswordLabel.AdjustsFontSizeToFitWidth = false;
var controller = ChildViewControllers.LastOrDefault();
if(controller != null)
@@ -126,11 +133,11 @@ namespace Bit.iOS.Extension
}
else if(indexPath.Row == 5)
{
- // TODO: Min numbers stepper
+ return _controller.MinNumbersCell;
}
else if(indexPath.Row == 6)
{
- // TODO: Min special stepper
+ return _controller.MinSpecialCell;
}
return new UITableViewCell();
@@ -158,9 +165,27 @@ namespace Bit.iOS.Extension
public override nfloat GetHeightForHeader(UITableView tableView, nint section)
{
+ if(section == 0)
+ {
+ return 0.00001f;
+ }
+
return UITableView.AutomaticDimension;
}
+ public override UIView GetViewForHeader(UITableView tableView, nint section)
+ {
+ if(section == 0)
+ {
+ return new UIView(CGRect.Empty)
+ {
+ Hidden = true
+ };
+ }
+
+ return null;
+ }
+
public override string TitleForHeader(UITableView tableView, nint section)
{
if(section == 1)
diff --git a/src/iOS.Extension/SiteListViewController.cs b/src/iOS.Extension/SiteListViewController.cs
index a13131874..50e9e5ec6 100644
--- a/src/iOS.Extension/SiteListViewController.cs
+++ b/src/iOS.Extension/SiteListViewController.cs
@@ -108,18 +108,26 @@ namespace Bit.iOS.Extension
public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath)
{
var cell = tableView.DequeueReusableCell(CellIdentifier);
- var item = _tableItems.ElementAt(indexPath.Row);
// if there are no cells to reuse, create a new one
if(cell == null)
{
cell = new UITableViewCell(UITableViewCellStyle.Subtitle, CellIdentifier);
}
+ return cell;
+ }
+ public override void WillDisplay( UITableView tableView, UITableViewCell cell, NSIndexPath indexPath )
+ {
+ if(cell == null)
+ {
+ return;
+ }
+
+ var item = _tableItems.ElementAt( indexPath.Row );
cell.TextLabel.Text = item.Name;
cell.DetailTextLabel.Text = item.Username;
- cell.DetailTextLabel.TextColor = cell.DetailTextLabel.TintColor = new UIColor(red: 0.47f, green: 0.47f, blue: 0.47f, alpha: 1.0f);
- return cell;
+ cell.DetailTextLabel.TextColor = cell.DetailTextLabel.TintColor = new UIColor( red: 0.47f, green: 0.47f, blue: 0.47f, alpha: 1.0f );
}
public override void RowSelected(UITableView tableView, NSIndexPath indexPath)