mirror of
https://github.com/bitwarden/mobile
synced 2025-12-23 11:43:49 +00:00
Add passphrase generator to iOS Extensions (#1230)
* Add passphrase generator options to iOS extension * Set custom indentation on WordSeparator control * Set correct RowsInSection for passphrase controls * Fix RowsInSection for password controls * Add avoid ambiguous characters control
This commit is contained in:
@@ -11,7 +11,8 @@ namespace Bit.iOS.Core.Views
|
||||
string labelName = null,
|
||||
bool useTextView = false,
|
||||
nfloat? height = null,
|
||||
bool useLabelAsPlaceholder = false)
|
||||
bool useLabelAsPlaceholder = false,
|
||||
float leadingConstant = 15f)
|
||||
: base(UITableViewCellStyle.Default, nameof(FormEntryTableViewCell))
|
||||
{
|
||||
var descriptor = UIFontDescriptor.PreferredBody;
|
||||
@@ -48,7 +49,7 @@ namespace Bit.iOS.Core.Views
|
||||
|
||||
ContentView.Add(TextView);
|
||||
ContentView.AddConstraints(new NSLayoutConstraint[] {
|
||||
NSLayoutConstraint.Create(TextView, NSLayoutAttribute.Leading, NSLayoutRelation.Equal, ContentView, NSLayoutAttribute.Leading, 1f, 15f),
|
||||
NSLayoutConstraint.Create(TextView, NSLayoutAttribute.Leading, NSLayoutRelation.Equal, ContentView, NSLayoutAttribute.Leading, 1f, leadingConstant),
|
||||
NSLayoutConstraint.Create(ContentView, NSLayoutAttribute.Trailing, NSLayoutRelation.Equal, TextView, NSLayoutAttribute.Trailing, 1f, 15f),
|
||||
NSLayoutConstraint.Create(ContentView, NSLayoutAttribute.Bottom, NSLayoutRelation.Equal, TextView, NSLayoutAttribute.Bottom, 1f, 10f)
|
||||
});
|
||||
@@ -69,7 +70,13 @@ namespace Bit.iOS.Core.Views
|
||||
ContentView.AddConstraint(
|
||||
NSLayoutConstraint.Create(TextView, NSLayoutAttribute.Height, NSLayoutRelation.Equal, null, NSLayoutAttribute.NoAttribute, 1f, height.Value));
|
||||
}
|
||||
|
||||
TextView.Changed += (object sender, EventArgs e) =>
|
||||
{
|
||||
ValueChanged?.Invoke(sender, e);
|
||||
};
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
TextField = new UITextField
|
||||
@@ -95,7 +102,7 @@ namespace Bit.iOS.Core.Views
|
||||
|
||||
ContentView.Add(TextField);
|
||||
ContentView.AddConstraints(new NSLayoutConstraint[] {
|
||||
NSLayoutConstraint.Create(TextField, NSLayoutAttribute.Leading, NSLayoutRelation.Equal, ContentView, NSLayoutAttribute.Leading, 1f, 15f),
|
||||
NSLayoutConstraint.Create(TextField, NSLayoutAttribute.Leading, NSLayoutRelation.Equal, ContentView, NSLayoutAttribute.Leading, 1f, leadingConstant),
|
||||
NSLayoutConstraint.Create(ContentView, NSLayoutAttribute.Trailing, NSLayoutRelation.Equal, TextField, NSLayoutAttribute.Trailing, 1f, 15f),
|
||||
NSLayoutConstraint.Create(ContentView, NSLayoutAttribute.Bottom, NSLayoutRelation.Equal, TextField, NSLayoutAttribute.Bottom, 1f, 10f)
|
||||
});
|
||||
@@ -116,12 +123,17 @@ namespace Bit.iOS.Core.Views
|
||||
ContentView.AddConstraint(
|
||||
NSLayoutConstraint.Create(TextField, NSLayoutAttribute.Height, NSLayoutRelation.Equal, null, NSLayoutAttribute.NoAttribute, 1f, height.Value));
|
||||
}
|
||||
|
||||
TextField.AddTarget((object sender, EventArgs e) =>
|
||||
{
|
||||
ValueChanged?.Invoke(sender, e);
|
||||
}, UIControlEvent.EditingChanged);
|
||||
}
|
||||
|
||||
if (labelName != null && !useLabelAsPlaceholder)
|
||||
{
|
||||
ContentView.AddConstraints(new NSLayoutConstraint[] {
|
||||
NSLayoutConstraint.Create(Label, NSLayoutAttribute.Leading, NSLayoutRelation.Equal, ContentView, NSLayoutAttribute.Leading, 1f, 15f),
|
||||
NSLayoutConstraint.Create(Label, NSLayoutAttribute.Leading, NSLayoutRelation.Equal, ContentView, NSLayoutAttribute.Leading, 1f, leadingConstant),
|
||||
NSLayoutConstraint.Create(Label, NSLayoutAttribute.Top, NSLayoutRelation.Equal, ContentView, NSLayoutAttribute.Top, 1f, 10f),
|
||||
NSLayoutConstraint.Create(ContentView, NSLayoutAttribute.Trailing, NSLayoutRelation.Equal, Label, NSLayoutAttribute.Trailing, 1f, 15f)
|
||||
});
|
||||
@@ -131,6 +143,7 @@ namespace Bit.iOS.Core.Views
|
||||
public UILabel Label { get; set; }
|
||||
public UITextField TextField { get; set; }
|
||||
public UITextView TextView { get; set; }
|
||||
public event EventHandler ValueChanged;
|
||||
|
||||
public void Select()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user