1
0
mirror of https://github.com/bitwarden/mobile synced 2026-01-06 02:23:57 +00:00

Respect options on gneerate password. Allow override parameters to be passed into password generation service. Respect context password options. Copy password.

This commit is contained in:
Kyle Spearrin
2016-07-15 01:01:00 -04:00
parent 83359b2d43
commit b90c153353
8 changed files with 241 additions and 62 deletions

View File

@@ -20,6 +20,13 @@ namespace Bit.iOS.Core.Utilities
return alert;
}
public static UIAlertController CreateMessageAlert(string message)
{
var alert = UIAlertController.Create(null, message, UIAlertControllerStyle.Alert);
alert.View.TintColor = UIColor.Black;
return alert;
}
public static UIAlertController CreateAlert(string title, string message, string accept)
{
var alert = UIAlertController.Create(title, message, UIAlertControllerStyle.Alert);

View File

@@ -6,33 +6,51 @@ namespace Bit.iOS.Core.Views
public class SliderTableViewCell : UITableViewCell
{
private string _detailRightSpace = "\t";
private int _value;
public SliderTableViewCell(string labelName, float value, float min, float max)
public SliderTableViewCell(string labelName, int value, int min, int max)
: 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);
Slider = new UISlider
{
MinValue = min,
MaxValue = max,
Value = value,
TintColor = new UIColor(red: 0.24f, green: 0.55f, blue: 0.74f, alpha: 1.0f),
Frame = new CoreGraphics.CGRect(0, 0, 180, 20)
};
Slider.ValueChanged += Slider_ValueChanged;
Value = value;
AccessoryView = Slider;
}
private void Slider_ValueChanged(object sender, EventArgs e)
{
Slider.Value = Convert.ToInt32(Math.Round(Slider.Value, 0));
DetailTextLabel.Text = string.Concat(Slider.Value.ToString(), _detailRightSpace);
var newValue = Convert.ToInt32(Math.Round(Slider.Value, 0));
bool valueChanged = newValue != Value;
Value = newValue;
if(valueChanged)
{
ValueChanged(this, null);
}
}
public UISlider Slider { get; set; }
public int Value
{
get { return _value; }
set
{
_value = value;
Slider.Value = value;
DetailTextLabel.Text = string.Concat(value.ToString(), _detailRightSpace);
}
}
public event EventHandler ValueChanged;
}
}

View File

@@ -9,31 +9,43 @@ namespace Bit.iOS.Core.Views
// 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";
private int _value;
public StepperTableViewCell(string labelName, double value, double min, double max, double increment)
public StepperTableViewCell(string labelName, int value, int min, int max, int 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;
Value = value;
AccessoryView = Stepper;
}
private void Stepper_ValueChanged(object sender, EventArgs e)
{
DetailTextLabel.Text = string.Concat(Stepper.Value.ToString(), _detailRightSpace);
Value = Convert.ToInt32(Stepper.Value);
ValueChanged(this, null);
}
public UIStepper Stepper { get; private set; }
public int Value
{
get { return _value; }
set
{
_value = value;
Stepper.Value = value;
DetailTextLabel.Text = string.Concat(value.ToString(), _detailRightSpace);
}
}
public event EventHandler ValueChanged;
}
}

View File

@@ -10,8 +10,16 @@ namespace Bit.iOS.Core.Views
{
TextLabel.Text = labelName;
AccessoryView = Switch;
Switch.ValueChanged += Switch_ValueChanged;
}
private void Switch_ValueChanged(object sender, EventArgs e)
{
ValueChanged(this, null);
}
public UISwitch Switch { get; set; } = new UISwitch();
public event EventHandler ValueChanged;
}
}